Text tool with bitmap fonts now uses the background color instead of color 0. It was not possible to draw text with a black font if black was color 0.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1333 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2010-02-09 21:53:43 +00:00
parent 4f73c24989
commit 65f19eeec9

12
text.c
View File

@ -456,6 +456,7 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
SDL_Surface * Texte8Bit; SDL_Surface * Texte8Bit;
SDL_Surface *Surface_fonte; SDL_Surface *Surface_fonte;
byte * new_brush; byte * new_brush;
SDL_Rect rectangle;
// Chargement de la fonte // Chargement de la fonte
Surface_fonte=IMG_Load(Font_name(font_number)); Surface_fonte=IMG_Load(Font_name(font_number));
@ -476,6 +477,17 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
*width=SFont_TextWidth(font, str); *width=SFont_TextWidth(font, str);
// Allocation d'une surface SDL // Allocation d'une surface SDL
TexteColore=SDL_CreateRGBSurface(SDL_SWSURFACE, *width, *height, 24, 0, 0, 0, 0); TexteColore=SDL_CreateRGBSurface(SDL_SWSURFACE, *width, *height, 24, 0, 0, 0, 0);
// Fill with backcolor
rectangle.x=0;
rectangle.y=0;
rectangle.w=*width;
rectangle.h=*height;
SDL_FillRect(TexteColore, &rectangle, SDL_MapRGB(
TexteColore->format,
Main_palette[Back_color].R,
Main_palette[Back_color].G,
Main_palette[Back_color].B
));
// Rendu du texte // Rendu du texte
SFont_Write(TexteColore, font, 0, 0, str); SFont_Write(TexteColore, font, 0, 0, str);
if (!TexteColore) if (!TexteColore)