1"====================================================================== 2| 3| SDL declarations 4| 5| 6 ======================================================================" 7 8 9"====================================================================== 10| 11| Copyright 2006, 2008 Free Software Foundation, Inc. 12| Written by Brad Watson 13| 14| This file is part of the GNU Smalltalk class library. 15| 16| The GNU Smalltalk class library is free software; you can redistribute it 17| and/or modify it under the terms of the GNU Lesser General Public License 18| as published by the Free Software Foundation; either version 2.1, or (at 19| your option) any later version. 20| 21| The GNU Smalltalk class library is distributed in the hope that it will be 22| useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 23| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 24| General Public License for more details. 25| 26| You should have received a copy of the GNU Lesser General Public License 27| along with the GNU Smalltalk class library; see the file COPYING.LIB. 28| If not, write to the Free Software Foundation, 59 Temple Place - Suite 29| 330, Boston, MA 02110-1301, USA. 30| 31 ======================================================================" 32 33 34"====================================================================== 35| 36| Notes: implemented without callbacks. 37| 38 ======================================================================" 39 40Object subclass: #SdlTTF 41 instanceVariableNames: '' 42 classVariableNames: '' 43 poolDictionaries: '' 44 category: 'LibSDL-TTF'! ! 45 46!SdlTTF class methodsFor: 'Constants'! 47 48sdlTTFMajorVersion 49 ^2! 50 51sdlTTFMinorVersion 52 ^0! 53 54sdlTTFPatchlevel 55 ^7! 56 57ttfMajorVersion 58 ^2! 59 60ttfMinorVersion 61 ^0! 62 63ttfPatchlevel 64 ^7! 65 66unicodeBomNative 67 ^16rFEFF! 68 69unicodeBomSwapped 70 ^16rFFFE! 71 72ttfStyleNormal 73 ^16r00! 74 75ttfStyleBold 76 ^16r01! 77 78ttfStyleItalic 79 ^16r02! 80 81ttfStyleUnderline 82 ^16r04! 83 84!SdlTTF class methodsFor: 'C call-outs'! 85 86ttfInit 87 "I initialize the TTF engine. My C function call prototype: 88 89 extern DECLSPEC int SDLCALL TTF_Init(void);" 90 <cCall: 'TTF_Init' returning: #int 91 args: #( )>! 92 93ttfOpenFont: aString0 ptSize: aInt1 94 "I open a font file and create a font of the specified point 95 size. My C function call prototype: 96 97 extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFont(const char *file, int ptsize);" 98 <cCall: 'TTF_OpenFont' returning: #cObject 99 args: #( #string #int )>! 100 101ttfGetFontStyle: aCobject0 102 "I retrieve the font style. My C function call prototype: 103 104 extern DECLSPEC int SDLCALL TTF_GetFontStyle(TTF_Font *font);" 105 <cCall: 'TTF_GetFontStyle' returning: #int 106 args: #( #cObject )>! 107 108ttfSetFontStyle: aCobject0 style: aInt1 109 "I set the font style. My C function call prototype: 110 111 extern DECLSPEC void TTF_SetFontStyle(TTF_Font *font, int style);" 112 <cCall: 'TTF_SetFontStyle' returning: #void 113 args: #( #cObject #int )>! 114 115ttfFontHeight: aCobject0 116 "I retrieve the total height of the font. My C function call prototype: 117 118 extern DECLSPEC int SDLCALL TTF_FontHeight(TTF_Font *font);" 119 <cCall: 'TTF_FontHeight' returning: #int 120 args: #( #cObject )>! 121 122ttfFontAscent: aCobject0 123 "I retrieve the offset from the baseline to the top of the 124 font. My C function call prototype: 125 126 extern DECLSPEC int SDLCALL TTF_FontAscent(TTF_Font *font);" 127 <cCall: 'TTF_FontAscent' returning: #int 128 args: #( #cObject )>! 129 130ttfFontDescent: aCobject0 131 "I get the offset from the baseline to the bottom of the font. My 132 C call prototype: 133 134 extern DECLSPEC int SDLCALL TTF_FontDescent(TTF_Font *font);" 135 <cCall: 'TTF_FontDescent' returning: #int 136 args: #( #cObject )>! 137 138ttfFontLineSkip: aCobject0 139 "I answer the recommended spacing between lines of text for this 140 font. My C function call prototype: 141 142 extern DECLSPEC int SDLCALL TTF_FontLineSkip(TTF_Font *font);" 143 <cCall: 'TTF_FontLineSkip' returning: #int 144 args: #( #cObject )>! 145 146ttfGlyphMetrics: aCobject ch: aInt1 minX: aCobject2 maxX: aCobject3 minY: aCobject4 147 advance: aCobject5 148 "I answer the dimensions of a glyph. My C function call prototype: 149 150 extern DECLSPEC int SDLCALL TTF_GlyphMetrics(TTF_Font *font, Uint16 ch, 151 int *minx, int *maxx, int *miny, int *maxy, int *advance);" 152 <cCall: 'TTF_GlyphMetrics' returning: #int 153 args: #( #cObject #int #cObject #cObject #cObject #cObject )>! 154 155ttfSizeText: aCobject0 text: aString1 w: aCobject2 h: aCobject3 156 "I answer the dimensions of a rendered string of text. My C 157 function call prototype: 158 159 extern DECLSPEC int SDLCALL TTF_SizeText(TTF_Font *font, const char *text, 160 int *w, int *h);" 161 <cCall: 'TTF_SizeText' returning: #int 162 args: #( #cObject #string #cObject #cObject )>! 163 164ttfSizeUTF8: aCobject0 text: aString1 w: aCobject2 h: aCobject3 165 "I answer the dimensions of a rendered string of text. My C 166 function call prototype: 167 168 extern DECLSPEC int SDLCALL TTF_SizeUTF8(TTF_Font *font, const char *text, 169 int *w, int *h);" 170 <cCall: 'TTF_SizeUTF8' returning: #int 171 args: #( #cObject #string #cObject #cObject )>! 172 173ttfSizeUnicode: aCobject0 text: aCobject1 w: aCobject2 h: aCobject3 174 "I answer the dimensions of a rendered string of text. My C 175 function call prototype: 176 177 extern DECLSPEC int SDLCALL TTF_SizeUNICODE(TTF_Font *font, const Uint16 *text, 178 int *w, int *h);" 179 <cCall: 'TTF_SizeUNICODE' returning: #int 180 args: #( #cObject #cObject #cObject #cObject )>! 181 182ttfRenderTextSolid: aCobject0 text: aString1 fg: aCobject2 183 "I create an 8-bit palettized surface and render the given text at 184 fast quality with the given font and color. My C function call 185 prototype: 186 187 extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Solid(TTF_Font *font, 188 const char *text, SDL_Color fg);" 189 <cCall: 'TTF_RenderText_Solid' returning: #cObject 190 args: #( #cObject #string #cObject )>! 191 192ttfRenderUTF8Solid: aCobject0 text: aString1 fg: aCobject2 193 "I create an 8-bit palettized surface and render the given text at 194 fast quality with the given font and color. My C function call 195 prototype: 196 197 extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Solid(TTF_Font *font, 198 const char *text, SDL_Color fg);" 199 <cCall: 'TTF_RenderUTF8_Solid' returning: #cObject 200 args: #( #cObject #string #cObject )>! 201 202ttfRenderUnicodeSolid: aCobject0 text: aCobject1 fg: aCobject2 203 "I create an 8-bit palettized surface and render the given text at 204 fast quality with the given font and color. My C function call 205 prototype: 206 207 extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Solid(TTF_Font *font, 208 const Uint16 *text, SDL_Color fg);" 209 <cCall: 'TTF_RenderUNICODE_Solid' returning: #cObject 210 args: #( #cObject #cObject #cObject )>! 211 212ttfRenderGlyphSolid: aCobject0 ch: aUint1 fg: aCobject2 213 "I create an 8-bit palettized surface and render the given glyph 214 at fast quality with the given font and color. My C function call 215 prototype: 216 217 extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Solid(TTF_Font *font, Uint16 ch, SDL_Color fg);" 218 <cCall: 'TTF_RenderGlyph_Solid' returning: #cObject 219 args: #( #cObject #int #cObject )>! 220 221ttfRenderTextShaded: aCobject0 text: aString1 fg: aCobject2 bg: aCobject3 222 "I create an 8-bit palettized surface and render the given text 223 at fast quality with the given font and color. My C function call 224 prototype: 225 226 extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded(TTF_Font *font, 227 const char *text, SDL_Color fg, SDL_Color bg);" 228 <cCall: 'TTF_RenderText_Shaded' returning: #cObject 229 args: #( #cObject #string #cObject #cObject )>! 230 231ttfRenderUTF8Shaded: aCobject0 text: aString1 fg: aCobject2 bg: aCobject3 232 "I create an 8-bit palettized surface and render the given text 233 at fast quality with the given font and color. My C function call 234 prototype: 235 236 extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Shaded(TTF_Font *font, 237 const char *text, SDL_Color fg, SDL_Color bg);" 238 <cCall: 'TTF_RenderUTF8_Shaded' returning: #cObject 239 args: #( #cObject #string #cObject #cObject )>! 240 241ttfRenderUnicodeShaded: aCobject0 text: aCobject1 fg: aCobject2 bg: aCobject3 242 "I create an 8-bit palettized surface and render the given text 243 at fast quality with the given font and color. My C function call 244 prototype: 245 246 extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Shaded(TTF_Font *font, 247 const Uint16 *text, SDL_Color fg, SDL_Color bg);" 248 <cCall: 'TTF_RenderUNICODE_Shaded' returning: #cObject 249 args: #( #cObject #cObject #cObject #cObject )>! 250 251ttfRenderGlyphShaded: aCobject0 ch: aInt1 fg: aCobject2 bg: aCobject3 252 "I create an 8-bit palettized surface and render the given glyph 253 at fast quality with the given font and color. My C function call 254 prototype: 255 256 extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Shaded(TTF_Font *font, 257 Uint16 ch, SDL_Color fg, SDL_Color bg);" 258 <cCall: 'TTF_RenderGlyph_Shaded' returning: #cObject 259 args: #( #cObject #int #cObject #cObject )>! 260 261ttfRenderTextBlended: aCobject0 text: aString1 fg: aCobject2 262 "I create a 32-bit ARGB surface and render the given text at high 263 quality, using alpha blending to dither the font with the given 264 color. My C function call prototype: 265 266 extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended(TTF_Font *font, 267 const char *text, SDL_Color fg);" 268 <cCall: 'TTF_RenderText_Blended' returning: #cObject 269 args: #( #cObject #string #cObject )>! 270 271ttfRenderUTF8Blended: aCobject0 text: aString1 fg: aCobject2 272 "I create a 32-bit ARGB surface and render the given text at high 273 quality, using alpha blending to dither the font with the given 274 color. My C function call prototype: 275 276 extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Blended(TTF_Font *font, 277 const char *text, SDL_Color fg);" 278 <cCall: 'TTF_RenderUTF8_Blended' returning: #cObject 279 args: #( #cObject #string #cObject )>! 280 281ttfRenderUnicodeBlended: aCobject0 text: aCobject1 fg: aCobject2 282 "I create a 32-bit ARGB surface and render the given text at high 283 quality, using alpha blending to dither the font with the given 284 color. My C function call prototype: 285 286 extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Blended(TTF_Font *font, 287 const Uint16 *text, SDL_Color fg);" 288 <cCall: 'TTF_RenderUNICODE_Blended' returning: #cObject 289 args: #( #cObject #cObject #cObject )>! 290 291ttfRenderGlyphBlended: aCobject0 ch: aInt1 fg: aCobject2 292 "I create a 32-bit ARGB surface and render the given glyph at high 293 quality, using alpha blending to dither the font with the given 294 color. My C function call prototype: 295 296 extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Blended(TTF_Font *font, 297 Uint16 ch, SDL_Color fg);" 298 <cCall: 'TTF_RenderGlyph_Blended' returning: #cObject 299 args: #( #cObject #int #cObject )>! 300 301ttfCloseFont: aCobject0 302 "I close an opened font file. My C function call prototype: 303 304 extern DECLSPEC void SDLCALL TTF_CloseFont(TTF_Font *font);" 305 <cCall: 'TTF_CloseFont' returning: #void 306 args: #( #cObject )>! 307 308ttfQuit 309 "I shutdown the TTF engine. My C function call prototype: 310 311 extern DECLSPEC void SDLCALL TTF_Quit(void);" 312 <cCall: 'TTF_Quit' returning: #void 313 args: #( )>! ! 314