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:
Yves Rizoud 2008-10-23 22:13:53 +00:00
parent 78e48f5156
commit 45f1dfeb7b
12 changed files with 408 additions and 17 deletions

View File

@ -1,5 +1,6 @@
# Grafx2 - The Ultimate 256-color bitmap paint program # Grafx2 - The Ultimate 256-color bitmap paint program
# #
# Copyright 2008 Peter Gordon
# Copyright 2008 Yves Rizoud # Copyright 2008 Yves Rizoud
# Copyright 2007 Adrien Destugues # Copyright 2007 Adrien Destugues
# Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) # Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
@ -19,14 +20,24 @@
# write to the Free Software Foundation, Inc., # write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#TrueType is optional: make NOTTF=1 to disable support and dependencies.
ifeq ($(NOTTF),1)
TTFCOPT = -DNOTTF=1
TTFLOPT =
else
TTFCOPT =
TTFLOPT = -L/usr/local/lib -lSDL_ttf
endif
# Windows specific # Windows specific
ifdef COMSPEC ifdef COMSPEC
DELCOMMAND = del DELCOMMAND = del
MKDIR = mkdir /s MKDIR = mkdir /s
BIN = grafx2.exe BIN = grafx2.exe
CFGBIN = gfxcfg.exe CFGBIN = gfxcfg.exe
COPT = -W -Wall -O -g -ggdb `sdl-config --cflags` COPT = -W -Wall -O -g -ggdb `sdl-config --cflags` $(TTFCOPT)
LOPT = `sdl-config --libs` LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT)
CC = gcc CC = gcc
OBJDIR = obj/win32 OBJDIR = obj/win32
else else
@ -39,8 +50,8 @@ else
MKDIR = mkdir -p MKDIR = mkdir -p
BIN = grafx2 BIN = grafx2
CFGBIN = gfxcfg CFGBIN = gfxcfg
COPT = -Wall -c -gstabs -mcrt=newlib `sdl-config --cflags` COPT = -Wall -c -gstabs -mcrt=newlib `sdl-config --cflags` $(TTFCOPT)
LOPT = `sdl-config --libs` -lpng -ljpeg -lz LOPT = `sdl-config --libs` -lpng -ljpeg -lz $(TTFLOPT)
CC = gcc CC = gcc
OBJDIR = obj/amiga OBJDIR = obj/amiga
else else
@ -53,14 +64,14 @@ else
CC = i586-mingw32msvc-gcc CC = i586-mingw32msvc-gcc
BIN = grafx2.exe BIN = grafx2.exe
CFGBIN = gfxcfg.exe CFGBIN = gfxcfg.exe
COPT = -W -Wall -O -g -ggdb -Dmain=SDL_main `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --cflags` COPT = -W -Wall -O -g -ggdb -Dmain=SDL_main `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --cflags` $(TTFCOPT)
LOPT = -mwindows -lmingw32 -lSDLmain -lSDL -lshlwapi `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --libs` LOPT = -mwindows -lmingw32 -lSDLmain -lSDL -lshlwapi `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --libs` $(TTFLOPT)
OBJDIR = obj/win32 OBJDIR = obj/win32
else else
BIN = grafx2 BIN = grafx2
CFGBIN = gfxcfg CFGBIN = gfxcfg
COPT = -W -Wall -c -g `sdl-config --cflags` COPT = -W -Wall -c -g `sdl-config --cflags` $(TTFCOPT)
LOPT = `sdl-config --libs` LOPT = `sdl-config --libs` $(TTFLOPT)
CC = gcc CC = gcc
OBJDIR = obj/unix OBJDIR = obj/unix
endif endif
@ -75,7 +86,7 @@ OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o \
$(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/moteur.o\ $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/moteur.o\
$(OBJDIR)/files.o $(OBJDIR)/op_c.o $(OBJDIR)/linux.o $(OBJDIR)/readini.o \ $(OBJDIR)/files.o $(OBJDIR)/op_c.o $(OBJDIR)/linux.o $(OBJDIR)/readini.o \
$(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o \ $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o \
$(OBJDIR)/version.o $(OBJDIR)/version.o $(OBJDIR)/texte.o
CFGOBJ = $(OBJDIR)/gfxcfg.o $(OBJDIR)/SFont.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o CFGOBJ = $(OBJDIR)/gfxcfg.o $(OBJDIR)/SFont.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o
all : $(BIN) $(CFGBIN) all : $(BIN) $(CFGBIN)
@ -97,7 +108,7 @@ $(BIN) : $(OBJ)
$(CC) $(OBJ) -o $(BIN) $(LOPT) $(CC) $(OBJ) -o $(BIN) $(LOPT)
$(CFGBIN) : $(CFGOBJ) $(CFGBIN) : $(CFGOBJ)
$(CC) $(CFGOBJ) -o $(CFGBIN) $(LOPT) -lSDL_image $(CC) $(CFGOBJ) -o $(CFGBIN) $(LOPT)
# SVN revision number # SVN revision number
version.c : version.c :
@ -118,7 +129,7 @@ $(OBJDIR) :
$(MKDIR) $(OBJDIR) $(MKDIR) $(OBJDIR)
depend : depend :
$(CC) -MM *.c | sed 's:^[^ ]:$(OBJDIR)/&:' > Makefile.dep $(CC) -MM *.c | sed 's:^[^ ]:$$(OBJDIR)/&:' > Makefile.dep
clean : clean :

View File

@ -3,7 +3,7 @@ $(OBJDIR)/aide.o: aide.c const.h struct.h global.h loadsave.h divers.h graph.h \
moteur.h tables_aide.h aide.h sdlscreen.h moteur.h tables_aide.h aide.h sdlscreen.h
$(OBJDIR)/boutons.o: boutons.c const.h struct.h global.h loadsave.h divers.h \ $(OBJDIR)/boutons.o: boutons.c const.h struct.h global.h loadsave.h divers.h \
graph.h moteur.h readline.h files.h init.h boutons.h operatio.h pages.h \ graph.h moteur.h readline.h files.h init.h boutons.h operatio.h pages.h \
erreurs.h readini.h saveini.h shade.h io.h aide.h sdlscreen.h erreurs.h readini.h saveini.h shade.h io.h aide.h texte.h
$(OBJDIR)/clavier.o: clavier.c global.h struct.h const.h loadsave.h $(OBJDIR)/clavier.o: clavier.c global.h struct.h const.h loadsave.h
$(OBJDIR)/divers.o: divers.c struct.h const.h sdlscreen.h global.h loadsave.h \ $(OBJDIR)/divers.o: divers.c struct.h const.h sdlscreen.h global.h loadsave.h \
graph.h erreurs.h boutons.h moteur.h divers.h clavier.h graph.h erreurs.h boutons.h moteur.h divers.h clavier.h
@ -23,13 +23,14 @@ $(OBJDIR)/main.o: main.c const.h struct.h global.h loadsave.h graph.h divers.h \
readini.h saveini.h linux.h io.h readini.h saveini.h linux.h io.h
$(OBJDIR)/moteur.o: moteur.c const.h struct.h global.h loadsave.h graph.h divers.h \ $(OBJDIR)/moteur.o: moteur.c const.h struct.h global.h loadsave.h graph.h divers.h \
special.h boutons.h operatio.h shade.h erreurs.h linux.h sdlscreen.h special.h boutons.h operatio.h shade.h erreurs.h linux.h sdlscreen.h
$(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h erreurs.h $(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h erreurs.h graph.h
$(OBJDIR)/operatio.o: operatio.c const.h struct.h global.h loadsave.h divers.h \ $(OBJDIR)/operatio.o: operatio.c const.h struct.h global.h loadsave.h divers.h \
moteur.h graph.h operatio.h boutons.h pages.h erreurs.h moteur.h graph.h operatio.h boutons.h pages.h erreurs.h
$(OBJDIR)/pages.o: pages.c global.h struct.h const.h loadsave.h pages.h graph.h \ $(OBJDIR)/pages.o: pages.c global.h struct.h const.h loadsave.h pages.h graph.h \
erreurs.h linux.h erreurs.h linux.h
$(OBJDIR)/palette.o: palette.c const.h struct.h global.h loadsave.h divers.h \ $(OBJDIR)/palette.o: palette.c const.h struct.h global.h loadsave.h divers.h \
graph.h moteur.h readline.h boutons.h pages.h aide.h sdlscreen.h graph.h moteur.h readline.h boutons.h pages.h aide.h sdlscreen.h \
erreurs.h op_c.h
$(OBJDIR)/readini.o: readini.c const.h global.h struct.h loadsave.h graph.h $(OBJDIR)/readini.o: readini.c const.h global.h struct.h loadsave.h graph.h
$(OBJDIR)/readline.o: readline.c const.h struct.h global.h loadsave.h graph.h \ $(OBJDIR)/readline.o: readline.c const.h struct.h global.h loadsave.h graph.h \
divers.h erreurs.h linux.h sdlscreen.h divers.h erreurs.h linux.h sdlscreen.h
@ -41,4 +42,5 @@ $(OBJDIR)/shade.o: shade.c global.h struct.h const.h loadsave.h graph.h moteur.h
divers.h readline.h aide.h sdlscreen.h divers.h readline.h aide.h sdlscreen.h
$(OBJDIR)/special.o: special.c const.h struct.h global.h loadsave.h graph.h \ $(OBJDIR)/special.o: special.c const.h struct.h global.h loadsave.h graph.h \
moteur.h moteur.h
$(OBJDIR)/texte.o: texte.c SFont.h sdlscreen.h struct.h const.h global.h loadsave.h
$(OBJDIR)/version.o: version.c $(OBJDIR)/version.o: version.c

162
boutons.c
View File

@ -46,7 +46,7 @@
#include "shade.h" #include "shade.h"
#include "io.h" #include "io.h"
#include "aide.h" #include "aide.h"
#include "sdlscreen.h" #include "texte.h"
#ifdef __WATCOMC__ #ifdef __WATCOMC__
#include <windows.h> #include <windows.h>
@ -5707,7 +5707,167 @@ void Bouton_Effets(void)
Afficher_curseur(); Afficher_curseur();
} }
void Bouton_Texte()
{
static char Chaine[256]="";
static int Taille_police=16;
static int AntiAlias=0;
byte * Nouvelle_Brosse;
int Nouvelle_Largeur;
int Nouvelle_Hauteur;
int Bouton_clicke;
const int NB_FONTES=8;
char Buffer_taille[3];
struct Fenetre_Bouton_special * Bouton_taille_texte;
struct Fenetre_Bouton_special * Bouton_texte;
byte A_redessiner=1;
Ouvrir_fenetre(288,180,"Text");
// Texte saisi
Print_dans_fenetre(6,19,"Txt:",CM_Fonce,CM_Clair);
Fenetre_Definir_bouton_saisie(41,18,30); // 1
Bouton_texte=Fenetre_Liste_boutons_special;
// Bouton 'Clear Text'
Fenetre_Definir_bouton_normal(9,33,80,14,"Clear Txt",0,1,SDLK_LAST); // 2
// AA
Fenetre_Definir_bouton_normal(9,51,80,14,"",0,1,SDLK_LAST); // 3
Print_dans_fenetre(13,53,AntiAlias?"AntiAlias":" No AA ", CM_Noir, CM_Clair);
// Scroller des fontes
Fenetre_Definir_bouton_scroller(94,33,NB_FONTES*8,12,1,0); // 4
// Liste des fontes disponibles
Fenetre_Definir_bouton_special(110,32,172,NB_FONTES*8); // 5
Fenetre_Afficher_cadre_creux(109, 31, 174, NB_FONTES*8+4);
// Taille texte
Print_dans_fenetre(32,71,"Size:",CM_Fonce,CM_Clair);
Fenetre_Definir_bouton_saisie(35,84,3); // 6
Bouton_taille_texte=Fenetre_Liste_boutons_special;
Fenetre_Definir_bouton_normal(18,84,14,11,"-",0,1,SDLK_LAST); // 7
Fenetre_Definir_bouton_normal(64,84,14,11,"+",0,1,SDLK_LAST); // 8
// Preview
Fenetre_Definir_bouton_special(7,105,276,50); // 9
Fenetre_Afficher_cadre_creux(6, 104, 278, 52);
Fenetre_Definir_bouton_special(110,32,172,NB_FONTES*8); // 10
Fenetre_Definir_bouton_normal(7,161,40,14,"OK",0,1,SDLK_RETURN); // 11
Fenetre_Definir_bouton_normal(53,161,60,14,"Cancel",0,1,SDLK_ESCAPE); // 12
Display_Window(288,180);
// Redessin
// Chaine texte
Fenetre_Contenu_bouton_saisie(Bouton_texte,Chaine);
// Taille police
A_redessiner=1;
// --
while (1)
{
if (A_redessiner)
{
Num2str(Taille_police,Buffer_taille,3);
Fenetre_Contenu_bouton_saisie(Bouton_taille_texte,Buffer_taille);
A_redessiner=0;
Afficher_curseur();
}
Bouton_clicke=Fenetre_Bouton_clicke();
switch(Bouton_clicke)
{
case 1: // Texte saisi
Effacer_curseur();
Readline(43,20,Chaine,30,0);
Afficher_curseur();
break;
case 2: // Clear
Chaine[0]='\0';
Effacer_curseur();
Fenetre_Contenu_bouton_saisie(Bouton_texte,Chaine);
Afficher_curseur();
break;
case 3: // AA
AntiAlias = (AntiAlias==0);
Effacer_curseur();
Print_dans_fenetre(13,53,AntiAlias?"AntiAlias":" No AA ", CM_Noir, CM_Clair);
Afficher_curseur();
break;
case 6: // Taille du texte (nombre)
Effacer_curseur();
Readline(37,86,Buffer_taille,3,1);
Taille_police=atoi(Buffer_taille);
// On corrige les dimensions
if (Taille_police < 1)
{
Taille_police = 1;
}
else if (Taille_police>500)
{
Taille_police = 500;
}
A_redessiner=1;
break;
case 7: // Taille -
if (Taille_police > 0)
{
Taille_police--;
Effacer_curseur();
A_redessiner=1;
}
break;
case 8: // Taille +
if (Taille_police < 255)
{
Taille_police++;
Effacer_curseur();
A_redessiner=1;
}
break;
case 11: // OK
// Rendu texte
Nouvelle_Brosse = Rendu_Texte(Chaine, Taille_police, AntiAlias, &Nouvelle_Largeur, &Nouvelle_Hauteur);
if (!Nouvelle_Brosse)
{
Fermer_fenetre();
Desenclencher_bouton(BOUTON_TEXTE);
Afficher_curseur();
Erreur(0);
return;
}
Effacer_curseur();
// On passe en brosse monochrome:
Changer_la_forme_du_pinceau(FORME_PINCEAU_BROSSE_COULEUR);
if (Brosse) free(Brosse);
Brosse=Nouvelle_Brosse;
Brosse_Largeur=Nouvelle_Largeur;
Brosse_Hauteur=Nouvelle_Hauteur;
Brosse_Decalage_X=Brosse_Largeur>>1;
Brosse_Decalage_Y=Brosse_Hauteur>>1;
// Attention pas de break
case 12: // Cancel
Fermer_fenetre();
Desenclencher_bouton(BOUTON_TEXTE);
Afficher_curseur();
return;
}
}
}

View File

@ -61,6 +61,9 @@ void Bouton_Courbes_Switch_mode(void);
void Bouton_Rectangle_vide(void); void Bouton_Rectangle_vide(void);
void Bouton_Rectangle_plein(void); void Bouton_Rectangle_plein(void);
// Boutons relatifs au texte
void Bouton_Texte(void);
// Boutons relatifs aux dégradés // Boutons relatifs aux dégradés
void Bouton_Degrades(void); void Bouton_Degrades(void);
void Degrade_Charger_infos_du_tableau(int Indice); void Degrade_Charger_infos_du_tableau(int Indice);

BIN
fonts/Tuffy.ttf Normal file

Binary file not shown.

BIN
gfx2.cfg

Binary file not shown.

2
init.c
View File

@ -735,7 +735,7 @@ void Initialisation_des_boutons(void)
123,18, 123,18,
16,16, 16,16,
FORME_BOUTON_RECTANGLE, FORME_BOUTON_RECTANGLE,
Message_Non_disponible,Message_Non_disponible, Bouton_Texte,Message_Non_disponible,
Rien_du_tout, Rien_du_tout,
FAMILLE_INSTANTANE); FAMILLE_INSTANTANE);
/* /*

3
main.c
View File

@ -345,6 +345,9 @@ void Initialisation_du_programme(int argc,char * argv[])
SDL_EnableUNICODE(SDL_ENABLE); SDL_EnableUNICODE(SDL_ENABLE);
SDL_WM_SetCaption("GrafX2 beta "POURCENTAGE_VERSION" - USE AT YOUR OWN RISK","grafx2.gif"); SDL_WM_SetCaption("GrafX2 beta "POURCENTAGE_VERSION" - USE AT YOUR OWN RISK","grafx2.gif");
// Texte
Initialisation_Texte();
// On initialise tous les modes vidéo // On initialise tous les modes vidéo
Definition_des_modes_video(); Definition_des_modes_video();

View File

@ -559,4 +559,50 @@ void UpdateRect(short X, short Y, unsigned short Largeur, unsigned short Hauteur
#if (METHODE_UPDATE == METHODE_UPDATE_PLEINE_PAGE) #if (METHODE_UPDATE == METHODE_UPDATE_PLEINE_PAGE)
Update_necessaire=1; Update_necessaire=1;
#endif #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;
} }

View File

@ -52,6 +52,7 @@
void UpdateRect(short X, short Y, unsigned short Largeur, unsigned short Hauteur); void UpdateRect(short X, short Y, unsigned short Largeur, unsigned short Hauteur);
void Flush_update(void); void Flush_update(void);
byte * Surface_en_bytefield(SDL_Surface *Source, byte * Destination);
SDL_Color Conversion_couleur_SDL(byte);
#endif // SDLSCREEN_H_INCLUDED #endif // SDLSCREEN_H_INCLUDED

139
texte.c Normal file
View File

@ -0,0 +1,139 @@
/* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2008 Yves Rizoud
Copyright 2008 Adrien Destugues
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
Grafx2 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2
of the License.
Grafx2 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grafx2; if not, see <http://www.gnu.org/licenses/> or
write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Pour désactiver le support TrueType, définir NOTTF
// To disable TrueType support, define NOTTF
// TrueType
#ifndef NOTTF
#include <SDL/SDL_ttf.h>
#endif
// SFont
#include <SDL/SDL_image.h>
#include "SFont.h"
#include "sdlscreen.h"
#include "struct.h"
#include "global.h"
void Initialisation_Texte(void)
{
#ifndef NOTTF
TTF_Init();
#endif
}
#ifndef NOTTF
byte *Rendu_Texte_TTF(const char *Chaine, int Taille, int AntiAlias, int *Largeur, int *Hauteur)
{
TTF_Font *Police;
SDL_Surface * TexteColore;
SDL_Surface * Texte8Bit;
byte * BrosseRetour;
int Indice;
SDL_Color PaletteSDL[256];
SDL_Color Couleur_Avant; // FIXME couleur avant
SDL_Color Couleur_Arriere; // FIXME couleur arriere
// Chargement de la police
Police=TTF_OpenFont("fonts/Tuffy.ttf", Taille); // FIXME police en dur
if (!Police)
{
return NULL;
}
// Couleurs
Couleur_Avant = Conversion_couleur_SDL(Fore_color);
Couleur_Arriere = Conversion_couleur_SDL(Back_color);
// Rendu du texte: crée une surface SDL RGB 24bits
if (AntiAlias)
TexteColore=TTF_RenderText_Shaded(Police, Chaine, Couleur_Avant, Couleur_Arriere );
else
TexteColore=TTF_RenderText_Solid(Police, Chaine, Couleur_Avant);
if (!TexteColore)
{
TTF_CloseFont(Police);
return NULL;
}
Texte8Bit=SDL_DisplayFormat(TexteColore);
/*
Texte8Bit=SDL_CreateRGBSurface(SDL_SWSURFACE, TexteColore->w, TexteColore->h, 8, 0, 0, 0, 0);
if (!Texte8Bit)
{
SDL_FreeSurface(TexteColore);
TTF_CloseFont(Police);
return NULL;
}
for(Indice=0;Indice<256;Indice++)
{
PaletteSDL[Indice].r=(Principal_Palette[Indice].R<<2) + (Principal_Palette[Indice].R>>4); //Les couleurs VGA ne vont que de 0 à 63
PaletteSDL[Indice].g=(Principal_Palette[Indice].V<<2) + (Principal_Palette[Indice].V>>4);
PaletteSDL[Indice].b=(Principal_Palette[Indice].B<<2) + (Principal_Palette[Indice].B>>4);
}
SDL_SetPalette(Texte8Bit,SDL_PHYSPAL|SDL_LOGPAL,PaletteSDL,0,256);
SDL_BlitSurface(TexteColore, NULL, Texte8Bit, NULL);
*/
SDL_FreeSurface(TexteColore);
BrosseRetour=Surface_en_bytefield(Texte8Bit, NULL);
if (!BrosseRetour)
{
SDL_FreeSurface(TexteColore);
SDL_FreeSurface(Texte8Bit);
TTF_CloseFont(Police);
return NULL;
}
if (!AntiAlias)
{
// Mappage des couleurs
/*for (Indice=0; Indice < Texte8Bit->w * Texte8Bit->h; Indice++)
{
if ()
*(BrosseRetour+Indice)=*(BrosseRetour+Indice) ? (*(BrosseRetour+Indice)+96-15) : 0;
}*/
}
*Largeur=Texte8Bit->w;
*Hauteur=Texte8Bit->h;
SDL_FreeSurface(Texte8Bit);
return BrosseRetour;
}
#endif
byte *Rendu_Texte(const char *Chaine, int Taille, int AntiAlias, int *Largeur, int *Hauteur)
{
#ifndef NOTTF
return Rendu_Texte_TTF(Chaine, Taille, AntiAlias, Largeur, Hauteur);
#else
return NULL;
#endif
}

26
texte.h Normal file
View File

@ -0,0 +1,26 @@
/* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2008 Yves Rizoud
Copyright 2008 Adrien Destugues
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
Grafx2 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2
of the License.
Grafx2 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grafx2; if not, see <http://www.gnu.org/licenses/> or
write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
void Initialisation_Texte(void);
byte *Rendu_Texte(const char *Chaine, int Taille, int AntiAlias, int *Largeur, int *Hauteur);