Splitted graph.c in multiple files. Compiles but there is a lot of warnings about declarations. I'm cleaning it up but i wanted to commit that before starting to get conflicts

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@395 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2008-12-16 22:02:22 +00:00
parent 78df30d844
commit c004c90d90
16 changed files with 4696 additions and 4557 deletions

View File

@ -133,7 +133,7 @@ endif
.PHONY : all debug release clean depend zip version force install uninstall
OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o $(OBJDIR)/divers.o $(OBJDIR)/special.o $(OBJDIR)/boutons.o $(OBJDIR)/palette.o $(OBJDIR)/aide.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/moteur.o $(OBJDIR)/files.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/texte.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o
OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o $(OBJDIR)/divers.o $(OBJDIR)/special.o $(OBJDIR)/boutons.o $(OBJDIR)/palette.o $(OBJDIR)/aide.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/moteur.o $(OBJDIR)/files.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/texte.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o
CFGOBJ = $(OBJDIR)/gfxcfg.o $(OBJDIR)/SFont.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o $(OBJDIR)/setup.o
all : $(BIN) $(CFGBIN)

View File

@ -3,7 +3,8 @@ $(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 texte.h clavier.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 \
erreurs.h readini.h saveini.h shade.h io.h aide.h texte.h sdlscreen.h
erreurs.h readini.h saveini.h shade.h io.h aide.h texte.h sdlscreen.h windows.h brush.h
$(OBJDIR)/brush.o: brush.c brush.h erreurs.h windows.h sdlscreen.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 \
graph.h erreurs.h boutons.h moteur.h divers.h clavier.h
@ -13,16 +14,16 @@ $(OBJDIR)/gfxcfg.o: gfxcfg.c SFont.h struct.h const.h clavier.h io.h hotkeys.h \
setup.h
$(OBJDIR)/graph.o: graph.c global.h struct.h const.h loadsave.h moteur.h boutons.h \
pages.h erreurs.h sdlscreen.h graph.h divers.h pxsimple.h pxtall.h \
pxwide.h
pxwide.h windows.h
$(OBJDIR)/init.o: init.c const.h struct.h global.h loadsave.h graph.h boutons.h \
palette.h aide.h operatio.h divers.h erreurs.h clavier.h io.h hotkeys.h \
files.h setup.h
files.h setup.h windows.h
$(OBJDIR)/io.o: io.c struct.h const.h io.h
$(OBJDIR)/loadsave.o: loadsave.c const.h struct.h global.h loadsave.h graph.h \
divers.h pages.h op_c.h boutons.h erreurs.h io.h sdlscreen.h
$(OBJDIR)/main.o: main.c const.h struct.h global.h loadsave.h graph.h divers.h \
init.h boutons.h moteur.h pages.h files.h sdlscreen.h erreurs.h \
readini.h saveini.h io.h texte.h setup.h
readini.h saveini.h io.h texte.h setup.h windows.h brush.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 sdlscreen.h
$(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h erreurs.h graph.h
@ -39,18 +40,19 @@ $(OBJDIR)/pxtall.o: pxtall.c global.h struct.h const.h loadsave.h sdlscreen.h \
divers.h pxsimple.h
$(OBJDIR)/pxwide.o: pxwide.c global.h struct.h const.h loadsave.h sdlscreen.h \
divers.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 divers.h
$(OBJDIR)/readline.o: readline.c const.h struct.h global.h loadsave.h graph.h \
divers.h erreurs.h sdlscreen.h readline.h
$(OBJDIR)/saveini.o: saveini.c const.h global.h struct.h loadsave.h readini.h io.h \
erreurs.h graph.h
erreurs.h graph.h divers.h
$(OBJDIR)/sdlscreen.o: sdlscreen.c global.h struct.h const.h loadsave.h sdlscreen.h \
erreurs.h graph.h
$(OBJDIR)/setup.o: setup.c struct.h const.h io.h files.h
$(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 windows.h
$(OBJDIR)/special.o: special.c const.h struct.h global.h loadsave.h graph.h \
moteur.h
$(OBJDIR)/texte.o: texte.c SFont.h struct.h const.h global.h loadsave.h sdlscreen.h \
io.h files.h
$(OBJDIR)/version.o: version.c
$(OBJDIR)/windows.o: windows.c windows.h graph.h moteur.h divers.h struct.h sdlscreen.h

View File

@ -48,6 +48,8 @@
#include "aide.h"
#include "texte.h"
#include "sdlscreen.h"
#include "windows.h"
#include "brush.h"
#ifdef __WATCOMC__
#include <windows.h>

1764
brush.c Normal file

File diff suppressed because it is too large Load Diff

38
brush.h Normal file
View File

@ -0,0 +1,38 @@
/* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2007-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.
*/
#ifndef __BRUSHH__
#define __BRUSHH__
void Capturer_brosse(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y,short Effacement);
void Rotate_90_deg(void);
void Etirer_brosse(short X1, short Y1, short X2, short Y2);
void Etirer_brosse_preview(short X1, short Y1, short X2, short Y2);
void Tourner_brosse(float Angle);
void Tourner_brosse_preview(float Angle);
void Remap_brosse(void);
void Get_colors_from_brush(void);
void Outline_brush(void);
void Nibble_brush(void);
void Capturer_brosse_au_lasso(int Vertices, short * Points,short Effacement);
#endif

198
divers.c
View File

@ -140,7 +140,7 @@ void Effacer_image_courante(byte Couleur)
void Sensibilite_souris(__attribute__((unused)) word X,__attribute__((unused)) word Y)
{
}
int Get_input(void)
@ -201,10 +201,10 @@ int Get_input(void)
//Appui sur une touche du clavier
Touche = Conversion_Touche(event.key.keysym);
Touche_ANSI = Conversion_ANSI(event.key.keysym);
//Cas particulier: déplacement du curseur avec haut bas gauche droite
//On doit interpréter ça comme un mvt de la souris
if(Touche == Config_Touche[0])
{
//[Touche] = Emulation de MOUSE UP
@ -358,7 +358,7 @@ int Get_input(void)
Afficher_curseur();
}
// Vidage de toute mise à jour de l'affichage à l'écran qui serait encore en attente.
// Vidage de toute mise à jour de l'affichage à l'écran qui serait encore en attente.
// (c'est fait ici car on est sur que cette fonction est apellée partout ou on a besoin d'interragir avec l'utilisateur)
Flush_update();
return 1; // Il y a des choses à faire
@ -379,7 +379,7 @@ void Wait_VBL(void)
// sans charger inutilement le CPU par du busy-wait (on n'est pas à 10ms près)
{
const int Delai = 10;
Uint32 debut;
debut = SDL_GetTicks();
// Première attente : le complément de "Delai" millisecondes
@ -389,7 +389,7 @@ void Wait_VBL(void)
while (SDL_GetTicks() / Delai <= debut / Delai)
{
SDL_Delay(1);
}
}
}
void Pixel_dans_brosse (word X,word Y,byte Couleur)
@ -417,7 +417,7 @@ void Pixel_dans_ecran_courant (word X,word Y,byte Couleur)
void Remplacer_une_couleur(byte Ancienne_couleur, byte Nouvelle_couleur)
{
byte* edi;
// pour chaque pixel :
for(edi = Principal_Ecran;edi < Principal_Ecran + Principal_Hauteur_image * Principal_Largeur_image;edi++)
if (*edi == Ancienne_couleur)
@ -428,25 +428,25 @@ void Remplacer_une_couleur(byte Ancienne_couleur, byte Nouvelle_couleur)
void Ellipse_Calculer_limites(short Rayon_horizontal,short Rayon_vertical)
{
Ellipse_Rayon_horizontal_au_carre =
Ellipse_Rayon_horizontal_au_carre =
Rayon_horizontal * Rayon_horizontal;
Ellipse_Rayon_vertical_au_carre =
Ellipse_Rayon_vertical_au_carre =
Rayon_vertical * Rayon_vertical;
Ellipse_Limite = Ellipse_Rayon_horizontal_au_carre * Ellipse_Rayon_vertical_au_carre;
}
byte Pixel_dans_ellipse(void)
{
uint64_t ediesi = Ellipse_Curseur_X * Ellipse_Curseur_X * Ellipse_Rayon_vertical_au_carre +
uint64_t ediesi = Ellipse_Curseur_X * Ellipse_Curseur_X * Ellipse_Rayon_vertical_au_carre +
Ellipse_Curseur_Y * Ellipse_Curseur_Y * Ellipse_Rayon_horizontal_au_carre;
if((ediesi) <= Ellipse_Limite) return 255;
return 0;
}
byte Pixel_dans_cercle(void)
{
if(Cercle_Curseur_X * Cercle_Curseur_X +
if(Cercle_Curseur_X * Cercle_Curseur_X +
Cercle_Curseur_Y * Cercle_Curseur_Y <= Cercle_Limite)
return 255;
return 0;
@ -471,7 +471,7 @@ void Copier_une_partie_d_image_dans_une_autre(byte * Source,word S_Pos_X,word S_
esi+=Largeur_source;
edi+=Largeur_destination;
}
}
@ -492,7 +492,7 @@ void Rotate_90_deg_LOWLEVEL(byte * Source,byte * Destination)
// Largeur de la source = Hauteur de la destination
dx = bx = Brosse_Largeur;
// Pour chaque ligne
for(dx = Brosse_Largeur;dx>0;dx--)
{
@ -590,7 +590,7 @@ void Remplacer_toutes_les_couleurs_dans_limites(byte * Table_de_remplacement)
*Adresse = Table_de_remplacement[Ancien];
}
}
}
}
byte Lit_pixel_dans_ecran_backup (word X,word Y)
{
@ -649,7 +649,7 @@ byte Effet_Colorize_interpole (word X,word Y,byte Couleur)
// (Couleur_dessous*Facteur_A+Couleur*facteur_B)/256
//
// On place dans ESI 3*Couleur_dessous ( = position de cette couleur dans la
// On place dans ESI 3*Couleur_dessous ( = position de cette couleur dans la
// palette des teintes) et dans EDI, 3*Couleur.
byte Bleu_dessous=Principal_Palette[*(FX_Feedback_Ecran + Y * Principal_Largeur_image + X)].B;
byte Bleu=Principal_Palette[Couleur].B;
@ -657,15 +657,15 @@ byte Effet_Colorize_interpole (word X,word Y,byte Couleur)
byte Vert=Principal_Palette[Couleur].V;
byte Rouge_dessous=Principal_Palette[*(FX_Feedback_Ecran + Y * Principal_Largeur_image + X)].R;
byte Rouge=Principal_Palette[Couleur].R;
// On récupère les 3 composantes RVB
// Bleu
Bleu = (Table_de_multiplication_par_Facteur_B[Bleu]
Bleu = (Table_de_multiplication_par_Facteur_B[Bleu]
+ Table_de_multiplication_par_Facteur_A[Bleu_dessous]) / 256;
Vert = (Table_de_multiplication_par_Facteur_B[Vert]
Vert = (Table_de_multiplication_par_Facteur_B[Vert]
+ Table_de_multiplication_par_Facteur_A[Vert_dessous]) / 256;
Rouge = (Table_de_multiplication_par_Facteur_B[Rouge]
Rouge = (Table_de_multiplication_par_Facteur_B[Rouge]
+ Table_de_multiplication_par_Facteur_A[Rouge_dessous]) / 256;
return Meilleure_couleur(Rouge,Vert,Bleu);
@ -679,7 +679,7 @@ byte Effet_Colorize_additif (word X,word Y,byte Couleur)
byte Bleu=Principal_Palette[Couleur].B;
byte Vert=Principal_Palette[Couleur].V;
byte Rouge=Principal_Palette[Couleur].R;
return Meilleure_couleur(
Rouge>Rouge_dessous?Rouge:Rouge_dessous,
Vert>Vert_dessous?Vert:Vert_dessous,
@ -694,7 +694,7 @@ byte Effet_Colorize_soustractif(word X,word Y,byte Couleur)
byte Bleu=Principal_Palette[Couleur].B;
byte Vert=Principal_Palette[Couleur].V;
byte Rouge=Principal_Palette[Couleur].R;
return Meilleure_couleur(
Rouge<Rouge_dessous?Rouge:Rouge_dessous,
Vert<Vert_dessous?Vert:Vert_dessous,
@ -797,7 +797,7 @@ void Rotate_180_deg_LOWLEVEL(void)
tmp = *ESI;
*ESI = *EDI;
*EDI = tmp;
EDI--; // Attention ici on recule !
ESI++;
}
@ -820,7 +820,7 @@ void Scroll_picture(short Decalage_X,short Decalage_Y)
byte* edi = Principal_Ecran + Decalage_Y * Principal_Largeur_image + Decalage_X;
const word ax = Principal_Largeur_image - Decalage_X; // Nombre de pixels à copier à droite
word dx;
for(dx = Principal_Hauteur_image - Decalage_Y;dx>0;dx--)
for(dx = Principal_Hauteur_image - Decalage_Y;dx>0;dx--)
{
// Pour chaque ligne
memcpy(edi,esi,ax);
@ -863,7 +863,7 @@ word Get_key(void)
}
}
void Zoomer_une_ligne(byte* Ligne_originale, byte* Ligne_zoomee,
void Zoomer_une_ligne(byte* Ligne_originale, byte* Ligne_zoomee,
word Facteur, word Largeur
)
{
@ -880,3 +880,151 @@ void Zoomer_une_ligne(byte* Ligne_originale, byte* Ligne_zoomee,
Ligne_originale++;
}
}
/*############################################################################*/
#if defined(__WIN32__)
#define _WIN32_WINNT 0x0500
#include <windows.h>
#elif defined(__macosx__)
#include <sys/sysctl.h>
#elif defined(__BEOS__) || defined(__HAIKU__)
// sysinfo not implemented
#else
#include <sys/sysinfo.h> // sysinfo() for free RAM
#endif
// Indique quelle est la mémoire disponible
unsigned long Memoire_libre(void)
{
// On appelle la fonction qui optimise la mémoire libre afin d'en
// regagner un maximum. Sinon, tous les "free" libèrent une mémoire qui
// n'est pas prise en compte par la fonction, et on se retrouve avec un
// manque alarmant de mémoire.
/*
A revoir, mais est-ce vraiment utile?
_heapmin();
*/
// Memory is no longer relevant. If there is ANY problem or doubt here,
// you can simply return 10*1024*1024 (10Mb), to make the "Pages"something
// memory allocation functions happy.
#if defined(__WIN32__)
MEMORYSTATUSEX mstt;
mstt.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&mstt);
return mstt.ullAvailPhys;
#elif defined(__macosx__)
int mib[2];
int maxmem;
size_t len;
mib[0] = CTL_HW;
mib[1] = HW_USERMEM;
len = sizeof(maxmem);
sysctl(mib,2,&maxmem,&len,NULL,0);
return maxmem;
#elif defined(__BEOS__) || defined(__HAIKU__)
// No <sys/sysctl.h> on BeOS or Haiku
return 10*1024*1024;
#else
struct sysinfo info;
sysinfo(&info);
return info.freeram*info.mem_unit;
#endif
}
// Transformer un nombre (entier naturel) en chaîne
void Num2str(dword Nombre,char * Chaine,byte Taille)
{
int Indice;
for (Indice=Taille-1;Indice>=0;Indice--)
{
Chaine[Indice]=(Nombre%10)+'0';
Nombre/=10;
if (Nombre==0)
for (Indice--;Indice>=0;Indice--)
Chaine[Indice]=' ';
}
Chaine[Taille]='\0';
}
// Transformer une chaîne en un entier naturel (renvoie -1 si ch. invalide)
int Str2num(char * Chaine)
{
int Valeur=0;
for (;*Chaine;Chaine++)
{
if ( (*Chaine>='0') && (*Chaine<='9') )
Valeur=(Valeur*10)+(*Chaine-'0');
else
return -1;
}
return Valeur;
}
// Arrondir un nombre réel à la valeur entière la plus proche
short Round(float Valeur)
{
short Temp=Valeur;
if (Valeur>=0)
{ if ((Valeur-Temp)>= 0.5) Temp++; }
else
{ if ((Valeur-Temp)<=-0.5) Temp--; }
return Temp;
}
// Arrondir le résultat d'une division à la valeur entière supérieure
short Round_div_max(short Numerateur,short Diviseur)
{
if (!(Numerateur % Diviseur))
return (Numerateur/Diviseur);
else
return (Numerateur/Diviseur)+1;
}
// Retourne le minimum entre deux nombres
int Min(int A,int B)
{
return (A<B)?A:B;
}
// Retourne le maximum entre deux nombres
int Max(int A,int B)
{
return (A>B)?A:B;
}
// Fonction retournant le libellé d'une mode (ex: " 320x200")
char * Libelle_mode(int Mode)
{
static char Chaine[24];
if (! Mode_video[Mode].Fullscreen)
return "window";
sprintf(Chaine, "%dx%d", Mode_video[Mode].Largeur, Mode_video[Mode].Hauteur);
return Chaine;
}
// Trouve un mode video à partir d'une chaine: soit "window",
// soit de la forme "320x200"
// Renvoie -1 si la chaine n'est pas convertible
int Conversion_argument_mode(const char *Argument)
{
// Je suis paresseux alors je vais juste tester les libellés
int Indice_mode;
for (Indice_mode=0; Indice_mode<Nb_modes_video; Indice_mode++)
// Attention les vieilles fonctions de lecture .ini mettent tout en MAJUSCULE.
if (!strcasecmp(Libelle_mode(Indice_mode), Argument))
return Indice_mode;
return -1;
}

View File

@ -104,3 +104,19 @@ byte Etat_chrono; // Etat du chrono: 0=Attente d'un X
dword Chrono_delay; // Nombre de 18.2ème de secondes demandés
dword Chrono_cmp; // Heure de départ du chrono
byte Nouvelle_preview; // Booléen "Il faut relancer le chrono de preview"
unsigned long Memoire_libre(void);
void Num2str(dword Nombre,char * Chaine,byte Taille);
int Str2num(char * Chaine);
short Round(float Valeur);
short Round_max(short Numerateur,short Diviseur);
short Round_div_max(short Numerateur,short Diviseur);
int Min(int A,int B);
int Max(int A,int B);
char* Libelle_mode(int Mode);
int Conversion_argument_mode(const char *Argument);

4674
graph.c

File diff suppressed because it is too large Load Diff

85
graph.h
View File

@ -1,6 +1,6 @@
/* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2007 Adrien Destugues
Copyright 2007-2008 Adrien Destugues
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
Grafx2 is free software; you can redistribute it and/or
@ -18,54 +18,15 @@
write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
void Remapper_ecran_apres_changement_couleurs_menu(void);
void Calculer_couleurs_menu_optimales(struct Composantes * Palette);
unsigned long Memoire_libre(void);
void Liste2tables(word * Liste, short Pas, byte Mode, byte * Table_inc,
byte * Table_dec
);
void Num2str(dword Nombre,char * Chaine,byte Taille);
int Str2num(char * Chaine);
short Round(float Valeur);
short Round_max(short Numerateur,short Diviseur);
short Round_div_max(short Numerateur,short Diviseur);
int Min(int A,int B);
int Max(int A,int B);
void Transformer_point(short X, short Y,
float cosA, float sinA, short * Xr, short * Yr);
void Recadrer_ecran_par_rapport_au_zoom(void);
void Calculer_split(void);
void Calculer_donnees_loupe(void);
void Calculer_limites(void);
void Calculer_coordonnees_pinceau(void);
char* Libelle_mode(int Mode);
int Conversion_argument_mode(const char *Argument);
void Initialiser_mode_video(int Largeur, int Hauteur, int Fullscreen);
void Pixel_dans_barre_d_outil(word X,word Y,byte Couleur);
void Pixel_dans_fenetre(word X,word Y,byte Couleur);
void Encadrer_couleur_menu(byte Couleur);
void Afficher_palette_du_menu(void);
void Afficher_menu(void);
void Recadrer_palette(void);
void Print_general(short X,short Y,char * Chaine,byte Couleur_texte,byte Couleur_fond);
void Print_dans_fenetre(short X,short Y,char * Chaine,byte Couleur_texte,byte Couleur_fond);
void Print_dans_fenetre_limite(short X,short Y,char * Chaine,byte Taille,byte Couleur_texte,byte Couleur_fond);
void Print_char_dans_fenetre(short Pos_X,short Pos_Y,unsigned char Caractere,byte Couleur_texte,byte Couleur_fond);
void Print_char_transparent_dans_fenetre(short Pos_X,short Pos_Y,unsigned char Caractere,byte Couleur);
void Print_dans_menu(char * Chaine, short Position);
void Print_coordonnees(void);
void Print_nom_fichier(void);
void Print_compteur(short X,short Y,char * Chaine,byte Couleur_texte,byte Couleur_fond);
byte Aucun_effet(word X,word Y,byte Couleur);
byte Effet_Shade(word X,word Y,byte Couleur);
@ -83,45 +44,14 @@ void Effacer_pinceau(short X,short Y);
void Effacer_curseur(void);
void Afficher_curseur(void);
byte Demande_de_confirmation(char * Message);
void Warning_message(char * Message);
void Afficher_limites_de_l_image(void);
void Afficher_ecran(void);
void Fenetre_Afficher_cadre_general(word Pos_X,word Pos_Y,word Largeur,word Hauteur,
byte Couleur_HG,byte Couleur_BD,byte Couleur_S,byte Couleur_CHG,byte Couleur_CBD);
void Fenetre_Afficher_cadre_mono(word Pos_X,word Pos_Y,word Largeur,word Hauteur,byte Couleur);
void Fenetre_Afficher_cadre_creux(word Pos_X,word Pos_Y,word Largeur,word Hauteur);
void Fenetre_Afficher_cadre_bombe(word Pos_X,word Pos_Y,word Largeur,word Hauteur);
void Fenetre_Afficher_cadre(word Pos_X,word Pos_Y,word Largeur,word Hauteur);
void Afficher_sprite_dans_menu(int Numero_bouton,int Numero_sprite);
void Afficher_pinceau_dans_menu(void);
void Afficher_pinceau_dans_fenetre(word X,word Y,int Numero);
void Dessiner_zigouigoui(word X,word Y, byte Couleur, short Sens);
void Bloc_degrade_dans_fenetre(word Pos_X,word Pos_Y,word Debut_block,word Fin_block);
void Redimentionner_image(word Largeur_choisie,word Hauteur_choisie);
void Fenetre_Afficher_sprite_drive(word Pos_X,word Pos_Y,byte Type);
void Capturer_brosse(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y,short Effacement);
void Rotate_90_deg(void);
void Etirer_brosse(short X1, short Y1, short X2, short Y2);
void Etirer_brosse_preview(short X1, short Y1, short X2, short Y2);
void Tourner_brosse(float Angle);
void Tourner_brosse_preview(float Angle);
void Remap_brosse(void);
void Get_colors_from_brush(void);
void Outline_brush(void);
void Nibble_brush(void);
void Remplir(byte Couleur_de_remplissage);
void Remplacer(byte Nouvelle_couleur);
void Pixel_figure_Preview (word Pos_X,word Pos_Y,byte Couleur);
void Pixel_figure_Preview_xor(word Pos_X,word Pos_Y,byte Couleur);
void Pixel_figure_Dans_brosse(word Pos_X,word Pos_Y,byte Couleur);
void Tracer_cercle_vide_Definitif(short Centre_X,short Centre_Y,short Rayon,byte Couleur);
void Tracer_cercle_vide_Preview (short Centre_X,short Centre_Y,short Rayon,byte Couleur);
@ -134,6 +64,7 @@ void Effacer_ellipse_vide_Preview (short Centre_X,short Centre_Y,short Rayon_hor
void Tracer_ellipse_pleine (short Centre_X,short Centre_Y,short Rayon_horizontal,short Rayon_vertical,byte Couleur);
void Rectifier_coordonnees_a_45_degres(short AX, short AY, short* BX, short* BY);
void Tracer_ligne_General(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y, byte Couleur);
void Tracer_ligne_Definitif (short Debut_X,short Debut_Y,short Fin_X,short Fin_Y,byte Couleur);
void Tracer_ligne_Preview (short Debut_X,short Debut_Y,short Fin_X,short Fin_Y,byte Couleur);
void Tracer_ligne_Preview_xor(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y,byte Couleur);
@ -157,8 +88,8 @@ void Tracer_cercle_degrade (short Centre_X,short Centre_Y,short Rayon,short Ecl
void Tracer_ellipse_degradee(short Centre_X,short Centre_Y,short Rayon_horizontal,short Rayon_vertical,short Eclairage_X,short Eclairage_Y);
void Tracer_rectangle_degrade(short RAX,short RAY,short RBX,short RBY,short VAX,short VAY, short VBX, short VBY);
void Polyfill_General(int Vertices, short * Points, int Color);
void Polyfill(int Vertices, short * Points, int Color);
void Capturer_brosse_au_lasso(int Vertices, short * Points,short Effacement);
// Gestion des backups:
void Download_infos_page_principal(S_Page * Page);
@ -182,8 +113,6 @@ void Remap_picture(void);
#define ToWinL(l) ((l)*Menu_Facteur_X)
#define ToWinH(h) ((h)*Menu_Facteur_Y)
byte Meilleure_couleur(byte Rouge,byte Vert,byte Bleu);
byte Meilleure_couleur_sans_exclusion(byte Rouge,byte Vert,byte Bleu);
void Ligne_horizontale_XOR_Zoom(short Pos_X, short Pos_Y, short Largeur);
void Ligne_verticale_XOR_Zoom(short Pos_X, short Pos_Y, short Hauteur);
// Définition d'une fonction générique de traçage de figures:
fonction_afficheur Pixel_figure;
void Mettre_Ecran_A_Jour(short X, short Y, short Largeur, short Hauteur);

20
init.c
View File

@ -51,6 +51,7 @@
#include "hotkeys.h"
#include "files.h"
#include "setup.h"
#include "windows.h"
// Ajouter un lecteur à la liste de lecteurs
@ -638,7 +639,6 @@ void Initialisation_des_boutons(void)
Rien_du_tout,
FAMILLE_OUTIL);
// !!! TEMPORAIRE !!!
Initialiser_bouton(BOUTON_GRADRECT,
85,1,
15,15,
@ -646,15 +646,6 @@ void Initialisation_des_boutons(void)
Bouton_Rectangle_degrade,Bouton_Rectangle_degrade,
Rien_du_tout,
FAMILLE_OUTIL);
/*
Initialiser_bouton(BOUTON_GRADRECT,
85,1,
15,15,
FORME_BOUTON_TRIANGLE_HAUT_GAUCHE,
Rien_du_tout,Rien_du_tout,
Rien_du_tout,
FAMILLE_OUTIL);
*/
Initialiser_bouton(BOUTON_GRADMENU,
86,2,
@ -712,15 +703,6 @@ void Initialisation_des_boutons(void)
Bouton_Texte,Message_Non_disponible,
Rien_du_tout,
FAMILLE_INSTANTANE);
/*
Initialiser_bouton(BOUTON_TEXTE,
123,18,
16,16,
FORME_BOUTON_RECTANGLE,
Rien_du_tout,Rien_du_tout,
Rien_du_tout,
FAMILLE_INSTANTANE);
*/
Initialiser_bouton(BOUTON_LOUPE,
140,1,

2
main.c
View File

@ -48,6 +48,8 @@
#include "io.h"
#include "texte.h"
#include "setup.h"
#include "windows.h"
#include "brush.h"
#if defined(__WIN32__)
#include <windows.h>

View File

@ -27,6 +27,7 @@
#include "const.h"
#include "global.h"
#include "graph.h"
#include "windows.h"
void Charger_INI_Clear_string(char * String)
{

View File

@ -29,6 +29,7 @@
#include "io.h"
#include "erreurs.h"
#include "graph.h"
#include "divers.h"
int Sauver_INI_Reach_group(FILE * Old_file,FILE * New_file,char * Buffer,char * Group)
{

View File

@ -27,6 +27,7 @@
#include "readline.h"
#include "aide.h"
#include "sdlscreen.h"
#include "windows.h"
void Bouton_Shade_Mode(void)
{

2354
windows.c Normal file

File diff suppressed because it is too large Load Diff

79
windows.h Normal file
View File

@ -0,0 +1,79 @@
/* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2007-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.
*/
#ifndef __WINDOWSH__
#define __WINDOWSH__
#include "struct.h"
void Remapper_ecran_apres_changement_couleurs_menu(void);
void Calculer_couleurs_menu_optimales(struct Composantes * Palette);
void Recadrer_ecran_par_rapport_au_zoom(void);
void Calculer_split(void);
void Calculer_donnees_loupe(void);
void Calculer_limites(void);
void Calculer_coordonnees_pinceau(void);
void Pixel_dans_barre_d_outil(word X,word Y,byte Couleur);
void Pixel_dans_fenetre(word X,word Y,byte Couleur);
void Encadrer_couleur_menu(byte Couleur);
void Afficher_palette_du_menu(void);
void Afficher_menu(void);
void Recadrer_palette(void);
void Print_general(short X,short Y,char * Chaine,byte Couleur_texte,byte Couleur_fond);
void Print_dans_fenetre(short X,short Y,char * Chaine,byte Couleur_texte,byte Couleur_fond);
void Print_dans_fenetre_limite(short X,short Y,char * Chaine,byte Taille,byte Couleur_texte,byte Couleur_fond);
void Print_char_dans_fenetre(short Pos_X,short Pos_Y,unsigned char Caractere,byte Couleur_texte,byte Couleur_fond);
void Print_char_transparent_dans_fenetre(short Pos_X,short Pos_Y,unsigned char Caractere,byte Couleur);
void Print_dans_menu(char * Chaine, short Position);
void Print_coordonnees(void);
void Print_nom_fichier(void);
void Print_compteur(short X,short Y,char * Chaine,byte Couleur_texte,byte Couleur_fond);
byte Demande_de_confirmation(char * Message);
void Warning_message(char * Message);
void Afficher_limites_de_l_image(void);
void Afficher_ecran(void);
void Fenetre_Afficher_cadre_general(word Pos_X,word Pos_Y,word Largeur,word Hauteur,
byte Couleur_HG,byte Couleur_BD,byte Couleur_S,byte Couleur_CHG,byte Couleur_CBD);
void Fenetre_Afficher_cadre_mono(word Pos_X,word Pos_Y,word Largeur,word Hauteur,byte Couleur);
void Fenetre_Afficher_cadre_creux(word Pos_X,word Pos_Y,word Largeur,word Hauteur);
void Fenetre_Afficher_cadre_bombe(word Pos_X,word Pos_Y,word Largeur,word Hauteur);
void Fenetre_Afficher_cadre(word Pos_X,word Pos_Y,word Largeur,word Hauteur);
void Afficher_sprite_dans_menu(int Numero_bouton,int Numero_sprite);
void Afficher_pinceau_dans_menu(void);
void Afficher_pinceau_dans_fenetre(word X,word Y,int Numero);
void Dessiner_zigouigoui(word X,word Y, byte Couleur, short Sens);
void Bloc_degrade_dans_fenetre(word Pos_X,word Pos_Y,word Debut_block,word Fin_block);
void Fenetre_Afficher_sprite_drive(word Pos_X,word Pos_Y,byte Type);
byte Meilleure_couleur(byte Rouge,byte Vert,byte Bleu);
byte Meilleure_couleur_sans_exclusion(byte Rouge,byte Vert,byte Bleu);
void Ligne_horizontale_XOR_Zoom(short Pos_X, short Pos_Y, short Largeur);
void Ligne_verticale_XOR_Zoom(short Pos_X, short Pos_Y, short Hauteur);
#endif