TEXT Tool, first work-in-progress commit.
Truetype only, compile with "make NOTTF=1" if you don't want to bother with it. Only TTF is done, aliased (ok) and non-aliased (backgound color is currently stuck to color index 0) The Clear button doesn't update the window. Only one font (certified to be public domain). Preview not done. Font selector not done. SFont support not done. Limit 30 characters. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@305 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
46
sdlscreen.c
46
sdlscreen.c
@@ -559,4 +559,50 @@ void UpdateRect(short X, short Y, unsigned short Largeur, unsigned short Hauteur
|
||||
#if (METHODE_UPDATE == METHODE_UPDATE_PLEINE_PAGE)
|
||||
Update_necessaire=1;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// Convertit une SDL_Surface (couleurs indexées ou RGB) en tableau de bytes (couleurs indexées)
|
||||
// Si on passe NULL comme destination, elle est allouée par malloc(). Sinon,
|
||||
// attention aux dimensions!
|
||||
byte * Surface_en_bytefield(SDL_Surface *Source, byte * Destination)
|
||||
{
|
||||
byte *Src;
|
||||
byte *Dst;
|
||||
int Y;
|
||||
int Reste;
|
||||
|
||||
// Support seulement des images 256 couleurs
|
||||
if (Source->format->BytesPerPixel != 1)
|
||||
return NULL;
|
||||
|
||||
if (Source->w & 3)
|
||||
Reste=4-(Source->w&3);
|
||||
else
|
||||
Reste=0;
|
||||
|
||||
if (Destination==NULL)
|
||||
Destination=(byte *)malloc(Source->w*Source->h);
|
||||
|
||||
Dst=Destination;
|
||||
Src=(byte *)(Source->pixels);
|
||||
for(Y=0; Y < Source->h; Y++)
|
||||
{
|
||||
memcpy(Dst, Src,Source->w);
|
||||
Dst += Source->w;
|
||||
Src += Source->w + Reste;
|
||||
}
|
||||
return Destination;
|
||||
|
||||
}
|
||||
|
||||
// Convertit un index de palette en couleur RGB 24 bits
|
||||
SDL_Color Conversion_couleur_SDL(byte Index)
|
||||
{
|
||||
SDL_Color Couleur;
|
||||
Couleur.r = (Principal_Palette[Index].R<<2) + (Principal_Palette[Index].R>>4);
|
||||
Couleur.g = (Principal_Palette[Index].V<<2) + (Principal_Palette[Index].V>>4);
|
||||
Couleur.b = (Principal_Palette[Index].B<<2) + (Principal_Palette[Index].B>>4);
|
||||
Couleur.unused = 255;
|
||||
return Couleur;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user