12 MODULE = SDL PACKAGE = SDL
18 These are here right now to keep them around with using the code.
21 TTFGetFontStyle ( font )
24 RETVAL = TTF_GetFontStyle(font);
29 TTFSetFontStyle ( font, style )
33 TTF_SetFontStyle(font,style);
36 TTFFontHeight ( font )
39 RETVAL = TTF_FontHeight(font);
44 TTFFontAscent ( font )
47 RETVAL = TTF_FontAscent(font);
52 TTFFontDescent ( font )
55 RETVAL = TTF_FontDescent(font);
60 TTFFontLineSkip ( font )
63 RETVAL = TTF_FontLineSkip(font);
68 TTFGlyphMetrics ( font, ch )
72 int minx, miny, maxx, maxy, advance;
74 TTF_GlyphMetrics(font, ch, &minx, &miny, &maxx, &maxy, &advance);
75 av_push(RETVAL,newSViv(minx));
76 av_push(RETVAL,newSViv(miny));
77 av_push(RETVAL,newSViv(maxx));
78 av_push(RETVAL,newSViv(maxy));
79 av_push(RETVAL,newSViv(advance));
85 TTFSizeUTF8 ( font, text )
91 if(TTF_SizeUTF8(font,text,&w,&h))
93 av_push(RETVAL,newSViv(w));
94 av_push(RETVAL,newSViv(h));
95 sv_2mortal((SV*)RETVAL);
100 printf("TTF error at TTFSizeUTF8 with : %s \n", TTF_GetError());
101 Perl_croak (aTHX_ "TTF error \n");
108 TTFSizeUNICODE ( font, text )
114 if(TTF_SizeUNICODE(font,text,&w,&h))
116 av_push(RETVAL,newSViv(w));
117 av_push(RETVAL,newSViv(h));
118 sv_2mortal((SV*)RETVAL);
123 printf("TTF error at TTFSizeUNICODE : %s \n", TTF_GetError());
124 Perl_croak (aTHX_ "TTF error \n");
131 TTFRenderTextSolid ( font, text, fg )
136 RETVAL = TTF_RenderText_Solid(font,text,*fg);
141 TTFRenderUTF8Solid ( font, text, fg )
146 RETVAL = TTF_RenderUTF8_Solid(font,text,*fg);
151 TTFRenderUNICODESolid ( font, text, fg )
156 RETVAL = TTF_RenderUNICODE_Solid(font,text,*fg);
161 TTFRenderGlyphSolid ( font, ch, fg )
166 RETVAL = TTF_RenderGlyph_Solid(font,ch,*fg);
171 TTFRenderTextShaded ( font, text, fg, bg )
177 RETVAL = TTF_RenderText_Shaded(font,text,*fg,*bg);
182 TTFRenderUTF8Shaded( font, text, fg, bg )
188 RETVAL = TTF_RenderUTF8_Shaded(font,text,*fg,*bg);
193 TTFRenderUNICODEShaded( font, text, fg, bg )
199 RETVAL = TTF_RenderUNICODE_Shaded(font,text,*fg,*bg);
204 TTFRenderGlyphShaded ( font, ch, fg, bg )
210 RETVAL = TTF_RenderGlyph_Shaded(font,ch,*fg,*bg);
215 TTFRenderTextBlended( font, text, fg )
220 RETVAL = TTF_RenderText_Blended(font,text,*fg);
225 TTFRenderUTF8Blended( font, text, fg )
230 RETVAL = TTF_RenderUTF8_Blended(font,text,*fg);
235 TTFRenderUNICODEBlended( font, text, fg )
240 RETVAL = TTF_RenderUNICODE_Blended(font,text,*fg);
245 TTFRenderGlyphBlended( font, ch, fg )
250 RETVAL = TTF_RenderGlyph_Blended(font,ch,*fg);
255 TTFCloseFont ( font )
259 font=NULL; //to be safe http://sdl.beuc.net/sdl.wiki/SDL_ttf_copy_Functions_Management_TTF_CloseFont
262 TTFPutString ( font, mode, surface, x, y, fg, bg, text )
280 img = TTF_RenderText_Solid(font,text,*fg);
281 TTF_SizeText(font,text,&w,&h);
286 img = TTF_RenderText_Shaded(font,text,*fg,*bg);
287 TTF_SizeText(font,text,&w,&h);
292 img = TTF_RenderText_Blended(font,text,*fg);
293 TTF_SizeText(font,text,&w,&h);
298 img = TTF_RenderUTF8_Solid(font,text,*fg);
299 TTF_SizeUTF8(font,text,&w,&h);
304 img = TTF_RenderUTF8_Shaded(font,text,*fg,*bg);
305 TTF_SizeUTF8(font,text,&w,&h);
310 img = TTF_RenderUTF8_Blended(font,text,*fg);
311 TTF_SizeUTF8(font,text,&w,&h);
316 img = TTF_RenderUNICODE_Solid(font,(Uint16*)text,*fg);
317 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
322 img = TTF_RenderUNICODE_Shaded(font,(Uint16*)text,*fg,*bg);
323 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
327 case UNICODE_BLENDED:
328 img = TTF_RenderUNICODE_Blended(font,(Uint16*)text,*fg);
329 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
334 img = TTF_RenderText_Shaded(font,text,*fg,*bg);
335 TTF_SizeText(font,text,&w,&h);
339 if ( img && img->format && img->format->palette ) {
340 SDL_Color *c = &img->format->palette->colors[0];
341 Uint32 key = SDL_MapRGB( img->format, c->r, c->g, c->b );
342 SDL_SetColorKey(img,SDL_SRCCOLORKEY,key );
343 if (0 > SDL_BlitSurface(img,NULL,surface,&dest)) {
344 SDL_FreeSurface(img);