translations

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@690 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-03-23 02:33:21 +00:00
parent c324adfff2
commit f8c7c6730b
45 changed files with 2021 additions and 2023 deletions

24
aide.c
View File

@ -65,28 +65,28 @@ word * Raccourci(word NumeroRaccourci)
const char * Valeur_Raccourci_Clavier(word NumeroRaccourci)
{
static char Noms_raccourcis[80];
word * Pointeur = Raccourci(NumeroRaccourci);
if (Pointeur == NULL)
word * pointer = Raccourci(NumeroRaccourci);
if (pointer == NULL)
return "(Problem)";
else
{
if (Pointeur[0] == 0 && Pointeur[1] == 0)
if (pointer[0] == 0 && pointer[1] == 0)
return "None";
if (Pointeur[0] != 0 && Pointeur[1] == 0)
return Nom_touche(Pointeur[0]);
if (Pointeur[0] == 0 && Pointeur[1] != 0)
return Nom_touche(Pointeur[1]);
if (pointer[0] != 0 && pointer[1] == 0)
return Nom_touche(pointer[0]);
if (pointer[0] == 0 && pointer[1] != 0)
return Nom_touche(pointer[1]);
strcpy(Noms_raccourcis, Nom_touche(Pointeur[0]));
strcpy(Noms_raccourcis, Nom_touche(pointer[0]));
strcat(Noms_raccourcis, " or ");
strcat(Noms_raccourcis, Nom_touche(Pointeur[1]));
strcat(Noms_raccourcis, Nom_touche(pointer[1]));
return Noms_raccourcis;
}
}
void Redefinir_controle(word *Raccourci, int Pos_X, int Pos_Y)
void Redefinir_controle(word *Raccourci, int x_pos, int y_pos)
{
Effacer_curseur();
Print_dans_fenetre(Pos_X,Pos_Y,"*PRESS KEY OR BUTTON*",CM_Noir,CM_Clair);
Print_dans_fenetre(x_pos,y_pos,"*PRESS KEY OR BUTTON*",CM_Noir,CM_Clair);
Afficher_curseur();
while (1)
{
@ -128,7 +128,7 @@ void Fenetre_controle(int NumeroControle)
}
/*
IndiceConfig=0;
while (ConfigTouche[IndiceConfig].Numero!=IndiceOrdo)
while (ConfigTouche[IndiceConfig].Number!=IndiceOrdo)
{
IndiceConfig++;
if (IndiceConfig>=134)

234
boutons.c
View File

@ -148,7 +148,7 @@ void Message_Memoire_insuffisante(void)
void Bouton_Message_initial(void)
{
char Chaine[21];
int Pos_X,Offs_Y,X,Y;
int x_pos,Offs_Y,X,Y;
sprintf(Chaine,"GrafX %d.%.2d%s%s",VERSION1, VERSION2, ALPHA_BETA,POURCENTAGE_VERSION);
Ouvrir_fenetre(260,172,Chaine);
@ -158,8 +158,8 @@ void Bouton_Message_initial(void)
Fenetre_Pos_Y+(Menu_Facteur_Y*21),
Menu_Facteur_X*237,Menu_Facteur_Y*60,CM_Noir);
for (Y=23,Offs_Y=0; Y<79; Offs_Y+=231,Y++)
for (X=14,Pos_X=0; Pos_X<231; Pos_X++,X++)
Pixel_dans_fenetre(X,Y,Logo_GrafX2[Offs_Y+Pos_X]);
for (X=14,x_pos=0; x_pos<231; x_pos++,X++)
Pixel_dans_fenetre(X,Y,Logo_GrafX2[Offs_Y+x_pos]);
Print_dans_fenetre(130-4*21,88,"Copyright (c) 2007 by",CM_Fonce,CM_Clair);
Print_dans_fenetre(130-4*23,96,"the Grafx2 project team",CM_Noir,CM_Clair);
@ -1253,7 +1253,7 @@ void Bouton_Kill(void)
//------------------------- Dimensions Image/Ecran ---------------------------
void Cocher_bouton_mode(short Pos_X, short Pos_Y, byte state)
void Cocher_bouton_mode(short x_pos, short y_pos, byte state)
{
byte Couleur;
@ -1264,10 +1264,10 @@ void Cocher_bouton_mode(short Pos_X, short Pos_Y, byte state)
case 2 : Couleur=CM_Fonce; break;
default: Couleur=CM_Noir;
}
Block(Fenetre_Pos_X+Menu_Facteur_X*Pos_X,Fenetre_Pos_Y+Menu_Facteur_Y*Pos_Y,
Block(Fenetre_Pos_X+Menu_Facteur_X*x_pos,Fenetre_Pos_Y+Menu_Facteur_Y*y_pos,
Menu_Facteur_X*9,Menu_Facteur_Y*3,Couleur);
UpdateRect(Fenetre_Pos_X+Menu_Facteur_X*Pos_X,Fenetre_Pos_Y+Menu_Facteur_Y*Pos_Y,
UpdateRect(Fenetre_Pos_X+Menu_Facteur_X*x_pos,Fenetre_Pos_Y+Menu_Facteur_Y*y_pos,
Menu_Facteur_X*9,Menu_Facteur_Y*3);
}
@ -1275,15 +1275,15 @@ void Cocher_bouton_mode(short Pos_X, short Pos_Y, byte state)
void Afficher_liste_modes(short Debut_liste, short Position_curseur)
{
short Indice,Mode_courant;
short Pos_Y;
short y_pos;
byte Couleur_texte,Couleur_fond;
char Chaine[29];
char *Ratio;
for (Mode_courant=Debut_liste,Indice=0; Indice<12 && Mode_courant < Nb_modes_video ; Indice++,Mode_courant++)
{
Pos_Y=70+(Indice<<3);
Cocher_bouton_mode(19,Pos_Y+2,Mode_video[Mode_courant].Etat);
y_pos=70+(Indice<<3);
Cocher_bouton_mode(19,y_pos+2,Mode_video[Mode_courant].Etat);
if (Position_curseur!=Indice)
{
@ -1333,7 +1333,7 @@ void Afficher_liste_modes(short Debut_liste, short Position_curseur)
strcat(Chaine,Ratio);
Print_dans_fenetre(38,Pos_Y,Chaine,Couleur_texte,Couleur_fond);
Print_dans_fenetre(38,y_pos,Chaine,Couleur_texte,Couleur_fond);
}
}
@ -1768,19 +1768,19 @@ void Bouton_Ellipse_pleine(void)
// -- Gestion du menu des dégradés ------------------------------------------
void Degrade_Dessiner_bouton_de_technique(short Pos_X,short Pos_Y,int Technique)
void Degrade_Dessiner_bouton_de_technique(short x_pos,short y_pos,int Technique)
{
short line;
// On commence par afficher les 2 côtés qui constituent le dégradé de base:
// Côté gauche (noir)
Block(Fenetre_Pos_X+((Pos_X+2)*Menu_Facteur_X),
Fenetre_Pos_Y+((Pos_Y+2)*Menu_Facteur_Y),
Block(Fenetre_Pos_X+((x_pos+2)*Menu_Facteur_X),
Fenetre_Pos_Y+((y_pos+2)*Menu_Facteur_Y),
Menu_Facteur_X*6,
Menu_Facteur_Y*10,CM_Noir);
// Côté droit (blanc)
Block(Fenetre_Pos_X+((Pos_X+8)*Menu_Facteur_X),
Fenetre_Pos_Y+((Pos_Y+2)*Menu_Facteur_Y),
Block(Fenetre_Pos_X+((x_pos+8)*Menu_Facteur_X),
Fenetre_Pos_Y+((y_pos+2)*Menu_Facteur_Y),
Menu_Facteur_X*5,
Menu_Facteur_Y*10,CM_Blanc);
@ -1792,15 +1792,15 @@ void Degrade_Dessiner_bouton_de_technique(short Pos_X,short Pos_Y,int Technique)
if (line&1)
{
// Lignes impaires
Pixel_dans_fenetre(Pos_X+ 5,Pos_Y+line,CM_Blanc);
Pixel_dans_fenetre(Pos_X+ 7,Pos_Y+line,CM_Blanc);
Pixel_dans_fenetre(Pos_X+ 8,Pos_Y+line,CM_Noir);
Pixel_dans_fenetre(x_pos+ 5,y_pos+line,CM_Blanc);
Pixel_dans_fenetre(x_pos+ 7,y_pos+line,CM_Blanc);
Pixel_dans_fenetre(x_pos+ 8,y_pos+line,CM_Noir);
}
else
{
// Lignes paires
Pixel_dans_fenetre(Pos_X+ 6,Pos_Y+line,CM_Blanc);
Pixel_dans_fenetre(Pos_X+ 9,Pos_Y+line,CM_Noir);
Pixel_dans_fenetre(x_pos+ 6,y_pos+line,CM_Blanc);
Pixel_dans_fenetre(x_pos+ 9,y_pos+line,CM_Noir);
}
break;
case 2 : // Dégradé de trames étendues
@ -1809,19 +1809,19 @@ void Degrade_Dessiner_bouton_de_technique(short Pos_X,short Pos_Y,int Technique)
if (line&1)
{
// Lignes impaires
Pixel_dans_fenetre(Pos_X+ 7,Pos_Y+line,CM_Blanc);
Pixel_dans_fenetre(Pos_X+ 8,Pos_Y+line,CM_Noir);
Pixel_dans_fenetre(Pos_X+10,Pos_Y+line,CM_Noir);
Pixel_dans_fenetre(x_pos+ 7,y_pos+line,CM_Blanc);
Pixel_dans_fenetre(x_pos+ 8,y_pos+line,CM_Noir);
Pixel_dans_fenetre(x_pos+10,y_pos+line,CM_Noir);
}
else
{
// Lignes paires
Pixel_dans_fenetre(Pos_X+ 4,Pos_Y+line,CM_Blanc);
Pixel_dans_fenetre(Pos_X+ 6,Pos_Y+line,CM_Blanc);
Pixel_dans_fenetre(x_pos+ 4,y_pos+line,CM_Blanc);
Pixel_dans_fenetre(x_pos+ 6,y_pos+line,CM_Blanc);
}
}
UpdateRect(Fenetre_Pos_X+((Pos_X+2)*Menu_Facteur_X),Fenetre_Pos_Y+((Pos_Y+2)*Menu_Facteur_Y),
UpdateRect(Fenetre_Pos_X+((x_pos+2)*Menu_Facteur_X),Fenetre_Pos_Y+((y_pos+2)*Menu_Facteur_Y),
Menu_Facteur_X*10,Menu_Facteur_Y*10);
}
@ -1852,8 +1852,8 @@ void Degrade_Charger_infos_du_tableau(int Indice)
void Degrade_Dessiner_preview(short Debut_X,short Debut_Y,short width,short height,int Indice)
{
short Pos_X; // Variables de balayage du block en bas de l'écran.
short Pos_Y;
short x_pos; // Variables de balayage du block en bas de l'écran.
short y_pos;
short Fin_X;
short Fin_Y;
@ -1867,9 +1867,9 @@ void Degrade_Dessiner_preview(short Debut_X,short Debut_Y,short width,short heig
Fin_X=Debut_X+Degrade_Intervalle_total;
Fin_Y=Debut_Y+(height*Menu_Facteur_Y);
for (Pos_Y=Debut_Y;Pos_Y<Fin_Y;Pos_Y++)
for (Pos_X=Debut_X;Pos_X<Fin_X;Pos_X++)
Traiter_degrade(Pos_X-Debut_X,Pos_X,Pos_Y);
for (y_pos=Debut_Y;y_pos<Fin_Y;y_pos++)
for (x_pos=Debut_X;x_pos<Fin_X;x_pos++)
Traiter_degrade(x_pos-Debut_X,x_pos,y_pos);
UpdateRect(Debut_X,Debut_Y,width*Menu_Facteur_X,height*Menu_Facteur_Y);
}
@ -2171,7 +2171,7 @@ void Bouton_desenclencher_Fill(void)
void Bouton_Menu_pinceaux(void)
{
short Bouton_clicke;
short Pos_X,Pos_Y;
short x_pos,y_pos;
byte Indice;
Ouvrir_fenetre(310,155,"Paintbrush menu");
@ -2182,10 +2182,10 @@ void Bouton_Menu_pinceaux(void)
for (Indice=0; Indice<NB_SPRITES_PINCEAU; Indice++)
{
Pos_X=13+((Indice%12)*24);
Pos_Y=27+((Indice/12)*25);
Fenetre_Definir_bouton_normal(Pos_X ,Pos_Y ,20,20,"",0,1,SDLK_LAST);
Afficher_pinceau_dans_fenetre(Pos_X+2,Pos_Y+2,Indice);
x_pos=13+((Indice%12)*24);
y_pos=27+((Indice/12)*25);
Fenetre_Definir_bouton_normal(x_pos ,y_pos ,20,20,"",0,1,SDLK_LAST);
Afficher_pinceau_dans_fenetre(x_pos+2,y_pos+2,Indice);
}
Display_Window(310,155);
@ -2209,9 +2209,9 @@ void Bouton_Menu_pinceaux(void)
Pinceau_Hauteur=Pinceau_predefini_Hauteur[Indice];
Pinceau_Decalage_X=Pinceau_predefini_Decalage_X[Indice];
Pinceau_Decalage_Y=Pinceau_predefini_Decalage_Y[Indice];
for (Pos_Y=0; Pos_Y<Pinceau_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Pinceau_Largeur; Pos_X++)
Pinceau_Sprite[(Pos_Y*TAILLE_MAXI_PINCEAU)+Pos_X]=SPRITE_PINCEAU[Indice][Pos_Y][Pos_X];
for (y_pos=0; y_pos<Pinceau_Hauteur; y_pos++)
for (x_pos=0; x_pos<Pinceau_Largeur; x_pos++)
Pinceau_Sprite[(y_pos*TAILLE_MAXI_PINCEAU)+x_pos]=SPRITE_PINCEAU[Indice][y_pos][x_pos];
Changer_la_forme_du_pinceau(Pinceau_Type[Indice]);
}
@ -2905,14 +2905,14 @@ byte Bouton_Load_ou_Save(byte load, byte image)
On_vient_de_scroller_dans_le_fileselect(Scroller_de_fichiers);
Touche=0;
break;
case SDLK_PAGEDOWN : // Page Down
case SDLK_PAGEDOWN : // PageDown
*Fichier_recherche=0;
Effacer_curseur();
Select_Page_Down(&Principal_File_list_Position,&Principal_File_list_Decalage,9);
On_vient_de_scroller_dans_le_fileselect(Scroller_de_fichiers);
Touche=0;
break;
case SDLK_PAGEUP : // Page Up
case SDLK_PAGEUP : // PageUp
*Fichier_recherche=0;
Effacer_curseur();
Select_Page_Up(&Principal_File_list_Position,&Principal_File_list_Decalage,9);
@ -4499,9 +4499,9 @@ void Bouton_Colorize_Mode(void)
}
void Bouton_Colorize_Afficher_la_selection(int Numero)
void Bouton_Colorize_Afficher_la_selection(int mode)
{
short Pos_Y=0; // Ligne où afficher les flèches de sélection
short y_pos=0; // Ligne où afficher les flèches de sélection
// On commence par effacer les anciennes sélections:
// Partie gauche
@ -4514,19 +4514,19 @@ void Bouton_Colorize_Afficher_la_selection(int Numero)
Print_dans_fenetre(129,74," ",CM_Noir,CM_Clair);
// Ensuite, on affiche la flèche là où il le faut:
switch(Numero)
switch(mode)
{
case 0 : // Méthode interpolée
Pos_Y=37;
y_pos=37;
break;
case 1 : // Méthode additive
Pos_Y=57;
y_pos=57;
break;
case 2 : // Méthode soustractive
Pos_Y=74;
y_pos=74;
}
Print_dans_fenetre(4,Pos_Y,"\020",CM_Noir,CM_Clair);
Print_dans_fenetre(129,Pos_Y,"\021",CM_Noir,CM_Clair);
Print_dans_fenetre(4,y_pos,"\020",CM_Noir,CM_Clair);
Print_dans_fenetre(129,y_pos,"\021",CM_Noir,CM_Clair);
}
void Bouton_Colorize_Menu(void)
@ -5098,8 +5098,8 @@ void Bouton_Trame_Mode(void)
void Dessiner_trame_zoomee(short Orig_X, short Orig_Y)
{
short Pos_X;
short Pos_Y;
short x_pos;
short y_pos;
short Taille_X;
short Taille_Y;
short Debut_X=Fenetre_Pos_X+(Menu_Facteur_X*230);
@ -5113,28 +5113,28 @@ void Dessiner_trame_zoomee(short Orig_X, short Orig_Y)
Menu_Facteur_X*Fenetre_Liste_boutons_special->Width,
Menu_Facteur_Y*Fenetre_Liste_boutons_special->Height,CM_Clair);
for (Pos_Y=0; Pos_Y<Trame_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Trame_Largeur; Pos_X++)
for (y_pos=0; y_pos<Trame_Hauteur; y_pos++)
for (x_pos=0; x_pos<Trame_Largeur; x_pos++)
{
// Bordures de la case
Block(Orig_X+(Pos_X*Taille_X),
Orig_Y+((Pos_Y+1)*Taille_Y)-Menu_Facteur_Y,
Block(Orig_X+(x_pos*Taille_X),
Orig_Y+((y_pos+1)*Taille_Y)-Menu_Facteur_Y,
Taille_X, Menu_Facteur_Y,CM_Fonce);
Block(Orig_X+((Pos_X+1)*Taille_X)-Menu_Facteur_X,
Orig_Y+(Pos_Y*Taille_Y),
Block(Orig_X+((x_pos+1)*Taille_X)-Menu_Facteur_X,
Orig_Y+(y_pos*Taille_Y),
Menu_Facteur_X, Taille_Y-1,CM_Fonce);
// Contenu de la case
Block(Orig_X+(Pos_X*Taille_X), Orig_Y+(Pos_Y*Taille_Y),
Block(Orig_X+(x_pos*Taille_X), Orig_Y+(y_pos*Taille_Y),
Taille_X-Menu_Facteur_X, Taille_Y-Menu_Facteur_Y,
(Trame[Pos_X][Pos_Y])?CM_Blanc:CM_Noir);
(Trame[x_pos][y_pos])?CM_Blanc:CM_Noir);
}
// Dessiner la preview de la trame
Taille_X=Menu_Facteur_X*51; // |_ Taille de la fenêtre
Taille_Y=Menu_Facteur_Y*71; // | de la preview
for (Pos_Y=0; Pos_Y<Taille_Y; Pos_Y++)
for (Pos_X=0; Pos_X<Taille_X; Pos_X++)
Pixel(Debut_X+Pos_X,Debut_Y+Pos_Y,(Trame[Pos_X%Trame_Largeur][Pos_Y%Trame_Hauteur])?CM_Blanc:CM_Noir);
for (y_pos=0; y_pos<Taille_Y; y_pos++)
for (x_pos=0; x_pos<Taille_X; x_pos++)
Pixel(Debut_X+x_pos,Debut_Y+y_pos,(Trame[x_pos%Trame_Largeur][y_pos%Trame_Hauteur])?CM_Blanc:CM_Noir);
UpdateRect(Debut_X,Debut_Y,Taille_X,Taille_Y);
}
@ -5176,11 +5176,11 @@ void Copier_trame_predefinie(byte Indice)
void Inverser_trame(void)
{
byte Pos_X,Pos_Y;
byte x_pos,y_pos;
for (Pos_Y=0; Pos_Y<Trame_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Trame_Largeur; Pos_X++)
Trame[Pos_X][Pos_Y]=!(Trame[Pos_X][Pos_Y]);
for (y_pos=0; y_pos<Trame_Hauteur; y_pos++)
for (x_pos=0; x_pos<Trame_Largeur; x_pos++)
Trame[x_pos][y_pos]=!(Trame[x_pos][y_pos]);
}
// Rafraichit toute la zone correspondant à la trame zoomee.
@ -5194,8 +5194,8 @@ void Bouton_Trame_Menu(void)
{
short Bouton_clicke;
short Indice;
short Pos_X;
short Pos_Y;
short x_pos;
short y_pos;
short Old_Pos_X=0;
short Old_Pos_Y=0;
short Orig_X;
@ -5290,41 +5290,41 @@ void Bouton_Trame_Menu(void)
case 1 : // Zone de dessin de la trame
/* // Version qui n'accepte pas les clicks sur la grille
Pos_X=(Mouse_X-Orig_X)/Menu_Facteur_X;
Pos_Y=(Mouse_Y-Orig_Y)/Menu_Facteur_Y;
if ( (Pos_X%5<4) && (Pos_Y%5<4) )
x_pos=(Mouse_X-Orig_X)/Menu_Facteur_X;
y_pos=(Mouse_Y-Orig_Y)/Menu_Facteur_Y;
if ( (x_pos%5<4) && (y_pos%5<4) )
{
Pos_X/=5;
Pos_Y/=5;
if ( (Pos_X<Trame_Largeur) && (Pos_Y<Trame_Hauteur) )
x_pos/=5;
y_pos/=5;
if ( (x_pos<Trame_Largeur) && (y_pos<Trame_Hauteur) )
}
*/
Pos_X=(Mouse_X-Orig_X)/(Menu_Facteur_X*5);
Pos_Y=(Mouse_Y-Orig_Y)/(Menu_Facteur_Y*5);
if ( (Pos_X<Trame_Largeur) && (Pos_Y<Trame_Hauteur) )
x_pos=(Mouse_X-Orig_X)/(Menu_Facteur_X*5);
y_pos=(Mouse_Y-Orig_Y)/(Menu_Facteur_Y*5);
if ( (x_pos<Trame_Largeur) && (y_pos<Trame_Hauteur) )
{
Temp=(Mouse_K==A_GAUCHE);
if ( (Pos_X!=Old_Pos_X) || (Pos_Y!=Old_Pos_Y)
|| (Trame[Pos_X][Pos_Y]!=Temp) )
if ( (x_pos!=Old_Pos_X) || (y_pos!=Old_Pos_Y)
|| (Trame[x_pos][y_pos]!=Temp) )
{
Old_Pos_X=Pos_X;
Old_Pos_Y=Pos_Y;
Trame[Pos_X][Pos_Y]=Temp;
Pos_X=Menu_Facteur_X*5;
Pos_Y=Menu_Facteur_Y*5;
Old_Pos_X=x_pos;
Old_Pos_Y=y_pos;
Trame[x_pos][y_pos]=Temp;
x_pos=Menu_Facteur_X*5;
y_pos=Menu_Facteur_Y*5;
Effacer_curseur();
if (Temp)
Temp=CM_Blanc;
else
Temp=CM_Noir;
// Affichage du pixel dans la fenêtre zoomée
Block(Orig_X+(Old_Pos_X*Pos_X), Orig_Y+(Old_Pos_Y*Pos_Y),
Pos_X-Menu_Facteur_X, Pos_Y-Menu_Facteur_Y, Temp);
Block(Orig_X+(Old_Pos_X*x_pos), Orig_Y+(Old_Pos_Y*y_pos),
x_pos-Menu_Facteur_X, y_pos-Menu_Facteur_Y, Temp);
// Mise à jour de la preview
Dessiner_trame_zoomee(Orig_X,Orig_Y);
Afficher_curseur();
// Maj de la case seule
UpdateRect(Orig_X+(Old_Pos_X*Pos_X), Orig_Y+(Old_Pos_Y*Pos_Y),Menu_Facteur_X*5,Menu_Facteur_Y*5);
UpdateRect(Orig_X+(Old_Pos_X*x_pos), Orig_Y+(Old_Pos_Y*y_pos),Menu_Facteur_X*5,Menu_Facteur_Y*5);
}
}
break;
@ -5353,9 +5353,9 @@ void Bouton_Trame_Menu(void)
Effacer_curseur();
Trame_Largeur=(Brosse_Largeur>16)?16:Brosse_Largeur;
Trame_Hauteur=(Brosse_Hauteur>16)?16:Brosse_Hauteur;
for (Pos_Y=0; Pos_Y<Trame_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Trame_Largeur; Pos_X++)
Trame[Pos_X][Pos_Y]=(Lit_pixel_dans_brosse(Pos_X,Pos_Y)!=Back_color);
for (y_pos=0; y_pos<Trame_Hauteur; y_pos++)
for (x_pos=0; x_pos<Trame_Largeur; x_pos++)
Trame[x_pos][y_pos]=(Lit_pixel_dans_brosse(x_pos,y_pos)!=Back_color);
Dessiner_trame_zoomee(Orig_X,Orig_Y);
Num2str(Trame_Hauteur,Chaine,2);
Print_dans_fenetre(71,136,Chaine,CM_Noir,CM_Clair);
@ -5371,9 +5371,9 @@ void Bouton_Trame_Menu(void)
Brosse_Largeur=Trame_Largeur;
Brosse_Hauteur=Trame_Hauteur;
Brosse=(byte *)malloc(((long)Brosse_Hauteur)*Brosse_Largeur);
for (Pos_Y=0; Pos_Y<Trame_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Trame_Largeur; Pos_X++)
Pixel_dans_brosse(Pos_X,Pos_Y,(Trame[Pos_X][Pos_Y])?Fore_color:Back_color);
for (y_pos=0; y_pos<Trame_Hauteur; y_pos++)
for (x_pos=0; x_pos<Trame_Largeur; x_pos++)
Pixel_dans_brosse(x_pos,y_pos,(Trame[x_pos][y_pos])?Fore_color:Back_color);
Brosse_Decalage_X=(Brosse_Largeur>>1);
Brosse_Decalage_Y=(Brosse_Hauteur>>1);
Changer_la_forme_du_pinceau(FORME_PINCEAU_BROSSE_COULEUR);
@ -5452,12 +5452,12 @@ void Bouton_Trame_Menu(void)
case 13 : // Scroll vers le haut
Effacer_curseur();
for (Pos_X=0; Pos_X<Trame_Largeur; Pos_X++)
for (x_pos=0; x_pos<Trame_Largeur; x_pos++)
{
Temp=Trame[Pos_X][0]; // Octet temporaire
for (Pos_Y=1; Pos_Y<Trame_Hauteur; Pos_Y++)
Trame[Pos_X][Pos_Y-1]=Trame[Pos_X][Pos_Y];
Trame[Pos_X][Trame_Hauteur-1]=Temp;
Temp=Trame[x_pos][0]; // Octet temporaire
for (y_pos=1; y_pos<Trame_Hauteur; y_pos++)
Trame[x_pos][y_pos-1]=Trame[x_pos][y_pos];
Trame[x_pos][Trame_Hauteur-1]=Temp;
}
Dessiner_trame_zoomee(Orig_X,Orig_Y);
Afficher_curseur();
@ -5466,12 +5466,12 @@ void Bouton_Trame_Menu(void)
case 14 : // Scroll vers le bas
Effacer_curseur();
for (Pos_X=0; Pos_X<Trame_Largeur; Pos_X++)
for (x_pos=0; x_pos<Trame_Largeur; x_pos++)
{
Temp=Trame[Pos_X][Trame_Hauteur-1]; // Octet temporaire
for (Pos_Y=Trame_Hauteur-1; Pos_Y>0; Pos_Y--)
Trame[Pos_X][Pos_Y]=Trame[Pos_X][Pos_Y-1];
Trame[Pos_X][0]=Temp;
Temp=Trame[x_pos][Trame_Hauteur-1]; // Octet temporaire
for (y_pos=Trame_Hauteur-1; y_pos>0; y_pos--)
Trame[x_pos][y_pos]=Trame[x_pos][y_pos-1];
Trame[x_pos][0]=Temp;
}
Dessiner_trame_zoomee(Orig_X,Orig_Y);
Afficher_curseur();
@ -5480,12 +5480,12 @@ void Bouton_Trame_Menu(void)
case 15 : // Scroll vers la gauche
Effacer_curseur();
for (Pos_Y=0; Pos_Y<Trame_Hauteur; Pos_Y++)
for (y_pos=0; y_pos<Trame_Hauteur; y_pos++)
{
Temp=Trame[0][Pos_Y]; // Octet temporaire
for (Pos_X=1; Pos_X<Trame_Largeur; Pos_X++)
Trame[Pos_X-1][Pos_Y]=Trame[Pos_X][Pos_Y];
Trame[Trame_Largeur-1][Pos_Y]=Temp;
Temp=Trame[0][y_pos]; // Octet temporaire
for (x_pos=1; x_pos<Trame_Largeur; x_pos++)
Trame[x_pos-1][y_pos]=Trame[x_pos][y_pos];
Trame[Trame_Largeur-1][y_pos]=Temp;
}
Dessiner_trame_zoomee(Orig_X,Orig_Y);
Afficher_curseur();
@ -5494,12 +5494,12 @@ void Bouton_Trame_Menu(void)
case 16 : // Scroll vers la droite
Effacer_curseur();
for (Pos_Y=0; Pos_Y<Trame_Hauteur; Pos_Y++)
for (y_pos=0; y_pos<Trame_Hauteur; y_pos++)
{
Temp=Trame[Trame_Largeur-1][Pos_Y]; // Octet temporaire
for (Pos_X=Trame_Largeur-1; Pos_X>0; Pos_X--)
Trame[Pos_X][Pos_Y]=Trame[Pos_X-1][Pos_Y];
Trame[0][Pos_Y]=Temp;
Temp=Trame[Trame_Largeur-1][y_pos]; // Octet temporaire
for (x_pos=Trame_Largeur-1; x_pos>0; x_pos--)
Trame[x_pos][y_pos]=Trame[x_pos-1][y_pos];
Trame[0][y_pos]=Temp;
}
Dessiner_trame_zoomee(Orig_X,Orig_Y);
Afficher_curseur();
@ -5592,11 +5592,11 @@ void Bouton_Ajuster(void)
void Afficher_sprite_effet(short Numero_sprite, short Debut_X, short Debut_Y)
{
short X,Y,Pos_X,Pos_Y;
short X,Y,x_pos,y_pos;
for (Y=0,Pos_Y=Debut_Y;Y<HAUTEUR_SPRITE_MENU;Y++,Pos_Y++)
for (X=0,Pos_X=Debut_X;X<LARGEUR_SPRITE_MENU;X++,Pos_X++)
Pixel_dans_fenetre(Pos_X,Pos_Y,SPRITE_EFFET[Numero_sprite][Y][X]);
for (Y=0,y_pos=Debut_Y;Y<HAUTEUR_SPRITE_MENU;Y++,y_pos++)
for (X=0,x_pos=Debut_X;X<LARGEUR_SPRITE_MENU;X++,x_pos++)
Pixel_dans_fenetre(x_pos,y_pos,SPRITE_EFFET[Numero_sprite][Y][X]);
UpdateRect(ToWinX(Debut_X),ToWinY(Debut_Y),LARGEUR_SPRITE_MENU*Menu_Facteur_X,HAUTEUR_SPRITE_MENU*Menu_Facteur_Y);
}

View File

@ -43,7 +43,7 @@ void Bouton_Message_initial(void);
This function saves the current brush shape and swith to the default one (single pixel brush) for the filler and the color picker.
These functions don't need (and will not work with) a custom brush.
*/
void Changer_la_forme_du_pinceau(byte Numero);
void Changer_la_forme_du_pinceau(byte shape);
// Boutons relatifs aux couleurs

326
brush.c
View File

@ -93,10 +93,10 @@ void Calculer_dimensions_clipees_zoom(short * X,short * Y,short * width,short *
// -- Afficher le pinceau (de façon définitive ou non) --
void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
void Afficher_pinceau(short X,short Y,byte Couleur,byte is_preview)
// X,Y: position du centre du pinceau
// Couleur: couleur à appliquer au pinceau
// Preview: "Il ne faut l'afficher qu'à l'écran"
// is_preview: "Il ne faut l'afficher qu'à l'écran"
{
short Debut_X; // Position X (dans l'image) à partir de laquelle on
// affiche la brosse/pinceau
@ -110,8 +110,8 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
// de laquelle on affiche la brosse/pinceau
short Debut_Compteur_Y; // Position Y (dans la brosse/pinceau) à partir
// de laquelle on affiche la brosse/pinceau
short Pos_X; // Position X (dans l'image) en cours d'affichage
short Pos_Y; // Position Y (dans l'image) en cours d'affichage
short x_pos; // Position X (dans l'image) en cours d'affichage
short y_pos; // Position Y (dans l'image) en cours d'affichage
short Compteur_X; // Position X (dans la brosse/pinceau) en cours
// d'affichage
short Compteur_Y; // Position Y (dans la brosse/pinceau) en cours
@ -121,10 +121,10 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
short Fin_Compteur_Y; // Position Y ou s'arrête l'affichade de la
// brosse/pinceau
byte Couleur_temporaire; // Couleur de la brosse en cours d'affichage
int Position;
int position;
byte * Temp;
if (!(Preview && Mouse_K)) // Si bouton enfoncé & preview > pas de dessin
if (!(is_preview && Mouse_K)) // Si bouton enfoncé & preview > pas de dessin
switch (Pinceau_Forme)
{
case FORME_PINCEAU_POINT : // !!! TOUJOURS EN PREVIEW !!!
@ -152,7 +152,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
Fin_Compteur_X=Debut_Compteur_X+width;
Fin_Compteur_Y=Debut_Compteur_Y+height;
if (Preview)
if (is_preview)
{
if ( (width>0) && (height>0) )
Display_brush_Color(
@ -216,24 +216,24 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
}
else
{
for (Pos_Y = Debut_Y, Compteur_Y = Debut_Compteur_Y;
for (y_pos = Debut_Y, Compteur_Y = Debut_Compteur_Y;
Compteur_Y < Fin_Compteur_Y;
Pos_Y++, Compteur_Y++
y_pos++, Compteur_Y++
)
for (Pos_X = Debut_X, Compteur_X = Debut_Compteur_X;
for (x_pos = Debut_X, Compteur_X = Debut_Compteur_X;
Compteur_X < Fin_Compteur_X;
Pos_X++, Compteur_X++
x_pos++, Compteur_X++
)
{
Couleur_temporaire = Lit_pixel_dans_ecran_courant(
Pos_X,Pos_Y
x_pos,y_pos
);
Position = (Compteur_Y * Smear_Brosse_Largeur)+ Compteur_X;
position = (Compteur_Y * Smear_Brosse_Largeur)+ Compteur_X;
if ( (Lit_pixel_dans_brosse(Compteur_X,Compteur_Y) != Back_color)
&& (Compteur_Y<Smear_Max_Y) && (Compteur_X<Smear_Max_X)
&& (Compteur_Y>=Smear_Min_Y) && (Compteur_X>=Smear_Min_X) )
Afficher_pixel(Pos_X,Pos_Y,Smear_Brosse[Position]);
Smear_Brosse[Position]=Couleur_temporaire;
Afficher_pixel(x_pos,y_pos,Smear_Brosse[position]);
Smear_Brosse[position]=Couleur_temporaire;
}
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,width,height);
@ -247,19 +247,19 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
else
{
if (Shade_Table==Shade_Table_gauche)
for (Pos_Y=Debut_Y,Compteur_Y=Debut_Compteur_Y;Compteur_Y<Fin_Compteur_Y;Pos_Y++,Compteur_Y++)
for (Pos_X=Debut_X,Compteur_X=Debut_Compteur_X;Compteur_X<Fin_Compteur_X;Pos_X++,Compteur_X++)
for (y_pos=Debut_Y,Compteur_Y=Debut_Compteur_Y;Compteur_Y<Fin_Compteur_Y;y_pos++,Compteur_Y++)
for (x_pos=Debut_X,Compteur_X=Debut_Compteur_X;Compteur_X<Fin_Compteur_X;x_pos++,Compteur_X++)
{
Couleur_temporaire=Lit_pixel_dans_brosse(Compteur_X,Compteur_Y);
if (Couleur_temporaire!=Back_color)
Afficher_pixel(Pos_X,Pos_Y,Couleur_temporaire);
Afficher_pixel(x_pos,y_pos,Couleur_temporaire);
}
else
for (Pos_Y=Debut_Y,Compteur_Y=Debut_Compteur_Y;Compteur_Y<Fin_Compteur_Y;Pos_Y++,Compteur_Y++)
for (Pos_X=Debut_X,Compteur_X=Debut_Compteur_X;Compteur_X<Fin_Compteur_X;Pos_X++,Compteur_X++)
for (y_pos=Debut_Y,Compteur_Y=Debut_Compteur_Y;Compteur_Y<Fin_Compteur_Y;y_pos++,Compteur_Y++)
for (x_pos=Debut_X,Compteur_X=Debut_Compteur_X;Compteur_X<Fin_Compteur_X;x_pos++,Compteur_X++)
{
if (Lit_pixel_dans_brosse(Compteur_X,Compteur_Y)!=Back_color)
Afficher_pixel(Pos_X,Pos_Y,Couleur);
Afficher_pixel(x_pos,y_pos,Couleur);
}
}
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,width,height);
@ -276,7 +276,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
Debut_Compteur_Y=Debut_Y-(Y-Brosse_Decalage_Y);
Fin_Compteur_X=Debut_Compteur_X+width;
Fin_Compteur_Y=Debut_Compteur_Y+height;
if (Preview)
if (is_preview)
{
if ( (width>0) && (height>0) )
Display_brush_Mono(Debut_X-Principal_Decalage_X,
@ -335,16 +335,16 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
}
else
{
for (Pos_Y=Debut_Y,Compteur_Y=Debut_Compteur_Y;Compteur_Y<Fin_Compteur_Y;Pos_Y++,Compteur_Y++)
for (Pos_X=Debut_X,Compteur_X=Debut_Compteur_X;Compteur_X<Fin_Compteur_X;Pos_X++,Compteur_X++)
for (y_pos=Debut_Y,Compteur_Y=Debut_Compteur_Y;Compteur_Y<Fin_Compteur_Y;y_pos++,Compteur_Y++)
for (x_pos=Debut_X,Compteur_X=Debut_Compteur_X;Compteur_X<Fin_Compteur_X;x_pos++,Compteur_X++)
{
Couleur_temporaire=Lit_pixel_dans_ecran_courant(Pos_X,Pos_Y);
Position=(Compteur_Y*Smear_Brosse_Largeur)+Compteur_X;
Couleur_temporaire=Lit_pixel_dans_ecran_courant(x_pos,y_pos);
position=(Compteur_Y*Smear_Brosse_Largeur)+Compteur_X;
if ( (Lit_pixel_dans_brosse(Compteur_X,Compteur_Y)!=Back_color)
&& (Compteur_Y<Smear_Max_Y) && (Compteur_X<Smear_Max_X)
&& (Compteur_Y>=Smear_Min_Y) && (Compteur_X>=Smear_Min_X) )
Afficher_pixel(Pos_X,Pos_Y,Smear_Brosse[Position]);
Smear_Brosse[Position]=Couleur_temporaire;
Afficher_pixel(x_pos,y_pos,Smear_Brosse[position]);
Smear_Brosse[position]=Couleur_temporaire;
}
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,width,height);
@ -358,11 +358,11 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
}
else
{
for (Pos_Y=Debut_Y,Compteur_Y=Debut_Compteur_Y;Compteur_Y<Fin_Compteur_Y;Pos_Y++,Compteur_Y++)
for (Pos_X=Debut_X,Compteur_X=Debut_Compteur_X;Compteur_X<Fin_Compteur_X;Pos_X++,Compteur_X++)
for (y_pos=Debut_Y,Compteur_Y=Debut_Compteur_Y;Compteur_Y<Fin_Compteur_Y;y_pos++,Compteur_Y++)
for (x_pos=Debut_X,Compteur_X=Debut_Compteur_X;Compteur_X<Fin_Compteur_X;x_pos++,Compteur_X++)
{
if (Lit_pixel_dans_brosse(Compteur_X,Compteur_Y)!=Back_color)
Afficher_pixel(Pos_X,Pos_Y,Couleur);
Afficher_pixel(x_pos,y_pos,Couleur);
}
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,width,height);
}
@ -378,7 +378,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
Debut_Compteur_Y=Debut_Y-(Y-Pinceau_Decalage_Y);
Fin_Compteur_X=Debut_Compteur_X+width;
Fin_Compteur_Y=Debut_Compteur_Y+height;
if (Preview)
if (is_preview)
{
Temp=Brosse;
Brosse=Pinceau_Sprite;
@ -440,16 +440,16 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
}
else
{
for (Pos_Y=Debut_Y,Compteur_Y=Debut_Compteur_Y;Compteur_Y<Fin_Compteur_Y;Pos_Y++,Compteur_Y++)
for (Pos_X=Debut_X,Compteur_X=Debut_Compteur_X;Compteur_X<Fin_Compteur_X;Pos_X++,Compteur_X++)
for (y_pos=Debut_Y,Compteur_Y=Debut_Compteur_Y;Compteur_Y<Fin_Compteur_Y;y_pos++,Compteur_Y++)
for (x_pos=Debut_X,Compteur_X=Debut_Compteur_X;Compteur_X<Fin_Compteur_X;x_pos++,Compteur_X++)
{
Couleur_temporaire=Lit_pixel_dans_ecran_courant(Pos_X,Pos_Y);
Position=(Compteur_Y*Smear_Brosse_Largeur)+Compteur_X;
Couleur_temporaire=Lit_pixel_dans_ecran_courant(x_pos,y_pos);
position=(Compteur_Y*Smear_Brosse_Largeur)+Compteur_X;
if ( (Pinceau_Sprite[(TAILLE_MAXI_PINCEAU*Compteur_Y)+Compteur_X]) // Le pinceau sert de masque pour dire quels pixels on doit traiter dans le rectangle
&& (Compteur_Y<Smear_Max_Y) && (Compteur_X<Smear_Max_X) // On clippe l'effet smear entre Smear_Min et Smear_Max
&& (Compteur_Y>=Smear_Min_Y) && (Compteur_X>=Smear_Min_X) )
Afficher_pixel(Pos_X,Pos_Y,Smear_Brosse[Position]);
Smear_Brosse[Position]=Couleur_temporaire;
Afficher_pixel(x_pos,y_pos,Smear_Brosse[position]);
Smear_Brosse[position]=Couleur_temporaire;
}
Mettre_Ecran_A_Jour(Debut_X, Debut_Y, width, height);
}
@ -462,11 +462,11 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
}
else
{
for (Pos_Y=Debut_Y,Compteur_Y=Debut_Compteur_Y;Compteur_Y<Fin_Compteur_Y;Pos_Y++,Compteur_Y++)
for (Pos_X=Debut_X,Compteur_X=Debut_Compteur_X;Compteur_X<Fin_Compteur_X;Pos_X++,Compteur_X++)
for (y_pos=Debut_Y,Compteur_Y=Debut_Compteur_Y;Compteur_Y<Fin_Compteur_Y;y_pos++,Compteur_Y++)
for (x_pos=Debut_X,Compteur_X=Debut_Compteur_X;Compteur_X<Fin_Compteur_X;x_pos++,Compteur_X++)
{
if (Pinceau_Sprite[(TAILLE_MAXI_PINCEAU*Compteur_Y)+Compteur_X])
Afficher_pixel(Pos_X,Pos_Y,Couleur);
Afficher_pixel(x_pos,y_pos,Couleur);
}
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,width,height);
}
@ -491,8 +491,8 @@ void Effacer_pinceau(short X,short Y)
// de laquelle on affiche la brosse/pinceau
short Debut_Compteur_Y; // Position Y (dans la brosse/pinceau) à partir
// de laquelle on affiche la brosse/pinceau
//short Pos_X; // Position X (dans l'image) en cours d'affichage
//short Pos_Y; // Position Y (dans l'image) en cours d'affichage
//short x_pos; // Position X (dans l'image) en cours d'affichage
//short y_pos; // Position Y (dans l'image) en cours d'affichage
//short Compteur_X; // Position X (dans la brosse/pinceau) en cours
//d'affichage
//short Compteur_Y; // Position Y (dans la brosse/pinceau) en cours d'affichage
@ -611,8 +611,8 @@ void Effacer_pinceau(short X,short Y)
void Capturer_brosse(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y,short clear)
{
short Temporaire;
short Pos_X;
short Pos_Y;
short x_pos;
short y_pos;
word Nouvelle_Brosse_Largeur;
word Nouvelle_Brosse_Hauteur;
@ -693,11 +693,11 @@ void Capturer_brosse(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y,short c
// On regarde s'il faut effacer quelque chose:
if (clear)
{
for (Pos_Y=Debut_Y;Pos_Y<Debut_Y+Brosse_Hauteur;Pos_Y++)
for (Pos_X=Debut_X;Pos_X<Debut_X+Brosse_Largeur;Pos_X++)
for (y_pos=Debut_Y;y_pos<Debut_Y+Brosse_Hauteur;y_pos++)
for (x_pos=Debut_X;x_pos<Debut_X+Brosse_Largeur;x_pos++)
{
Pixel_dans_ecran_courant(Pos_X,Pos_Y,Back_color);
Pixel_Preview (Pos_X,Pos_Y,Back_color);
Pixel_dans_ecran_courant(x_pos,y_pos,Back_color);
Pixel_Preview (x_pos,y_pos,Back_color);
}
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,Brosse_Largeur,Brosse_Hauteur);
}
@ -740,8 +740,8 @@ void Rotate_90_deg()
void Remap_brosse(void)
{
short Pos_X; // Variable de balayage de la brosse
short Pos_Y; // Variable de balayage de la brosse
short x_pos; // Variable de balayage de la brosse
short y_pos; // Variable de balayage de la brosse
byte Utilisee[256]; // Tableau de booléens "La couleur est utilisée"
int Couleur;
@ -751,9 +751,9 @@ void Remap_brosse(void)
Utilisee[Couleur]=0;
// On calcule la table d'utilisation des couleurs
for (Pos_Y=0;Pos_Y<Brosse_Hauteur;Pos_Y++)
for (Pos_X=0;Pos_X<Brosse_Largeur;Pos_X++)
Utilisee[Lit_pixel_dans_brosse(Pos_X,Pos_Y)]=1;
for (y_pos=0;y_pos<Brosse_Hauteur;y_pos++)
for (x_pos=0;x_pos<Brosse_Largeur;x_pos++)
Utilisee[Lit_pixel_dans_brosse(x_pos,y_pos)]=1;
// On n'est pas censé remapper la couleur de transparence, sinon la brosse
// changera de forme, donc on dit pour l'instant qu'elle n'est pas utilisée
@ -769,7 +769,7 @@ void Remap_brosse(void)
// ne seront pas utilisées par Remap_brush_LOWLEVEL.
for (Couleur=0;Couleur<=255;Couleur++)
if (Utilisee[Couleur])
Utilisee[Couleur]=Meilleure_couleur(Brouillon_Palette[Couleur].R,Brouillon_Palette[Couleur].V,Brouillon_Palette[Couleur].B);
Utilisee[Couleur]=Meilleure_couleur(Brouillon_Palette[Couleur].R,Brouillon_Palette[Couleur].G,Brouillon_Palette[Couleur].B);
// Il reste une couleur non calculée dans la table qu'il faut mettre à
// jour: c'est la couleur de fond. On l'avait inhibée pour éviter son
@ -790,7 +790,7 @@ void Remap_brosse(void)
void Outline_brush(void)
{
long /*Pos,*/Pos_X,Pos_Y;
long /*Pos,*/x_pos,y_pos;
byte state;
byte * Nouvelle_brosse;
byte * Temporaire;
@ -829,16 +829,16 @@ void Outline_brush(void)
if (Fore_color!=Back_color)
{
// 1er balayage (horizontal)
for (Pos_Y=1; Pos_Y<Brosse_Hauteur-1; Pos_Y++)
for (y_pos=1; y_pos<Brosse_Hauteur-1; y_pos++)
{
state=0;
for (Pos_X=1; Pos_X<Brosse_Largeur-1; Pos_X++)
for (x_pos=1; x_pos<Brosse_Largeur-1; x_pos++)
{
if (Temporaire[((Pos_Y-1)*width)+Pos_X-1]==Back_color)
if (Temporaire[((y_pos-1)*width)+x_pos-1]==Back_color)
{
if (state)
{
Pixel_dans_brosse(Pos_X,Pos_Y,Fore_color);
Pixel_dans_brosse(x_pos,y_pos,Fore_color);
state=0;
}
}
@ -846,27 +846,27 @@ void Outline_brush(void)
{
if (!state)
{
Pixel_dans_brosse(Pos_X-1,Pos_Y,Fore_color);
Pixel_dans_brosse(x_pos-1,y_pos,Fore_color);
state=1;
}
}
}
// Cas du dernier pixel à droite de la ligne
if (state)
Pixel_dans_brosse(Pos_X,Pos_Y,Fore_color);
Pixel_dans_brosse(x_pos,y_pos,Fore_color);
}
// 2ème balayage (vertical)
for (Pos_X=1; Pos_X<Brosse_Largeur-1; Pos_X++)
for (x_pos=1; x_pos<Brosse_Largeur-1; x_pos++)
{
state=0;
for (Pos_Y=1; Pos_Y<Brosse_Hauteur-1; Pos_Y++)
for (y_pos=1; y_pos<Brosse_Hauteur-1; y_pos++)
{
if (Temporaire[((Pos_Y-1)*width)+Pos_X-1]==Back_color)
if (Temporaire[((y_pos-1)*width)+x_pos-1]==Back_color)
{
if (state)
{
Pixel_dans_brosse(Pos_X,Pos_Y,Fore_color);
Pixel_dans_brosse(x_pos,y_pos,Fore_color);
state=0;
}
}
@ -874,14 +874,14 @@ void Outline_brush(void)
{
if (!state)
{
Pixel_dans_brosse(Pos_X,Pos_Y-1,Fore_color);
Pixel_dans_brosse(x_pos,y_pos-1,Fore_color);
state=1;
}
}
}
// Cas du dernier pixel en bas de la colonne
if (state)
Pixel_dans_brosse(Pos_X,Pos_Y,Fore_color);
Pixel_dans_brosse(x_pos,y_pos,Fore_color);
}
}
@ -904,7 +904,7 @@ void Outline_brush(void)
void Nibble_brush(void)
{
long /*Pos,*/Pos_X,Pos_Y;
long /*Pos,*/x_pos,y_pos;
byte state;
byte * Nouvelle_brosse;
byte * Temporaire;
@ -940,17 +940,17 @@ void Nibble_brush(void)
height+=2;
// 1er balayage (horizontal)
for (Pos_Y=0; Pos_Y<Brosse_Hauteur; Pos_Y++)
for (y_pos=0; y_pos<Brosse_Hauteur; y_pos++)
{
state=(Temporaire[(Pos_Y+1)*width]!=Back_color);
for (Pos_X=0; Pos_X<Brosse_Largeur; Pos_X++)
state=(Temporaire[(y_pos+1)*width]!=Back_color);
for (x_pos=0; x_pos<Brosse_Largeur; x_pos++)
{
if (Temporaire[((Pos_Y+1)*width)+Pos_X+1]==Back_color)
if (Temporaire[((y_pos+1)*width)+x_pos+1]==Back_color)
{
if (state)
{
if (Pos_X>0)
Pixel_dans_brosse(Pos_X-1,Pos_Y,Back_color);
if (x_pos>0)
Pixel_dans_brosse(x_pos-1,y_pos,Back_color);
state=0;
}
}
@ -958,28 +958,28 @@ void Nibble_brush(void)
{
if (!state)
{
Pixel_dans_brosse(Pos_X,Pos_Y,Back_color);
Pixel_dans_brosse(x_pos,y_pos,Back_color);
state=1;
}
}
}
// Cas du dernier pixel à droite de la ligne
if (Temporaire[((Pos_Y+1)*width)+Pos_X+1]==Back_color)
Pixel_dans_brosse(Pos_X-1,Pos_Y,Back_color);
if (Temporaire[((y_pos+1)*width)+x_pos+1]==Back_color)
Pixel_dans_brosse(x_pos-1,y_pos,Back_color);
}
// 2ème balayage (vertical)
for (Pos_X=0; Pos_X<Brosse_Largeur; Pos_X++)
for (x_pos=0; x_pos<Brosse_Largeur; x_pos++)
{
state=(Temporaire[width+Pos_X+1]!=Back_color);;
for (Pos_Y=0; Pos_Y<Brosse_Hauteur; Pos_Y++)
state=(Temporaire[width+x_pos+1]!=Back_color);;
for (y_pos=0; y_pos<Brosse_Hauteur; y_pos++)
{
if (Temporaire[((Pos_Y+1)*width)+Pos_X+1]==Back_color)
if (Temporaire[((y_pos+1)*width)+x_pos+1]==Back_color)
{
if (state)
{
if (Pos_Y>0)
Pixel_dans_brosse(Pos_X,Pos_Y-1,Back_color);
if (y_pos>0)
Pixel_dans_brosse(x_pos,y_pos-1,Back_color);
state=0;
}
}
@ -987,14 +987,14 @@ void Nibble_brush(void)
{
if (!state)
{
Pixel_dans_brosse(Pos_X,Pos_Y,Back_color);
Pixel_dans_brosse(x_pos,y_pos,Back_color);
state=1;
}
}
}
// Cas du dernier pixel en bas de la colonne
if (Temporaire[((Pos_Y+1)*width)+Pos_X+1]==Back_color)
Pixel_dans_brosse(Pos_X,Pos_Y-1,Back_color);
if (Temporaire[((y_pos+1)*width)+x_pos+1]==Back_color)
Pixel_dans_brosse(x_pos,y_pos-1,Back_color);
}
// On recentre la prise sur la brosse
@ -1023,8 +1023,8 @@ void Capturer_brosse_au_lasso(int Vertices, short * Points,short clear)
short Fin_X=Limite_Gauche-1;
short Fin_Y=Limite_Haut-1;
short Temporaire;
short Pos_X;
short Pos_Y;
short x_pos;
short y_pos;
word Nouvelle_Brosse_Largeur;
word Nouvelle_Brosse_Hauteur;
@ -1032,16 +1032,16 @@ void Capturer_brosse_au_lasso(int Vertices, short * Points,short clear)
// On recherche les bornes de la brosse:
for (Temporaire=0; Temporaire<Vertices; Temporaire++)
{
Pos_X=Points[Temporaire<<1];
Pos_Y=Points[(Temporaire<<1)+1];
if (Pos_X<Debut_X)
Debut_X=Pos_X;
if (Pos_X>Fin_X)
Fin_X=Pos_X;
if (Pos_Y<Debut_Y)
Debut_Y=Pos_Y;
if (Pos_Y>Fin_Y)
Fin_Y=Pos_Y;
x_pos=Points[Temporaire<<1];
y_pos=Points[(Temporaire<<1)+1];
if (x_pos<Debut_X)
Debut_X=x_pos;
if (x_pos>Fin_X)
Fin_X=x_pos;
if (y_pos<Debut_Y)
Debut_Y=y_pos;
if (y_pos>Fin_Y)
Fin_Y=y_pos;
}
// On clippe ces bornes à l'écran:
@ -1126,14 +1126,14 @@ void Capturer_brosse_au_lasso(int Vertices, short * Points,short clear)
// On scanne la brosse pour remplacer tous les pixels affectés par le
// polyfill par ceux de l'image:
for (Pos_Y=Debut_Y;Pos_Y<=Fin_Y;Pos_Y++)
for (Pos_X=Debut_X;Pos_X<=Fin_X;Pos_X++)
if (Lit_pixel_dans_brosse(Pos_X-Debut_X,Pos_Y-Debut_Y)!=Back_color)
for (y_pos=Debut_Y;y_pos<=Fin_Y;y_pos++)
for (x_pos=Debut_X;x_pos<=Fin_X;x_pos++)
if (Lit_pixel_dans_brosse(x_pos-Debut_X,y_pos-Debut_Y)!=Back_color)
{
Pixel_dans_brosse(Pos_X-Debut_X,Pos_Y-Debut_Y,Lit_pixel_dans_ecran_courant(Pos_X,Pos_Y));
Pixel_dans_brosse(x_pos-Debut_X,y_pos-Debut_Y,Lit_pixel_dans_ecran_courant(x_pos,y_pos));
// On regarde s'il faut effacer quelque chose:
if (clear)
Pixel_dans_ecran_courant(Pos_X,Pos_Y,Back_color);
Pixel_dans_ecran_courant(x_pos,y_pos,Back_color);
}
// On centre la prise sur la brosse
@ -1148,7 +1148,7 @@ void Capturer_brosse_au_lasso(int Vertices, short * Points,short clear)
void Etirer_brosse(short X1, short Y1, short X2, short Y2)
{
int Offset,line,Colonne;
int offset,line,Colonne;
byte * New_Brosse;
int New_Brosse_Largeur; // Width de la nouvelle brosse
@ -1179,7 +1179,7 @@ void Etirer_brosse(short X1, short Y1, short X2, short Y2)
Delta_X_dans_brosse=(Brosse_Largeur<<16)/(X2-X1+Dx);
Delta_Y_dans_brosse=(Brosse_Hauteur<<16)/(Y2-Y1+Dy);
// Calcul de la valeur initiale de Pos_X pour chaque ligne:
// Calcul de la valeur initiale de x_pos pour chaque ligne:
if (Dx>=0)
Pos_X_initial = 0; // Pas d'inversion en X de la brosse
else
@ -1189,9 +1189,9 @@ void Etirer_brosse(short X1, short Y1, short X2, short Y2)
if ((New_Brosse=((byte *)malloc(New_Brosse_Largeur*New_Brosse_Hauteur))))
{
Offset=0;
offset=0;
// Calcul de la valeur initiale de Pos_Y:
// Calcul de la valeur initiale de y_pos:
if (Dy>=0)
Pos_Y_dans_brosse=0; // Pas d'inversion en Y de la brosse
else
@ -1207,11 +1207,11 @@ void Etirer_brosse(short X1, short Y1, short X2, short Y2)
for (Colonne=0;Colonne<New_Brosse_Largeur;Colonne++)
{
// On copie le pixel:
New_Brosse[Offset]=Lit_pixel_dans_brosse(Pos_X_dans_brosse>>16,Pos_Y_dans_brosse>>16);
New_Brosse[offset]=Lit_pixel_dans_brosse(Pos_X_dans_brosse>>16,Pos_Y_dans_brosse>>16);
// On passe à la colonne de brosse suivante:
Pos_X_dans_brosse+=Delta_X_dans_brosse;
// On passe au pixel suivant de la nouvelle brosse:
Offset++;
offset++;
}
// On passe à la ligne de brosse suivante:
@ -1347,7 +1347,7 @@ float * ScanY_X[2];
void Interpoler_texture(int Debut_X,int Debut_Y,int Xt1,int Yt1,
int Fin_X ,int Fin_Y ,int Xt2,int Yt2,int height)
{
int Pos_X,Pos_Y;
int x_pos,y_pos;
int Incr_X,Incr_Y;
int i,Cumul;
int Delta_X,Delta_Y;
@ -1358,8 +1358,8 @@ void Interpoler_texture(int Debut_X,int Debut_Y,int Xt1,int Yt1,
float Xt,Yt;
Pos_X=Debut_X;
Pos_Y=Debut_Y;
x_pos=Debut_X;
y_pos=Debut_Y;
if (Debut_X<Fin_X)
{
@ -1391,52 +1391,52 @@ void Interpoler_texture(int Debut_X,int Debut_Y,int Xt1,int Yt1,
if (Cumul>=Delta_X)
{
Cumul-=Delta_X;
Pos_Y+=Incr_Y;
y_pos+=Incr_Y;
}
if ((Pos_Y>=0) && (Pos_Y<height))
if ((y_pos>=0) && (y_pos<height))
{
Xt=(((float)((Pos_X-Debut_X)*Delta_Xt))/(float)Delta_X2) + (float)Xt1;
Yt=(((float)((Pos_X-Debut_X)*Delta_Yt))/(float)Delta_X2) + (float)Yt1;
if (ScanY_X[0][Pos_Y]==INDEFINI) // Gauche non défini
Xt=(((float)((x_pos-Debut_X)*Delta_Xt))/(float)Delta_X2) + (float)Xt1;
Yt=(((float)((x_pos-Debut_X)*Delta_Yt))/(float)Delta_X2) + (float)Yt1;
if (ScanY_X[0][y_pos]==INDEFINI) // Gauche non défini
{
ScanY_X[0][Pos_Y]=Pos_X;
ScanY_Xt[0][Pos_Y]=Xt;
ScanY_Yt[0][Pos_Y]=Yt;
ScanY_X[0][y_pos]=x_pos;
ScanY_Xt[0][y_pos]=Xt;
ScanY_Yt[0][y_pos]=Yt;
}
else
{
if (Pos_X>=ScanY_X[0][Pos_Y])
if (x_pos>=ScanY_X[0][y_pos])
{
if ((ScanY_X[1][Pos_Y]==INDEFINI) // Droit non défini
|| (Pos_X>ScanY_X[1][Pos_Y]))
if ((ScanY_X[1][y_pos]==INDEFINI) // Droit non défini
|| (x_pos>ScanY_X[1][y_pos]))
{
ScanY_X[1][Pos_Y]=Pos_X;
ScanY_Xt[1][Pos_Y]=Xt;
ScanY_Yt[1][Pos_Y]=Yt;
ScanY_X[1][y_pos]=x_pos;
ScanY_Xt[1][y_pos]=Xt;
ScanY_Yt[1][y_pos]=Yt;
}
}
else
{
if (ScanY_X[1][Pos_Y]==INDEFINI) // Droit non défini
if (ScanY_X[1][y_pos]==INDEFINI) // Droit non défini
{
ScanY_X[1][Pos_Y]=ScanY_X[0][Pos_Y];
ScanY_Xt[1][Pos_Y]=ScanY_Xt[0][Pos_Y];
ScanY_Yt[1][Pos_Y]=ScanY_Yt[0][Pos_Y];
ScanY_X[0][Pos_Y]=Pos_X;
ScanY_Xt[0][Pos_Y]=Xt;
ScanY_Yt[0][Pos_Y]=Yt;
ScanY_X[1][y_pos]=ScanY_X[0][y_pos];
ScanY_Xt[1][y_pos]=ScanY_Xt[0][y_pos];
ScanY_Yt[1][y_pos]=ScanY_Yt[0][y_pos];
ScanY_X[0][y_pos]=x_pos;
ScanY_Xt[0][y_pos]=Xt;
ScanY_Yt[0][y_pos]=Yt;
}
else
{
ScanY_X[0][Pos_Y]=Pos_X;
ScanY_Xt[0][Pos_Y]=Xt;
ScanY_Yt[0][Pos_Y]=Yt;
ScanY_X[0][y_pos]=x_pos;
ScanY_Xt[0][y_pos]=Xt;
ScanY_Yt[0][y_pos]=Yt;
}
}
}
}
Pos_X+=Incr_X;
x_pos+=Incr_X;
Cumul+=Delta_Y;
}
}
@ -1448,52 +1448,52 @@ void Interpoler_texture(int Debut_X,int Debut_Y,int Xt1,int Yt1,
if (Cumul>=Delta_Y)
{
Cumul-=Delta_Y;
Pos_X+=Incr_X;
x_pos+=Incr_X;
}
if ((Pos_Y>=0) && (Pos_Y<height))
if ((y_pos>=0) && (y_pos<height))
{
Xt=(((float)((Pos_Y-Debut_Y)*Delta_Xt))/(float)Delta_Y2) + (float)Xt1;
Yt=(((float)((Pos_Y-Debut_Y)*Delta_Yt))/(float)Delta_Y2) + (float)Yt1;
if (ScanY_X[0][Pos_Y]==INDEFINI) // Gauche non défini
Xt=(((float)((y_pos-Debut_Y)*Delta_Xt))/(float)Delta_Y2) + (float)Xt1;
Yt=(((float)((y_pos-Debut_Y)*Delta_Yt))/(float)Delta_Y2) + (float)Yt1;
if (ScanY_X[0][y_pos]==INDEFINI) // Gauche non défini
{
ScanY_X[0][Pos_Y]=Pos_X;
ScanY_Xt[0][Pos_Y]=Xt;
ScanY_Yt[0][Pos_Y]=Yt;
ScanY_X[0][y_pos]=x_pos;
ScanY_Xt[0][y_pos]=Xt;
ScanY_Yt[0][y_pos]=Yt;
}
else
{
if (Pos_X>=ScanY_X[0][Pos_Y])
if (x_pos>=ScanY_X[0][y_pos])
{
if ((ScanY_X[1][Pos_Y]==INDEFINI) // Droit non défini
|| (Pos_X>ScanY_X[1][Pos_Y]))
if ((ScanY_X[1][y_pos]==INDEFINI) // Droit non défini
|| (x_pos>ScanY_X[1][y_pos]))
{
ScanY_X[1][Pos_Y]=Pos_X;
ScanY_Xt[1][Pos_Y]=Xt;
ScanY_Yt[1][Pos_Y]=Yt;
ScanY_X[1][y_pos]=x_pos;
ScanY_Xt[1][y_pos]=Xt;
ScanY_Yt[1][y_pos]=Yt;
}
}
else
{
if (ScanY_X[1][Pos_Y]==INDEFINI) // Droit non défini
if (ScanY_X[1][y_pos]==INDEFINI) // Droit non défini
{
ScanY_X[1][Pos_Y]=ScanY_X[0][Pos_Y];
ScanY_Xt[1][Pos_Y]=ScanY_Xt[0][Pos_Y];
ScanY_Yt[1][Pos_Y]=ScanY_Yt[0][Pos_Y];
ScanY_X[0][Pos_Y]=Pos_X;
ScanY_Xt[0][Pos_Y]=Xt;
ScanY_Yt[0][Pos_Y]=Yt;
ScanY_X[1][y_pos]=ScanY_X[0][y_pos];
ScanY_Xt[1][y_pos]=ScanY_Xt[0][y_pos];
ScanY_Yt[1][y_pos]=ScanY_Yt[0][y_pos];
ScanY_X[0][y_pos]=x_pos;
ScanY_Xt[0][y_pos]=Xt;
ScanY_Yt[0][y_pos]=Yt;
}
else
{
ScanY_X[0][Pos_Y]=Pos_X;
ScanY_Xt[0][Pos_Y]=Xt;
ScanY_Yt[0][Pos_Y]=Yt;
ScanY_X[0][y_pos]=x_pos;
ScanY_Xt[0][y_pos]=Xt;
ScanY_Yt[0][y_pos]=Yt;
}
}
}
}
Pos_Y+=Incr_Y;
y_pos+=Incr_Y;
Cumul+=Delta_X;
}
}

View File

@ -71,15 +71,15 @@ word Palette_Compter_nb_couleurs_utilisees(dword* Tableau)
return Nombre_Couleurs;
}
void Set_palette(T_Palette Palette)
void Set_palette(T_Palette palette)
{
register int i;
SDL_Color PaletteSDL[256];
for(i=0;i<256;i++)
{
PaletteSDL[i].r=(Palette[i].R=Palette_Scale_Component(Palette[i].R));
PaletteSDL[i].g=(Palette[i].V=Palette_Scale_Component(Palette[i].V));
PaletteSDL[i].b=(Palette[i].B=Palette_Scale_Component(Palette[i].B));
PaletteSDL[i].r=(palette[i].R=Palette_Scale_Component(palette[i].R));
PaletteSDL[i].g=(palette[i].G=Palette_Scale_Component(palette[i].G));
PaletteSDL[i].b=(palette[i].B=Palette_Scale_Component(palette[i].B));
}
SDL_SetPalette(Ecran_SDL, SDL_PHYSPAL | SDL_LOGPAL, PaletteSDL,0,256);
}
@ -366,25 +366,25 @@ byte Lit_pixel_dans_ecran_backup (word X,word Y)
return *(Ecran_backup + X + Principal_Largeur_image * Y);
}
void Palette_256_to_64(T_Palette Palette)
void Palette_256_to_64(T_Palette palette)
{
int i;
for(i=0;i<256;i++)
{
Palette[i].R = Palette[i].R >> 2;
Palette[i].V = Palette[i].V >> 2;
Palette[i].B = Palette[i].B >> 2;
palette[i].R = palette[i].R >> 2;
palette[i].G = palette[i].G >> 2;
palette[i].B = palette[i].B >> 2;
}
}
void Palette_64_to_256(T_Palette Palette)
void Palette_64_to_256(T_Palette palette)
{
int i;
for(i=0;i<256;i++)
{
Palette[i].R = (Palette[i].R << 2)|(Palette[i].R >> 4);
Palette[i].V = (Palette[i].V << 2)|(Palette[i].V >> 4);
Palette[i].B = (Palette[i].B << 2)|(Palette[i].B >> 4);
palette[i].R = (palette[i].R << 2)|(palette[i].R >> 4);
palette[i].G = (palette[i].G << 2)|(palette[i].G >> 4);
palette[i].B = (palette[i].B << 2)|(palette[i].B >> 4);
}
}
@ -400,8 +400,8 @@ byte Effet_Colorize_interpole (word X,word Y,byte Couleur)
// 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;
byte Vert_dessous=Principal_Palette[*(FX_Feedback_Ecran + Y * Principal_Largeur_image + X)].V;
byte Vert=Principal_Palette[Couleur].V;
byte Vert_dessous=Principal_Palette[*(FX_Feedback_Ecran + Y * Principal_Largeur_image + X)].G;
byte Vert=Principal_Palette[Couleur].G;
byte Rouge_dessous=Principal_Palette[*(FX_Feedback_Ecran + Y * Principal_Largeur_image + X)].R;
byte Rouge=Principal_Palette[Couleur].R;
@ -421,10 +421,10 @@ byte Effet_Colorize_interpole (word X,word Y,byte Couleur)
byte Effet_Colorize_additif (word X,word Y,byte Couleur)
{
byte Bleu_dessous=Principal_Palette[*(FX_Feedback_Ecran + Y * Principal_Largeur_image + X)].B;
byte Vert_dessous=Principal_Palette[*(FX_Feedback_Ecran + Y * Principal_Largeur_image + X)].V;
byte Vert_dessous=Principal_Palette[*(FX_Feedback_Ecran + Y * Principal_Largeur_image + X)].G;
byte Rouge_dessous=Principal_Palette[*(FX_Feedback_Ecran + Y * Principal_Largeur_image + X)].R;
byte Bleu=Principal_Palette[Couleur].B;
byte Vert=Principal_Palette[Couleur].V;
byte Vert=Principal_Palette[Couleur].G;
byte Rouge=Principal_Palette[Couleur].R;
return Meilleure_couleur(
@ -436,10 +436,10 @@ byte Effet_Colorize_additif (word X,word Y,byte Couleur)
byte Effet_Colorize_soustractif(word X,word Y,byte Couleur)
{
byte Bleu_dessous=Principal_Palette[*(FX_Feedback_Ecran + Y * Principal_Largeur_image + X)].B;
byte Vert_dessous=Principal_Palette[*(FX_Feedback_Ecran + Y * Principal_Largeur_image + X)].V;
byte Vert_dessous=Principal_Palette[*(FX_Feedback_Ecran + Y * Principal_Largeur_image + X)].G;
byte Rouge_dessous=Principal_Palette[*(FX_Feedback_Ecran + Y * Principal_Largeur_image + X)].R;
byte Bleu=Principal_Palette[Couleur].B;
byte Vert=Principal_Palette[Couleur].V;
byte Vert=Principal_Palette[Couleur].G;
byte Rouge=Principal_Palette[Couleur].R;
return Meilleure_couleur(

View File

@ -29,9 +29,9 @@ void Set_mouse_position(void);
void Attendre_fin_de_click(void);
void Sensibilite_souris(word X,word Y);
void Set_color(byte Couleur, byte Rouge, byte Vert, byte Bleu);
void Set_palette(T_Palette Palette);
void Palette_256_to_64(T_Palette Palette);
void Palette_64_to_256(T_Palette Palette);
void Set_palette(T_Palette palette);
void Palette_256_to_64(T_Palette palette);
void Palette_64_to_256(T_Palette palette);
void Effacer_image_courante(byte Couleur);
void Effacer_image_courante_Stencil(byte Couleur, byte * Pochoir);
void Wait_VBL(void);

View File

@ -27,6 +27,6 @@
#define UNTESTED printf("%s %d %s à tester !\n",__FILE__,__LINE__,__func__);
void Erreur_fonction(int error_code, const char *Nom_fichier, int Numero_ligne, const char *Nom_fonction);
void Erreur_fonction(int error_code, const char *filename, int Numero_ligne, const char *Nom_fonction);
#define Erreur(n) Erreur_fonction(n, __FILE__,__LINE__,__func__)

BIN
gfx2.cfg

Binary file not shown.

View File

@ -205,7 +205,7 @@ GFX2_GLOBAL short Ancien_Principal_Decalage_X;
GFX2_GLOBAL short Ancien_Principal_Decalage_Y;
GFX2_GLOBAL char Principal_Repertoire_fichier[1024]; // |_ Nom complet =
GFX2_GLOBAL char Principal_Nom_fichier[256]; // | Repertoire_fichier+"\"+Nom_fichier
GFX2_GLOBAL char Principal_Nom_fichier[256]; // | Repertoire_fichier+"\"+Filename
GFX2_GLOBAL byte Principal_Format_fichier; // Format auquel il faut lire et écrire le fichier
GFX2_GLOBAL byte Principal_Format; // Format du fileselect
GFX2_GLOBAL short Principal_File_list_Position; // Début de la partie affichée dans la liste de fichiers
@ -231,7 +231,7 @@ GFX2_GLOBAL short Ancien_Brouillon_Decalage_X;
GFX2_GLOBAL short Ancien_Brouillon_Decalage_Y;
GFX2_GLOBAL char Brouillon_Repertoire_fichier[TAILLE_CHEMIN_FICHIER]; // |_ Nom complet =
GFX2_GLOBAL char Brouillon_Nom_fichier[TAILLE_CHEMIN_FICHIER]; // | Repertoire_fichier+"\"+Nom_fichier
GFX2_GLOBAL char Brouillon_Nom_fichier[TAILLE_CHEMIN_FICHIER]; // | Repertoire_fichier+"\"+Filename
GFX2_GLOBAL byte Brouillon_Format_fichier; // Format auquel il faut lire et écrire le fichier
GFX2_GLOBAL byte Brouillon_Format; // Format du fileselect
GFX2_GLOBAL short Brouillon_File_list_Position; // Début de la partie affichée dans la liste de fichiers

460
graph.c

File diff suppressed because it is too large Load Diff

23
graph.h
View File

@ -19,7 +19,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
void Liste2tables(word * list, short Pas, byte mode, byte * Table_inc,
void Liste2tables(word * list, short step, byte mode, byte * Table_inc,
byte * Table_dec
);
@ -39,7 +39,7 @@ void Afficher_foreback(void);
void Afficher_pixel(word X,word Y,byte Couleur);
void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview);
void Afficher_pinceau(short X,short Y,byte Couleur,byte is_preview);
void Effacer_pinceau(short X,short Y);
void Redimentionner_image(word Largeur_choisie,word Hauteur_choisie);
@ -47,11 +47,11 @@ void Redimentionner_image(word Largeur_choisie,word Hauteur_choisie);
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_auto(word Pos_X,word Pos_Y);
void Pixel_figure_Preview_xor(word Pos_X,word Pos_Y,byte Couleur);
void Pixel_figure_Preview_xorback(word Pos_X,word Pos_Y,byte Couleur);
void Pixel_figure_Dans_brosse(word Pos_X,word Pos_Y,byte Couleur);
void Pixel_figure_Preview (word x_pos,word y_pos,byte Couleur);
void Pixel_figure_Preview_auto(word x_pos,word y_pos);
void Pixel_figure_Preview_xor(word x_pos,word y_pos,byte Couleur);
void Pixel_figure_Preview_xorback(word x_pos,word y_pos,byte Couleur);
void Pixel_figure_Dans_brosse(word x_pos,word y_pos,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);
@ -80,10 +80,10 @@ void Effacer_courbe_Preview (short X1, short Y1, short X2, short Y2, short X3, s
void Aerographe(short Bouton_clicke);
void Degrade_de_base (long Indice,short Pos_X,short Pos_Y);
void Degrade_de_trames_simples (long Indice,short Pos_X,short Pos_Y);
void Degrade_de_trames_etendues(long Indice,short Pos_X,short Pos_Y);
void Degrade_aleatoire (long Indice,short Pos_X,short Pos_Y);
void Degrade_de_base (long Indice,short x_pos,short y_pos);
void Degrade_de_trames_simples (long Indice,short x_pos,short y_pos);
void Degrade_de_trames_etendues(long Indice,short x_pos,short y_pos);
void Degrade_aleatoire (long Indice,short x_pos,short y_pos);
void Tracer_cercle_degrade (short Centre_X,short Centre_Y,short Rayon,short Eclairage_X,short Eclairage_Y);
void Tracer_ellipse_degradee(short Centre_X,short Centre_Y,short Rayon_horizontal,short Rayon_vertical,short Eclairage_X,short Eclairage_Y);
@ -97,7 +97,6 @@ void Download_infos_page_principal(S_Page * Page);
void Download_infos_page_brouillon(S_Page * Page);
void Download_infos_backup(S_Liste_de_pages * list);
void Detruire_les_listes_de_backups_en_fin_de_programme(void);
void Nouveau_nombre_de_backups(int Nouveau);
int Backup_avec_nouvelles_dimensions(int Upload,int width,int height);
int Backuper_et_redimensionner_brouillon(int width,int height);
void Undo(void);

View File

@ -26,7 +26,7 @@
typedef struct
{
word Numero;
word Number;
char Label[36];
char Explic1[37];
char Explic2[37];

93
init.c
View File

@ -230,7 +230,7 @@ void Charger_DAT(void)
for (i=0; i<256; i++)
{
Palette_defaut[i].R=SDLPal->colors[i].r;
Palette_defaut[i].V=SDLPal->colors[i].g;
Palette_defaut[i].G=SDLPal->colors[i].g;
Palette_defaut[i].B=SDLPal->colors[i].b;
}
@ -745,7 +745,7 @@ void Rien_du_tout(void)
// Initialiseur d'un bouton:
void Initialiser_bouton(byte Numero,
void Initialiser_bouton(byte btn_number,
word x_offset , word y_offset,
word width , word height,
byte shape,
@ -753,16 +753,16 @@ void Initialiser_bouton(byte Numero,
fonction_action Desenclencher,
byte family)
{
Bouton[Numero].Decalage_X =x_offset;
Bouton[Numero].Decalage_Y =y_offset;
Bouton[Numero].Width =width-1;
Bouton[Numero].Height =height-1;
Bouton[Numero].Enfonce =0;
Bouton[Numero].Shape =shape;
Bouton[Numero].Gauche =Gauche;
Bouton[Numero].Droite =Droite;
Bouton[Numero].Desenclencher =Desenclencher;
Bouton[Numero].Famille =family;
Bouton[btn_number].Decalage_X =x_offset;
Bouton[btn_number].Decalage_Y =y_offset;
Bouton[btn_number].Width =width-1;
Bouton[btn_number].Height =height-1;
Bouton[btn_number].Enfonce =0;
Bouton[btn_number].Shape =shape;
Bouton[btn_number].Gauche =Gauche;
Bouton[btn_number].Droite =Droite;
Bouton[btn_number].Desenclencher =Desenclencher;
Bouton[btn_number].Famille =family;
}
@ -1118,16 +1118,16 @@ void Initialiser_operation(byte Numero_operation,
void Initialisation_des_operations(void)
{
byte Numero; // Numéro de l'option en cours d'auto-initialisation
byte number; // Numéro de l'option en cours d'auto-initialisation
byte Bouton; // Bouton souris en cours d'auto-initialisation
byte Taille; // Taille de la pile en cours d'auto-initialisation
// Auto-initialisation des opérations (vers des actions inoffensives)
for (Numero=0;Numero<NB_OPERATIONS;Numero++)
for (number=0;number<NB_OPERATIONS;number++)
for (Bouton=0;Bouton<3;Bouton++)
for (Taille=0;Taille<TAILLE_PILE_OPERATIONS;Taille++)
Initialiser_operation(Numero,Bouton,Taille,Print_coordonnees,0);
Initialiser_operation(number,Bouton,Taille,Print_coordonnees,0);
// Ici viennent les déclarations détaillées des opérations
@ -1710,17 +1710,17 @@ int Charger_CFG(int Tout_charger)
goto Erreur_config_ancienne;
// - Lecture des infos contenues dans le fichier de config -
while (read_byte(Handle, &Chunk.Numero))
while (read_byte(Handle, &Chunk.Number))
{
read_word_le(Handle, &Chunk.Taille);
switch (Chunk.Numero)
switch (Chunk.Number)
{
case CHUNK_TOUCHES: // Touches
if (Tout_charger)
{
for (Indice=0; Indice<(long)(Chunk.Taille/sizeof(CFG_Infos_touche)); Indice++)
{
if (!read_word_le(Handle, &CFG_Infos_touche.Numero) ||
if (!read_word_le(Handle, &CFG_Infos_touche.Number) ||
!read_word_le(Handle, &CFG_Infos_touche.Touche) ||
!read_word_le(Handle, &CFG_Infos_touche.Touche2) )
goto Erreur_lecture_config;
@ -1739,7 +1739,7 @@ int Charger_CFG(int Tout_charger)
}
for (Indice2=0;
((Indice2<NB_TOUCHES) && (ConfigTouche[Indice2].Numero!=CFG_Infos_touche.Numero));
((Indice2<NB_TOUCHES) && (ConfigTouche[Indice2].Number!=CFG_Infos_touche.Number));
Indice2++);
if (Indice2<NB_TOUCHES)
{
@ -1807,12 +1807,12 @@ int Charger_CFG(int Tout_charger)
if (! read_word_le(Handle, &Shade_Liste[Indice].List[Indice2]))
goto Erreur_lecture_config;
}
if (! read_byte(Handle, &Shade_Liste[Indice].Pas) ||
if (! read_byte(Handle, &Shade_Liste[Indice].Step) ||
! read_byte(Handle, &Shade_Liste[Indice].Mode) )
goto Erreur_lecture_config;
}
Liste2tables(Shade_Liste[Shade_Actuel].List,
Shade_Liste[Shade_Actuel].Pas,
Shade_Liste[Shade_Actuel].Step,
Shade_Liste[Shade_Actuel].Mode,
Shade_Table_gauche,Shade_Table_droite);
}
@ -1951,7 +1951,6 @@ int Sauver_CFG(void)
int Indice;
int Indice2;
int Modes_a_sauver;
//byte Octet;
char Nom_du_fichier[TAILLE_CHEMIN_FICHIER];
Config_Header CFG_Header;
Config_Chunk Chunk;
@ -1978,15 +1977,15 @@ int Sauver_CFG(void)
goto Erreur_sauvegarde_config;
// Enregistrement des touches
Chunk.Numero=CHUNK_TOUCHES;
Chunk.Number=CHUNK_TOUCHES;
Chunk.Taille=NB_TOUCHES*sizeof(CFG_Infos_touche);
if (!write_byte(Handle, Chunk.Numero) ||
if (!write_byte(Handle, Chunk.Number) ||
!write_word_le(Handle, Chunk.Taille) )
goto Erreur_sauvegarde_config;
for (Indice=0; Indice<NB_TOUCHES; Indice++)
{
CFG_Infos_touche.Numero = ConfigTouche[Indice].Numero;
CFG_Infos_touche.Number = ConfigTouche[Indice].Number;
switch(Ordonnancement[Indice]>>8)
{
case 0 :
@ -2002,7 +2001,7 @@ int Sauver_CFG(void)
CFG_Infos_touche.Touche2=Bouton[Ordonnancement[Indice]&0xFF].Raccourci_droite[1];
break;
}
if (!write_word_le(Handle, CFG_Infos_touche.Numero) ||
if (!write_word_le(Handle, CFG_Infos_touche.Number) ||
!write_word_le(Handle, CFG_Infos_touche.Touche) ||
!write_word_le(Handle, CFG_Infos_touche.Touche2) )
goto Erreur_sauvegarde_config;
@ -2015,10 +2014,10 @@ int Sauver_CFG(void)
Modes_a_sauver++;
// Sauvegarde de l'état de chaque mode vidéo
Chunk.Numero=CHUNK_MODES_VIDEO;
Chunk.Number=CHUNK_MODES_VIDEO;
Chunk.Taille=Modes_a_sauver * sizeof(CFG_Mode_video);
if (!write_byte(Handle, Chunk.Numero) ||
if (!write_byte(Handle, Chunk.Number) ||
!write_word_le(Handle, Chunk.Taille) )
goto Erreur_sauvegarde_config;
for (Indice=1; Indice<Nb_modes_video; Indice++)
@ -2035,9 +2034,9 @@ int Sauver_CFG(void)
}
// Ecriture des données du Shade (précédées du shade en cours)
Chunk.Numero=CHUNK_SHADE;
Chunk.Number=CHUNK_SHADE;
Chunk.Taille=sizeof(Shade_Liste)+sizeof(Shade_Actuel);
if (!write_byte(Handle, Chunk.Numero) ||
if (!write_byte(Handle, Chunk.Number) ||
!write_word_le(Handle, Chunk.Taille) )
goto Erreur_sauvegarde_config;
if (!write_byte(Handle, Shade_Actuel))
@ -2049,33 +2048,33 @@ int Sauver_CFG(void)
if (! write_word_le(Handle, Shade_Liste[Indice].List[Indice2]))
goto Erreur_sauvegarde_config;
}
if (! write_byte(Handle, Shade_Liste[Indice].Pas) ||
if (! write_byte(Handle, Shade_Liste[Indice].Step) ||
! write_byte(Handle, Shade_Liste[Indice].Mode) )
goto Erreur_sauvegarde_config;
}
// Sauvegarde des informations du Masque
Chunk.Numero=CHUNK_MASQUE;
Chunk.Number=CHUNK_MASQUE;
Chunk.Taille=sizeof(Mask_table);
if (!write_byte(Handle, Chunk.Numero) ||
if (!write_byte(Handle, Chunk.Number) ||
!write_word_le(Handle, Chunk.Taille) )
goto Erreur_sauvegarde_config;
if (!write_bytes(Handle, Mask_table,256))
goto Erreur_sauvegarde_config;
// Sauvegarde des informations du Stencil
Chunk.Numero=CHUNK_STENCIL;
Chunk.Number=CHUNK_STENCIL;
Chunk.Taille=sizeof(Stencil);
if (!write_byte(Handle, Chunk.Numero) ||
if (!write_byte(Handle, Chunk.Number) ||
!write_word_le(Handle, Chunk.Taille) )
goto Erreur_sauvegarde_config;
if (!write_bytes(Handle, Stencil,256))
goto Erreur_sauvegarde_config;
// Sauvegarde des informations des dégradés
Chunk.Numero=CHUNK_DEGRADES;
Chunk.Number=CHUNK_DEGRADES;
Chunk.Taille=sizeof(Degrade_Tableau)+1;
if (!write_byte(Handle, Chunk.Numero) ||
if (!write_byte(Handle, Chunk.Number) ||
!write_word_le(Handle, Chunk.Taille) )
goto Erreur_sauvegarde_config;
if (!write_byte(Handle, Degrade_Courant))
@ -2091,9 +2090,9 @@ int Sauver_CFG(void)
}
// Sauvegarde de la matrice du Smooth
Chunk.Numero=CHUNK_SMOOTH;
Chunk.Number=CHUNK_SMOOTH;
Chunk.Taille=sizeof(Smooth_Matrice);
if (!write_byte(Handle, Chunk.Numero) ||
if (!write_byte(Handle, Chunk.Number) ||
!write_word_le(Handle, Chunk.Taille) )
goto Erreur_sauvegarde_config;
for (Indice=0; Indice<3; Indice++)
@ -2102,18 +2101,18 @@ int Sauver_CFG(void)
goto Erreur_sauvegarde_config;
// Sauvegarde des couleurs à exclure
Chunk.Numero=CHUNK_EXCLUDE_COLORS;
Chunk.Number=CHUNK_EXCLUDE_COLORS;
Chunk.Taille=sizeof(Exclude_color);
if (!write_byte(Handle, Chunk.Numero) ||
if (!write_byte(Handle, Chunk.Number) ||
!write_word_le(Handle, Chunk.Taille) )
goto Erreur_sauvegarde_config;
if (!write_bytes(Handle, Exclude_color, 256))
goto Erreur_sauvegarde_config;
// Sauvegarde des informations du Quick-shade
Chunk.Numero=CHUNK_QUICK_SHADE;
Chunk.Number=CHUNK_QUICK_SHADE;
Chunk.Taille=sizeof(Quick_shade_Step)+sizeof(Quick_shade_Loop);
if (!write_byte(Handle, Chunk.Numero) ||
if (!write_byte(Handle, Chunk.Number) ||
!write_word_le(Handle, Chunk.Taille) )
goto Erreur_sauvegarde_config;
if (!write_byte(Handle, Quick_shade_Step))
@ -2122,9 +2121,9 @@ int Sauver_CFG(void)
goto Erreur_sauvegarde_config;
// Sauvegarde des informations de la grille
Chunk.Numero=CHUNK_GRILLE;
Chunk.Number=CHUNK_GRILLE;
Chunk.Taille=8;
if (!write_byte(Handle, Chunk.Numero) ||
if (!write_byte(Handle, Chunk.Number) ||
!write_word_le(Handle, Chunk.Taille) )
goto Erreur_sauvegarde_config;
if (!write_word_le(Handle, Snap_Largeur))
@ -2193,7 +2192,7 @@ void Config_par_defaut(void)
Shade_Actuel=0;
for (Indice=0; Indice<8; Indice++)
{
Shade_Liste[Indice].Pas=1;
Shade_Liste[Indice].Step=1;
Shade_Liste[Indice].Mode=0;
for (Indice2=0; Indice2<512; Indice2++)
Shade_Liste[Indice].List[Indice2]=256;
@ -2204,7 +2203,7 @@ void Config_par_defaut(void)
Shade_Liste[0].List[Indice*17+Indice2]=Indice*16+Indice2+16;
Liste2tables(Shade_Liste[Shade_Actuel].List,
Shade_Liste[Shade_Actuel].Pas,
Shade_Liste[Shade_Actuel].Step,
Shade_Liste[Shade_Actuel].Mode,
Shade_Table_gauche,Shade_Table_droite);

View File

@ -660,11 +660,11 @@ int Get_input(void)
}
else
{
long Now;
long time_now;
Now=SDL_GetTicks();
time_now=SDL_GetTicks();
if (Now>Directional_last_move+Directional_delay)
if (time_now>Directional_last_move+Directional_delay)
{
// Speed parameters, acceleration etc. are here
if (Directional_delay==-1)
@ -678,7 +678,7 @@ int Get_input(void)
Directional_delay=Directional_delay*8/10;
else if (Directional_step<16*4)
Directional_step++;
Directional_last_move = Now;
Directional_last_move = time_now;
// Directional controller UP
if ((Directional_up||Directional_up_left||Directional_up_right) &&

20
io.c
View File

@ -171,35 +171,35 @@ int write_dword_be(FILE *file, dword dw)
// d:\Data\C\GFX2\grafx2/grafx2.exe
char * Position_dernier_slash(const char * Chaine)
{
const char * Position = NULL;
const char * position = NULL;
for (; *Chaine != '\0'; Chaine++)
if (*Chaine == SEPARATEUR_CHEMIN[0]
#ifdef __WIN32__
|| *Chaine == '/'
#endif
)
Position = Chaine;
return (char *)Position;
position = Chaine;
return (char *)position;
}
// Récupère la partie "nom de file seul" d'un chemin
void Extraire_nom_fichier(char *dest, const char *Source)
{
const char * Position = Position_dernier_slash(Source);
const char * position = Position_dernier_slash(Source);
if (Position)
strcpy(dest,Position+1);
if (position)
strcpy(dest,position+1);
else
strcpy(dest,Source);
}
// Récupère la partie "répertoire+/" d'un chemin.
void Extraire_chemin(char *dest, const char *Source)
{
char * Position;
char * position;
strcpy(dest,Source);
Position = Position_dernier_slash(dest);
if (Position)
*(Position+1) = '\0';
position = Position_dernier_slash(dest);
if (position)
*(position+1) = '\0';
else
strcat(dest, SEPARATEUR_CHEMIN);
}

File diff suppressed because it is too large Load Diff

View File

@ -19,9 +19,9 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
void Pixel_Chargement_dans_ecran_courant(word Pos_X,word Pos_Y,byte Couleur);
void Pixel_Chargement_dans_preview (word Pos_X,word Pos_Y,byte Couleur);
void Pixel_Chargement_dans_brosse (word Pos_X,word Pos_Y,byte Couleur);
void Pixel_Chargement_dans_ecran_courant(word x_pos,word y_pos,byte Couleur);
void Pixel_Chargement_dans_preview (word x_pos,word y_pos,byte Couleur);
void Pixel_Chargement_dans_brosse (word x_pos,word y_pos,byte Couleur);
void Nom_fichier_complet(char * Nom_du_fichier, byte Sauve_Colorix);

4
main.c
View File

@ -94,11 +94,11 @@ void Afficher_syntaxe(void)
// ---------------------------- Sortie impromptue ----------------------------
void Erreur_fonction(int error_code, const char *Nom_fichier, int Numero_ligne, const char *Nom_fonction)
void Erreur_fonction(int error_code, const char *filename, int Numero_ligne, const char *Nom_fonction)
{
T_Palette Palette_temporaire;
int Indice;
printf("Error number %d occured in file %s, line %d, function %s.\n", error_code, Nom_fichier,Numero_ligne,Nom_fonction);
printf("Error number %d occured in file %s, line %d, function %s.\n", error_code, filename,Numero_ligne,Nom_fonction);
if (error_code==0)
{

332
moteur.c
View File

@ -145,67 +145,67 @@ char * TITRE_BOUTON[NB_BOUTONS]=
"Hide tool bar "
};
// Sauvegarde un bloc (généralement l'arrière-plan d'une fenêtre)
void Sauve_fond(byte **Buffer, int Pos_X, int Pos_Y, int width, int height)
void Sauve_fond(byte **Buffer, int x_pos, int y_pos, int width, int height)
{
int Indice;
if(*Buffer != NULL) DEBUG("WARNING : Buffer already allocated !!!",0);
*Buffer=(byte *) malloc(width*Menu_Facteur_X*height*Menu_Facteur_Y*Pixel_width);
for (Indice=0; Indice<(height*Menu_Facteur_Y); Indice++)
Lire_ligne(Pos_X,Pos_Y+Indice,width*Menu_Facteur_X,(*Buffer)+((int)Indice*width*Menu_Facteur_X*Pixel_width));
Lire_ligne(x_pos,y_pos+Indice,width*Menu_Facteur_X,(*Buffer)+((int)Indice*width*Menu_Facteur_X*Pixel_width));
}
// Restaure de ce que la fenêtre cachait
void Restaure_fond(byte *Buffer, int Pos_X, int Pos_Y, int width, int height)
void Restaure_fond(byte *Buffer, int x_pos, int y_pos, int width, int height)
{
int Indice;
for (Indice=0; Indice<height*Menu_Facteur_Y; Indice++)
Afficher_ligne_fast(Pos_X,Pos_Y+Indice,width*Menu_Facteur_X,Buffer+((int)Indice*width*Menu_Facteur_X*Pixel_width));
Afficher_ligne_fast(x_pos,y_pos+Indice,width*Menu_Facteur_X,Buffer+((int)Indice*width*Menu_Facteur_X*Pixel_width));
free(Buffer);
}
// Ecrit un pixel dans un fond de fenêtre
void Pixel_fond(int Pos_X, int Pos_Y, byte Couleur)
void Pixel_fond(int x_pos, int y_pos, byte Couleur)
{
int Repetitions_X=Pixel_width;
while (Repetitions_X--)
(Fond_fenetre[0][Pos_X*Pixel_width+Repetitions_X+Pos_Y*Fenetre_Largeur*Pixel_width*Menu_Facteur_X])=Couleur;
(Fond_fenetre[0][x_pos*Pixel_width+Repetitions_X+y_pos*Fenetre_Largeur*Pixel_width*Menu_Facteur_X])=Couleur;
}
int Numero_bouton_sous_souris(void)
{
int Numero;
short Pos_X;
short Pos_Y;
int btn_number;
short x_pos;
short y_pos;
Pos_X=(Mouse_X )/Menu_Facteur_X;
Pos_Y=(Mouse_Y-Menu_Ordonnee)/Menu_Facteur_Y;
x_pos=(Mouse_X )/Menu_Facteur_X;
y_pos=(Mouse_Y-Menu_Ordonnee)/Menu_Facteur_Y;
for (Numero=0;Numero<NB_BOUTONS;Numero++)
for (btn_number=0;btn_number<NB_BOUTONS;btn_number++)
{
switch(Bouton[Numero].Shape)
switch(Bouton[btn_number].Shape)
{
case FORME_BOUTON_SANS_CADRE :
case FORME_BOUTON_RECTANGLE :
if ((Pos_X>=Bouton[Numero].Decalage_X) &&
(Pos_Y>=Bouton[Numero].Decalage_Y) &&
(Pos_X<=Bouton[Numero].Decalage_X+Bouton[Numero].Width) &&
(Pos_Y<=Bouton[Numero].Decalage_Y+Bouton[Numero].Height))
return Numero;
if ((x_pos>=Bouton[btn_number].Decalage_X) &&
(y_pos>=Bouton[btn_number].Decalage_Y) &&
(x_pos<=Bouton[btn_number].Decalage_X+Bouton[btn_number].Width) &&
(y_pos<=Bouton[btn_number].Decalage_Y+Bouton[btn_number].Height))
return btn_number;
break;
case FORME_BOUTON_TRIANGLE_HAUT_GAUCHE:
if ((Pos_X>=Bouton[Numero].Decalage_X) &&
(Pos_Y>=Bouton[Numero].Decalage_Y) &&
(Pos_X+Pos_Y-(short)Bouton[Numero].Decalage_Y-(short)Bouton[Numero].Decalage_X<=Bouton[Numero].Width))
return Numero;
if ((x_pos>=Bouton[btn_number].Decalage_X) &&
(y_pos>=Bouton[btn_number].Decalage_Y) &&
(x_pos+y_pos-(short)Bouton[btn_number].Decalage_Y-(short)Bouton[btn_number].Decalage_X<=Bouton[btn_number].Width))
return btn_number;
break;
case FORME_BOUTON_TRIANGLE_BAS_DROITE:
if ((Pos_X<=Bouton[Numero].Decalage_X+Bouton[Numero].Width) &&
(Pos_Y<=Bouton[Numero].Decalage_Y+Bouton[Numero].Height) &&
(Pos_X+Pos_Y-(short)Bouton[Numero].Decalage_Y-(short)Bouton[Numero].Decalage_X>=Bouton[Numero].Width))
return Numero;
if ((x_pos<=Bouton[btn_number].Decalage_X+Bouton[btn_number].Width) &&
(y_pos<=Bouton[btn_number].Decalage_Y+Bouton[btn_number].Height) &&
(x_pos+y_pos-(short)Bouton[btn_number].Decalage_Y-(short)Bouton[btn_number].Decalage_X>=Bouton[btn_number].Width))
return btn_number;
break;
}
}
@ -213,7 +213,7 @@ int Numero_bouton_sous_souris(void)
}
void Tracer_cadre_de_bouton_du_menu(byte Numero,byte pressed)
void Tracer_cadre_de_bouton_du_menu(byte btn_number,byte pressed)
{
byte Couleur_Haut_gauche;
byte Couleur_Bas_droite;
@ -222,13 +222,13 @@ void Tracer_cadre_de_bouton_du_menu(byte Numero,byte pressed)
word Debut_Y;
word Fin_X;
word Fin_Y;
word Pos_X;
word Pos_Y;
word x_pos;
word y_pos;
Debut_X=Bouton[Numero].Decalage_X;
Debut_Y=Bouton[Numero].Decalage_Y;
Fin_X =Debut_X+Bouton[Numero].Width;
Fin_Y =Debut_Y+Bouton[Numero].Height;
Debut_X=Bouton[btn_number].Decalage_X;
Debut_Y=Bouton[btn_number].Decalage_Y;
Fin_X =Debut_X+Bouton[btn_number].Width;
Fin_Y =Debut_Y+Bouton[btn_number].Height;
if (!pressed)
{
@ -243,7 +243,7 @@ void Tracer_cadre_de_bouton_du_menu(byte Numero,byte pressed)
Couleur_Diagonale=CM_Fonce;
}
switch(Bouton[Numero].Shape)
switch(Bouton[btn_number].Shape)
{
case FORME_BOUTON_SANS_CADRE :
break;
@ -255,25 +255,25 @@ void Tracer_cadre_de_bouton_du_menu(byte Numero,byte pressed)
Pixel_dans_menu(Debut_X,Fin_Y,Couleur_Diagonale);
BLOCK_MENU[Fin_Y][Debut_X]=Couleur_Diagonale;
// On colorie la partie haute
for (Pos_X=Debut_X;Pos_X<=Fin_X-1;Pos_X++)
for (x_pos=Debut_X;x_pos<=Fin_X-1;x_pos++)
{
Pixel_dans_menu(Pos_X,Debut_Y,Couleur_Haut_gauche);
BLOCK_MENU[Debut_Y][Pos_X]=Couleur_Haut_gauche;
Pixel_dans_menu(x_pos,Debut_Y,Couleur_Haut_gauche);
BLOCK_MENU[Debut_Y][x_pos]=Couleur_Haut_gauche;
}
for (Pos_Y=Debut_Y+1;Pos_Y<=Fin_Y-1;Pos_Y++)
for (y_pos=Debut_Y+1;y_pos<=Fin_Y-1;y_pos++)
{
// On colorie la partie gauche
Pixel_dans_menu(Debut_X,Pos_Y,Couleur_Haut_gauche);
BLOCK_MENU[Pos_Y][Debut_X]=Couleur_Haut_gauche;
Pixel_dans_menu(Debut_X,y_pos,Couleur_Haut_gauche);
BLOCK_MENU[y_pos][Debut_X]=Couleur_Haut_gauche;
// On colorie la partie droite
Pixel_dans_menu(Fin_X,Pos_Y,Couleur_Bas_droite);
BLOCK_MENU[Pos_Y][Fin_X]=Couleur_Bas_droite;
Pixel_dans_menu(Fin_X,y_pos,Couleur_Bas_droite);
BLOCK_MENU[y_pos][Fin_X]=Couleur_Bas_droite;
}
// On colorie la partie basse
for (Pos_X=Debut_X+1;Pos_X<=Fin_X;Pos_X++)
for (x_pos=Debut_X+1;x_pos<=Fin_X;x_pos++)
{
Pixel_dans_menu(Pos_X,Fin_Y,Couleur_Bas_droite);
BLOCK_MENU[Fin_Y][Pos_X]=Couleur_Bas_droite;
Pixel_dans_menu(x_pos,Fin_Y,Couleur_Bas_droite);
BLOCK_MENU[Fin_Y][x_pos]=Couleur_Bas_droite;
}
break;
case FORME_BOUTON_TRIANGLE_HAUT_GAUCHE:
@ -284,18 +284,18 @@ void Tracer_cadre_de_bouton_du_menu(byte Numero,byte pressed)
Pixel_dans_menu(Debut_X,Fin_Y,Couleur_Diagonale);
BLOCK_MENU[Fin_Y][Debut_X]=Couleur_Diagonale;
// On colorie le coin haut gauche
for (Pos_X=0;Pos_X<Bouton[Numero].Width;Pos_X++)
for (x_pos=0;x_pos<Bouton[btn_number].Width;x_pos++)
{
Pixel_dans_menu(Debut_X+Pos_X,Debut_Y,Couleur_Haut_gauche);
BLOCK_MENU[Debut_Y][Debut_X+Pos_X]=Couleur_Haut_gauche;
Pixel_dans_menu(Debut_X,Debut_Y+Pos_X,Couleur_Haut_gauche);
BLOCK_MENU[Debut_Y+Pos_X][Debut_X]=Couleur_Haut_gauche;
Pixel_dans_menu(Debut_X+x_pos,Debut_Y,Couleur_Haut_gauche);
BLOCK_MENU[Debut_Y][Debut_X+x_pos]=Couleur_Haut_gauche;
Pixel_dans_menu(Debut_X,Debut_Y+x_pos,Couleur_Haut_gauche);
BLOCK_MENU[Debut_Y+x_pos][Debut_X]=Couleur_Haut_gauche;
}
// On colorie la diagonale
for (Pos_X=1;Pos_X<Bouton[Numero].Width;Pos_X++)
for (x_pos=1;x_pos<Bouton[btn_number].Width;x_pos++)
{
Pixel_dans_menu(Debut_X+Pos_X,Fin_Y-Pos_X,Couleur_Bas_droite);
BLOCK_MENU[Fin_Y-Pos_X][Debut_X+Pos_X]=Couleur_Bas_droite;
Pixel_dans_menu(Debut_X+x_pos,Fin_Y-x_pos,Couleur_Bas_droite);
BLOCK_MENU[Fin_Y-x_pos][Debut_X+x_pos]=Couleur_Bas_droite;
}
break;
case FORME_BOUTON_TRIANGLE_BAS_DROITE:
@ -306,18 +306,18 @@ void Tracer_cadre_de_bouton_du_menu(byte Numero,byte pressed)
Pixel_dans_menu(Debut_X,Fin_Y,Couleur_Diagonale);
BLOCK_MENU[Fin_Y][Debut_X]=Couleur_Diagonale;
// On colorie la diagonale
for (Pos_X=1;Pos_X<Bouton[Numero].Width;Pos_X++)
for (x_pos=1;x_pos<Bouton[btn_number].Width;x_pos++)
{
Pixel_dans_menu(Debut_X+Pos_X,Fin_Y-Pos_X,Couleur_Haut_gauche);
BLOCK_MENU[Fin_Y-Pos_X][Debut_X+Pos_X]=Couleur_Haut_gauche;
Pixel_dans_menu(Debut_X+x_pos,Fin_Y-x_pos,Couleur_Haut_gauche);
BLOCK_MENU[Fin_Y-x_pos][Debut_X+x_pos]=Couleur_Haut_gauche;
}
// On colorie le coin bas droite
for (Pos_X=0;Pos_X<Bouton[Numero].Width;Pos_X++)
for (x_pos=0;x_pos<Bouton[btn_number].Width;x_pos++)
{
Pixel_dans_menu(Fin_X-Pos_X,Fin_Y,Couleur_Bas_droite);
BLOCK_MENU[Fin_Y][Fin_X-Pos_X]=Couleur_Bas_droite;
Pixel_dans_menu(Fin_X,Fin_Y-Pos_X,Couleur_Bas_droite);
BLOCK_MENU[Fin_Y-Pos_X][Fin_X]=Couleur_Bas_droite;
Pixel_dans_menu(Fin_X-x_pos,Fin_Y,Couleur_Bas_droite);
BLOCK_MENU[Fin_Y][Fin_X-x_pos]=Couleur_Bas_droite;
Pixel_dans_menu(Fin_X,Fin_Y-x_pos,Couleur_Bas_droite);
BLOCK_MENU[Fin_Y-x_pos][Fin_X]=Couleur_Bas_droite;
}
}
if (Menu_visible)
@ -332,22 +332,22 @@ void Tracer_cadre_de_bouton_du_menu(byte Numero,byte pressed)
//---------------------- Désenclenchement d'un bouton ------------------------
void Desenclencher_bouton(int Numero)
void Desenclencher_bouton(int btn_number)
{
if (Bouton[Numero].Enfonce)
if (Bouton[btn_number].Enfonce)
{
// On affiche le cadre autour du bouton de façon à ce qu'il paraisse relâché
Tracer_cadre_de_bouton_du_menu(Numero,BOUTON_RELACHE);
Tracer_cadre_de_bouton_du_menu(btn_number,BOUTON_RELACHE);
// On considère que le bouton est relâché
Bouton[Numero].Enfonce=BOUTON_RELACHE;
Bouton[btn_number].Enfonce=BOUTON_RELACHE;
// On appelle le désenclenchement particulier au bouton:
Bouton[Numero].Desenclencher();
Bouton[btn_number].Desenclencher();
}
}
//-Enclenchement d'un bouton (et désenclenchement de ceux de la même famille)-
void Enclencher_bouton(int Numero,byte click)
void Enclencher_bouton(int btn_number,byte click)
{
int family;
int b;
@ -357,7 +357,7 @@ void Enclencher_bouton(int Numero,byte click)
// Certains boutons ont deux icones
Icone=-1;
switch(Numero)
switch(btn_number)
{
case BOUTON_POLYGONES:
case BOUTON_POLYFILL:
@ -371,10 +371,10 @@ void Enclencher_bouton(int Numero,byte click)
Icone=16;break;
}
if (Icone!=-1)
Afficher_sprite_dans_menu(Numero,Icone+(click==A_DROITE));
Afficher_sprite_dans_menu(btn_number,Icone+(click==A_DROITE));
// On note déjà la famille du bouton (La "Famiglia" c'est sacré)
family=Bouton[Numero].Famille;
family=Bouton[btn_number].Famille;
switch (family)
{
@ -382,12 +382,12 @@ void Enclencher_bouton(int Numero,byte click)
break;
case FAMILLE_INTERRUPTION: // Petit cas spécial dans la famille "Interruption":
if ((Numero!=BOUTON_LOUPE) || (!Loupe_Mode))
if ((btn_number!=BOUTON_LOUPE) || (!Loupe_Mode))
// Pour chaque bouton:
for (b=0; b<NB_BOUTONS; b++)
// S'il est de la même famille
if (
(b!=Numero) &&
(b!=btn_number) &&
(Bouton[b].Famille==FAMILLE_INTERRUPTION) &&
( (b!=BOUTON_LOUPE) ||
((b==BOUTON_LOUPE) && (!Loupe_Mode)) )
@ -401,7 +401,7 @@ void Enclencher_bouton(int Numero,byte click)
// Pour chaque bouton:
for (b=0; b<NB_BOUTONS; b++)
// S'il est de la famille interruption
if ( (b!=Numero)
if ( (b!=btn_number)
&& (Bouton[b].Famille==FAMILLE_INTERRUPTION)
// Et que ce n'est pas la loupe, ou alors qu'on n'est pas en mode loupe
&& (!(Loupe_Mode && (b==BOUTON_LOUPE))) )
@ -410,14 +410,14 @@ void Enclencher_bouton(int Numero,byte click)
// Pour chaque bouton:
for (b=0; b<NB_BOUTONS; b++)
// S'il est de la même famille
if ( (b!=Numero)
if ( (b!=btn_number)
&& (Bouton[b].Famille==family) )
// Alors on désenclenche le bouton
Desenclencher_bouton(b);
}
// On affiche le cadre autour du bouton de façon à ce qu'il paraisse enfoncé
Tracer_cadre_de_bouton_du_menu(Numero,BOUTON_ENFONCE);
Tracer_cadre_de_bouton_du_menu(btn_number,BOUTON_ENFONCE);
Afficher_curseur();
@ -425,13 +425,13 @@ void Enclencher_bouton(int Numero,byte click)
Attendre_fin_de_click();
// On considère que le bouton est enfoncé
Bouton[Numero].Enfonce=BOUTON_ENFONCE;
Bouton[btn_number].Enfonce=BOUTON_ENFONCE;
// Puis on se contente d'appeler l'action correspondant au bouton:
if (click==1)
Bouton[Numero].Gauche();
Bouton[btn_number].Gauche();
else
Bouton[Numero].Droite();
Bouton[btn_number].Droite();
}
@ -996,7 +996,7 @@ void Gestion_principale(void)
{
Effacer_curseur();
strcpy(Chaine,TITRE_BOUTON[Indice_bouton]);
sprintf(Chaine+strlen(Chaine),"%d (%d,%d,%d)",Couleur,Principal_Palette[Couleur].R,Principal_Palette[Couleur].V,Principal_Palette[Couleur].B);
sprintf(Chaine+strlen(Chaine),"%d (%d,%d,%d)",Couleur,Principal_Palette[Couleur].R,Principal_Palette[Couleur].G,Principal_Palette[Couleur].B);
for (Temp=strlen(Chaine); Temp<24; Temp++)
Chaine[Temp]=' ';
Chaine[24]=0;
@ -1234,7 +1234,7 @@ void Fermer_fenetre(void)
//---------------- Dessiner un bouton normal dans une fenêtre ----------------
void Fenetre_Dessiner_bouton_normal(word Pos_X,word Pos_Y,word width,word height,
void Fenetre_Dessiner_bouton_normal(word x_pos,word y_pos,word width,word height,
char * Titre,byte Lettre_soulignee,byte clickable)
{
byte Couleur_titre;
@ -1242,19 +1242,19 @@ void Fenetre_Dessiner_bouton_normal(word Pos_X,word Pos_Y,word width,word height
if (clickable)
{
Fenetre_Afficher_cadre_bombe(Pos_X,Pos_Y,width,height);
Fenetre_Afficher_cadre_general(Pos_X-1,Pos_Y-1,width+2,height+2,CM_Noir,CM_Noir,CM_Fonce,CM_Fonce,CM_Fonce);
Fenetre_Afficher_cadre_bombe(x_pos,y_pos,width,height);
Fenetre_Afficher_cadre_general(x_pos-1,y_pos-1,width+2,height+2,CM_Noir,CM_Noir,CM_Fonce,CM_Fonce,CM_Fonce);
Couleur_titre=CM_Noir;
}
else
{
Fenetre_Afficher_cadre_bombe(Pos_X,Pos_Y,width,height);
Fenetre_Afficher_cadre_mono(Pos_X-1,Pos_Y-1,width+2,height+2,CM_Clair);
Fenetre_Afficher_cadre_bombe(x_pos,y_pos,width,height);
Fenetre_Afficher_cadre_mono(x_pos-1,y_pos-1,width+2,height+2,CM_Clair);
Couleur_titre=CM_Fonce;
}
Pos_texte_X=Pos_X+( (width-(strlen(Titre)<<3)+1) >>1 );
Pos_texte_Y=Pos_Y+((height-7)>>1);
Pos_texte_X=x_pos+( (width-(strlen(Titre)<<3)+1) >>1 );
Pos_texte_Y=y_pos+((height-7)>>1);
Print_dans_fenetre(Pos_texte_X,Pos_texte_Y,Titre,Couleur_titre,CM_Clair);
if (Lettre_soulignee)
@ -1265,29 +1265,29 @@ void Fenetre_Dessiner_bouton_normal(word Pos_X,word Pos_Y,word width,word height
// -- Bouton normal enfoncé dans la fenêtre --
void Fenetre_Enfoncer_bouton_normal(word Pos_X,word Pos_Y,word width,word height)
void Fenetre_Enfoncer_bouton_normal(word x_pos,word y_pos,word width,word height)
{
Fenetre_Afficher_cadre_general(Pos_X,Pos_Y,width,height,CM_Fonce,CM_Noir,CM_Fonce,CM_Fonce,CM_Noir);
UpdateRect(Fenetre_Pos_X+Pos_X*Menu_Facteur_X, Fenetre_Pos_Y+Pos_Y*Menu_Facteur_Y, width*Menu_Facteur_X, height*Menu_Facteur_Y);
Fenetre_Afficher_cadre_general(x_pos,y_pos,width,height,CM_Fonce,CM_Noir,CM_Fonce,CM_Fonce,CM_Noir);
UpdateRect(Fenetre_Pos_X+x_pos*Menu_Facteur_X, Fenetre_Pos_Y+y_pos*Menu_Facteur_Y, width*Menu_Facteur_X, height*Menu_Facteur_Y);
}
// -- Bouton normal désenfoncé dans la fenêtre --
void Fenetre_Desenfoncer_bouton_normal(word Pos_X,word Pos_Y,word width,word height)
void Fenetre_Desenfoncer_bouton_normal(word x_pos,word y_pos,word width,word height)
{
Fenetre_Afficher_cadre_bombe(Pos_X,Pos_Y,width,height);
UpdateRect(Fenetre_Pos_X+Pos_X*Menu_Facteur_X, Fenetre_Pos_Y+Pos_Y*Menu_Facteur_Y, width*Menu_Facteur_X, height*Menu_Facteur_Y);
Fenetre_Afficher_cadre_bombe(x_pos,y_pos,width,height);
UpdateRect(Fenetre_Pos_X+x_pos*Menu_Facteur_X, Fenetre_Pos_Y+y_pos*Menu_Facteur_Y, width*Menu_Facteur_X, height*Menu_Facteur_Y);
}
//--------------- Dessiner un bouton palette dans une fenêtre ----------------
void Fenetre_Dessiner_bouton_palette(word Pos_X,word Pos_Y)
void Fenetre_Dessiner_bouton_palette(word x_pos,word y_pos)
{
word Couleur;
for (Couleur=0; Couleur<=255; Couleur++)
Block( Fenetre_Pos_X+((((Couleur >> 4)*10)+Pos_X+6)*Menu_Facteur_X),Fenetre_Pos_Y+((((Couleur & 15)*5)+Pos_Y+3)*Menu_Facteur_Y),Menu_Facteur_X*5,Menu_Facteur_Y*5,Couleur);
Block( Fenetre_Pos_X+((((Couleur >> 4)*10)+x_pos+6)*Menu_Facteur_X),Fenetre_Pos_Y+((((Couleur & 15)*5)+y_pos+3)*Menu_Facteur_Y),Menu_Facteur_X*5,Menu_Facteur_Y*5,Couleur);
Fenetre_Afficher_cadre(Pos_X,Pos_Y,164,86);
Fenetre_Afficher_cadre(x_pos,y_pos,164,86);
}
@ -1297,13 +1297,13 @@ void Fenetre_Effacer_tags(void)
{
word Origine_X;
word Origine_Y;
word Pos_X;
word x_pos;
word Pos_fenetre_X;
//word Pos_fenetre_Y;
Origine_X=Fenetre_Pos_X+(Fenetre_Liste_boutons_palette->Pos_X+3)*Menu_Facteur_X;
Origine_Y=Fenetre_Pos_Y+(Fenetre_Liste_boutons_palette->Pos_Y+3)*Menu_Facteur_Y;
for (Pos_X=0,Pos_fenetre_X=Origine_X;Pos_X<16;Pos_X++,Pos_fenetre_X+=(Menu_Facteur_X*10))
for (x_pos=0,Pos_fenetre_X=Origine_X;x_pos<16;x_pos++,Pos_fenetre_X+=(Menu_Facteur_X*10))
Block(Pos_fenetre_X,Origine_Y,Menu_Facteur_X*3,Menu_Facteur_Y*80,CM_Clair);
UpdateRect(Origine_X,Origine_Y,ToWinL(160),ToWinH(80));
}
@ -1314,8 +1314,8 @@ void Tagger_intervalle_palette(byte start,byte end)
{
word Origine_X;
word Origine_Y;
//word Pos_X;
word Pos_Y;
//word x_pos;
word y_pos;
//word Pos_fenetre_X;
word Pos_fenetre_Y;
word Indice;
@ -1334,9 +1334,9 @@ void Tagger_intervalle_palette(byte start,byte end)
// On affiche le 1er TAG
Origine_X=(Fenetre_Liste_boutons_palette->Pos_X+3)+(start>>4)*10;
Origine_Y=(Fenetre_Liste_boutons_palette->Pos_Y+3)+(start&15)* 5;
for (Pos_Y=0,Pos_fenetre_Y=Origine_Y ;Pos_Y<5;Pos_Y++,Pos_fenetre_Y++)
for (y_pos=0,Pos_fenetre_Y=Origine_Y ;y_pos<5;y_pos++,Pos_fenetre_Y++)
Pixel_dans_fenetre(Origine_X ,Pos_fenetre_Y,CM_Noir);
for (Pos_Y=0,Pos_fenetre_Y=Origine_Y+1;Pos_Y<3;Pos_Y++,Pos_fenetre_Y++)
for (y_pos=0,Pos_fenetre_Y=Origine_Y+1;y_pos<3;y_pos++,Pos_fenetre_Y++)
Pixel_dans_fenetre(Origine_X+1,Pos_fenetre_Y,CM_Noir);
Pixel_dans_fenetre(Origine_X+2,Origine_Y+2,CM_Noir);
@ -1348,9 +1348,9 @@ void Tagger_intervalle_palette(byte start,byte end)
// On affiche le 2ème TAG
Origine_X=(Fenetre_Liste_boutons_palette->Pos_X+3)+(end>>4)*10;
Origine_Y=(Fenetre_Liste_boutons_palette->Pos_Y+3)+(end&15)* 5;
for (Pos_Y=0,Pos_fenetre_Y=Origine_Y; Pos_Y<5; Pos_Y++,Pos_fenetre_Y++)
for (y_pos=0,Pos_fenetre_Y=Origine_Y; y_pos<5; y_pos++,Pos_fenetre_Y++)
Pixel_dans_fenetre(Origine_X ,Pos_fenetre_Y,CM_Noir);
for (Pos_Y=0,Pos_fenetre_Y=Origine_Y; Pos_Y<4; Pos_Y++,Pos_fenetre_Y++)
for (y_pos=0,Pos_fenetre_Y=Origine_Y; y_pos<4; y_pos++,Pos_fenetre_Y++)
Pixel_dans_fenetre(Origine_X+1,Pos_fenetre_Y,CM_Noir);
Pixel_dans_fenetre(Origine_X+2,Origine_Y+2,CM_Noir);
@ -1426,9 +1426,9 @@ void Fenetre_Dessiner_bouton_scroller(T_Bouton_scroller * button)
//--------------- Dessiner une zone de saisie dans une fenêtre ---------------
void Fenetre_Dessiner_bouton_saisie(word Pos_X,word Pos_Y,word Largeur_en_caracteres)
void Fenetre_Dessiner_bouton_saisie(word x_pos,word y_pos,word Largeur_en_caracteres)
{
Fenetre_Afficher_cadre_creux(Pos_X,Pos_Y,(Largeur_en_caracteres<<3)+3,11);
Fenetre_Afficher_cadre_creux(x_pos,y_pos,(Largeur_en_caracteres<<3)+3,11);
}
@ -1450,7 +1450,7 @@ void Fenetre_Effacer_bouton_saisie(T_Bouton_special * button)
//------ Rajout d'un bouton à la liste de ceux présents dans la fenêtre ------
T_Bouton_normal * Fenetre_Definir_bouton_normal(word Pos_X, word Pos_Y,
T_Bouton_normal * Fenetre_Definir_bouton_normal(word x_pos, word y_pos,
word width, word height,
char * Titre, byte Lettre_soulignee,
byte clickable, word Raccourci)
@ -1462,9 +1462,9 @@ T_Bouton_normal * Fenetre_Definir_bouton_normal(word Pos_X, word Pos_Y,
if (clickable)
{
Temp=(T_Bouton_normal *)malloc(sizeof(T_Bouton_normal));
Temp->Numero =Nb_boutons_fenetre;
Temp->Pos_X =Pos_X;
Temp->Pos_Y =Pos_Y;
Temp->Number =Nb_boutons_fenetre;
Temp->Pos_X =x_pos;
Temp->Pos_Y =y_pos;
Temp->Width =width;
Temp->Height =height;
Temp->Raccourci=Raccourci;
@ -1474,12 +1474,12 @@ T_Bouton_normal * Fenetre_Definir_bouton_normal(word Pos_X, word Pos_Y,
Fenetre_Liste_boutons_normal=Temp;
}
Fenetre_Dessiner_bouton_normal(Pos_X,Pos_Y,width,height,Titre,Lettre_soulignee,clickable);
Fenetre_Dessiner_bouton_normal(x_pos,y_pos,width,height,Titre,Lettre_soulignee,clickable);
return Temp;
}
//------ Rajout d'un bouton à la liste de ceux présents dans la fenêtre ------
T_Bouton_normal * Fenetre_Definir_bouton_repetable(word Pos_X, word Pos_Y,
T_Bouton_normal * Fenetre_Definir_bouton_repetable(word x_pos, word y_pos,
word width, word height,
char * Titre, byte Lettre_soulignee,
byte clickable, word Raccourci)
@ -1491,9 +1491,9 @@ T_Bouton_normal * Fenetre_Definir_bouton_repetable(word Pos_X, word Pos_Y,
if (clickable)
{
Temp=(T_Bouton_normal *)malloc(sizeof(T_Bouton_normal));
Temp->Numero =Nb_boutons_fenetre;
Temp->Pos_X =Pos_X;
Temp->Pos_Y =Pos_Y;
Temp->Number =Nb_boutons_fenetre;
Temp->Pos_X =x_pos;
Temp->Pos_Y =y_pos;
Temp->Width =width;
Temp->Height =height;
Temp->Raccourci=Raccourci;
@ -1503,28 +1503,28 @@ T_Bouton_normal * Fenetre_Definir_bouton_repetable(word Pos_X, word Pos_Y,
Fenetre_Liste_boutons_normal=Temp;
}
Fenetre_Dessiner_bouton_normal(Pos_X,Pos_Y,width,height,Titre,Lettre_soulignee,clickable);
Fenetre_Dessiner_bouton_normal(x_pos,y_pos,width,height,Titre,Lettre_soulignee,clickable);
return Temp;
}
T_Bouton_palette * Fenetre_Definir_bouton_palette(word Pos_X, word Pos_Y)
T_Bouton_palette * Fenetre_Definir_bouton_palette(word x_pos, word y_pos)
{
T_Bouton_palette * Temp;
Temp=(T_Bouton_palette *)malloc(sizeof(T_Bouton_palette));
Temp->Numero =++Nb_boutons_fenetre;
Temp->Pos_X =Pos_X;
Temp->Pos_Y =Pos_Y;
Temp->Number =++Nb_boutons_fenetre;
Temp->Pos_X =x_pos;
Temp->Pos_Y =y_pos;
Temp->Next=Fenetre_Liste_boutons_palette;
Fenetre_Liste_boutons_palette=Temp;
Fenetre_Dessiner_bouton_palette(Pos_X,Pos_Y);
Fenetre_Dessiner_bouton_palette(x_pos,y_pos);
return Temp;
}
T_Bouton_scroller * Fenetre_Definir_bouton_scroller(word Pos_X, word Pos_Y,
T_Bouton_scroller * Fenetre_Definir_bouton_scroller(word x_pos, word y_pos,
word height,
word nb_elements,
word nb_elements_visible,
@ -1533,9 +1533,9 @@ T_Bouton_scroller * Fenetre_Definir_bouton_scroller(word Pos_X, word Pos_Y,
T_Bouton_scroller * Temp;
Temp=(T_Bouton_scroller *)malloc(sizeof(T_Bouton_scroller));
Temp->Numero =++Nb_boutons_fenetre;
Temp->Pos_X =Pos_X;
Temp->Pos_Y =Pos_Y;
Temp->Number =++Nb_boutons_fenetre;
Temp->Pos_X =x_pos;
Temp->Pos_Y =y_pos;
Temp->Height =height;
Temp->Nb_elements =nb_elements;
Temp->Nb_visibles =nb_elements_visible;
@ -1550,14 +1550,14 @@ T_Bouton_scroller * Fenetre_Definir_bouton_scroller(word Pos_X, word Pos_Y,
}
T_Bouton_special * Fenetre_Definir_bouton_special(word Pos_X,word Pos_Y,word width,word height)
T_Bouton_special * Fenetre_Definir_bouton_special(word x_pos,word y_pos,word width,word height)
{
T_Bouton_special * Temp;
Temp=(T_Bouton_special *)malloc(sizeof(T_Bouton_special));
Temp->Numero =++Nb_boutons_fenetre;
Temp->Pos_X =Pos_X;
Temp->Pos_Y =Pos_Y;
Temp->Number =++Nb_boutons_fenetre;
Temp->Pos_X =x_pos;
Temp->Pos_Y =y_pos;
Temp->Width =width;
Temp->Height =height;
@ -1567,22 +1567,22 @@ T_Bouton_special * Fenetre_Definir_bouton_special(word Pos_X,word Pos_Y,word wid
}
T_Bouton_special * Fenetre_Definir_bouton_saisie(word Pos_X,word Pos_Y,word Largeur_en_caracteres)
T_Bouton_special * Fenetre_Definir_bouton_saisie(word x_pos,word y_pos,word Largeur_en_caracteres)
{
T_Bouton_special *Temp;
Temp=Fenetre_Definir_bouton_special(Pos_X,Pos_Y,(Largeur_en_caracteres<<3)+3,11);
Fenetre_Dessiner_bouton_saisie(Pos_X,Pos_Y,Largeur_en_caracteres);
Temp=Fenetre_Definir_bouton_special(x_pos,y_pos,(Largeur_en_caracteres<<3)+3,11);
Fenetre_Dessiner_bouton_saisie(x_pos,y_pos,Largeur_en_caracteres);
return Temp;
}
T_Bouton_dropdown * Fenetre_Definir_bouton_dropdown(word Pos_X,word Pos_Y,word width,word height,word dropdown_width,char *label,byte display_choice,byte display_centered,byte display_arrow,byte active_button)
T_Bouton_dropdown * Fenetre_Definir_bouton_dropdown(word x_pos,word y_pos,word width,word height,word dropdown_width,char *label,byte display_choice,byte display_centered,byte display_arrow,byte active_button)
{
T_Bouton_dropdown *Temp;
Temp=(T_Bouton_dropdown *)malloc(sizeof(T_Bouton_dropdown));
Temp->Numero =++Nb_boutons_fenetre;
Temp->Pos_X =Pos_X;
Temp->Pos_Y =Pos_Y;
Temp->Number =++Nb_boutons_fenetre;
Temp->Pos_X =x_pos;
Temp->Pos_Y =y_pos;
Temp->Width =width;
Temp->Height =height;
Temp->Affiche_choix =display_choice;
@ -1594,7 +1594,7 @@ T_Bouton_dropdown * Fenetre_Definir_bouton_dropdown(word Pos_X,word Pos_Y,word w
Temp->Next=Fenetre_Liste_boutons_dropdown;
Fenetre_Liste_boutons_dropdown=Temp;
Fenetre_Dessiner_bouton_normal(Pos_X,Pos_Y,width,height,"",-1,1);
Fenetre_Dessiner_bouton_normal(x_pos,y_pos,width,height,"",-1,1);
if (label && label[0])
Print_dans_fenetre(Temp->Pos_X+2,Temp->Pos_Y+(Temp->Height-7)/2,label,CM_Noir,CM_Clair);
if (display_arrow)
@ -1606,13 +1606,13 @@ T_Bouton_dropdown * Fenetre_Definir_bouton_dropdown(word Pos_X,word Pos_Y,word w
// Ajoute un choix à une dropdown. Le libellé est seulement référencé,
// il doit pointer sur une zone qui doit être encore valide à la fermeture
// de la fenêtre (comprise).
void Fenetre_Dropdown_choix(T_Bouton_dropdown * dropdown, word Numero, const char *label)
void Fenetre_Dropdown_choix(T_Bouton_dropdown * dropdown, word btn_number, const char *label)
{
T_Dropdown_choix *Temp;
T_Dropdown_choix *last;
Temp=(T_Dropdown_choix *)malloc(sizeof(T_Dropdown_choix));
Temp->Numero =Numero;
Temp->Number =btn_number;
Temp->Label=label;
Temp->Next=NULL;
@ -1644,7 +1644,7 @@ void Fenetre_Dropdown_vider_choix(T_Bouton_dropdown * dropdown)
//----------------------- Ouverture d'un pop-up -----------------------
void Ouvrir_popup(word Pos_X, word Pos_Y, word width,word height)
void Ouvrir_popup(word x_pos, word y_pos, word width,word height)
// Lors de l'appel à cette procédure, la souris doit être affichée.
// En sortie de cette procedure, la souris est effacée.
@ -1658,8 +1658,8 @@ void Ouvrir_popup(word Pos_X, word Pos_Y, word width,word height)
Fenetre_Largeur=width;
Fenetre_Hauteur=height;
Fenetre_Pos_X=Pos_X;
Fenetre_Pos_Y=Pos_Y;
Fenetre_Pos_X=x_pos;
Fenetre_Pos_Y=y_pos;
// Sauvegarde de ce que la fenêtre remplace
Sauve_fond(&(Fond_fenetre[Fenetre-1]), Fenetre_Pos_X, Fenetre_Pos_Y, width, height);
@ -1784,15 +1784,15 @@ void Fermer_popup(void)
// -- Indique si on a cliqué dans une zone définie par deux points extremes --
byte Fenetre_click_dans_zone(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y)
{
short Pos_X,Pos_Y;
short x_pos,y_pos;
Pos_X=((short)Mouse_X-Fenetre_Pos_X)/Menu_Facteur_X;
Pos_Y=((short)Mouse_Y-Fenetre_Pos_Y)/Menu_Facteur_Y;
x_pos=((short)Mouse_X-Fenetre_Pos_X)/Menu_Facteur_X;
y_pos=((short)Mouse_Y-Fenetre_Pos_Y)/Menu_Facteur_Y;
return ((Pos_X>=Debut_X) &&
(Pos_Y>=Debut_Y) &&
(Pos_X<=Fin_X) &&
(Pos_Y<=Fin_Y));
return ((x_pos>=Debut_X) &&
(y_pos>=Debut_Y) &&
(x_pos<=Fin_X) &&
(y_pos<=Fin_Y));
}
@ -1920,7 +1920,7 @@ void Recuperer_couleur_derriere_fenetre(byte * Couleur, byte * click)
strcat(Chaine," (");
sprintf(Chaine+strlen(Chaine),"%d",Principal_Palette[a].R);
strcat(Chaine,",");
sprintf(Chaine+strlen(Chaine),"%d",Principal_Palette[a].V);
sprintf(Chaine+strlen(Chaine),"%d",Principal_Palette[a].G);
strcat(Chaine,",");
sprintf(Chaine+strlen(Chaine),"%d",Principal_Palette[a].B);
strcat(Chaine,")");
@ -2220,13 +2220,13 @@ short Fenetre_Dropdown_click(T_Bouton_dropdown *Bouton)
{
for(Choix=Bouton->Premier_choix; Indice_selectionne; Choix=Choix->Next,Indice_selectionne--)
;
Fenetre_Attribut2=Choix->Numero;
Fenetre_Attribut2=Choix->Number;
if (Bouton->Affiche_choix)
{
// Mettre à jour automatiquement le libellé de la dropdown
Print_dans_fenetre(Bouton->Pos_X+2,Bouton->Pos_Y+(Bouton->Height-7)/2,Choix->Label,CM_Noir,CM_Clair);
}
return Bouton->Numero;
return Bouton->Number;
}
Fenetre_Attribut2=-1;
return 0;
@ -2235,29 +2235,29 @@ short Fenetre_Dropdown_click(T_Bouton_dropdown *Bouton)
// --- Fonction de clic sur un bouton a peu près ordinaire:
// Attend que l'on relache le bouton, et renvoie le numero du bouton si on
// est resté dessus, 0 si on a annulé en sortant du bouton.
short Fenetre_bouton_normal_click(word Pos_X, word Pos_Y, word width, word height, short Numero)
short Fenetre_bouton_normal_click(word x_pos, word y_pos, word width, word height, short btn_number)
{
while(1)
{
Effacer_curseur();
Fenetre_Enfoncer_bouton_normal(Pos_X,Pos_Y,width,height);
Fenetre_Enfoncer_bouton_normal(x_pos,y_pos,width,height);
Afficher_curseur();
while (Fenetre_click_dans_zone(Pos_X,Pos_Y,Pos_X+width-1,Pos_Y+height-1))
while (Fenetre_click_dans_zone(x_pos,y_pos,x_pos+width-1,y_pos+height-1))
{
if(!Get_input())
Wait_VBL();
if (!Mouse_K)
{
Effacer_curseur();
Fenetre_Desenfoncer_bouton_normal(Pos_X,Pos_Y,width,height);
Fenetre_Desenfoncer_bouton_normal(x_pos,y_pos,width,height);
Afficher_curseur();
return Numero;
return btn_number;
}
}
Effacer_curseur();
Fenetre_Desenfoncer_bouton_normal(Pos_X,Pos_Y,width,height);
Fenetre_Desenfoncer_bouton_normal(x_pos,y_pos,width,height);
Afficher_curseur();
while (!(Fenetre_click_dans_zone(Pos_X,Pos_Y,Pos_X+width-1,Pos_Y+height-1)))
while (!(Fenetre_click_dans_zone(x_pos,y_pos,x_pos+width-1,y_pos+height-1)))
{
if(!Get_input())
Wait_VBL();
@ -2294,9 +2294,9 @@ short Fenetre_Numero_bouton_clicke(void)
Effacer_curseur();
Fenetre_Desenfoncer_bouton_normal(Temp1->Pos_X,Temp1->Pos_Y,Temp1->Width,Temp1->Height);
Afficher_curseur();
return Temp1->Numero;
return Temp1->Number;
}
return Fenetre_bouton_normal_click(Temp1->Pos_X,Temp1->Pos_Y,Temp1->Width,Temp1->Height,Temp1->Numero);
return Fenetre_bouton_normal_click(Temp1->Pos_X,Temp1->Pos_Y,Temp1->Width,Temp1->Height,Temp1->Number);
}
}
@ -2308,7 +2308,7 @@ short Fenetre_Numero_bouton_clicke(void)
// On stocke dans Attribut2 le numero de couleur cliqué
Fenetre_Attribut2 = (((Mouse_X-Fenetre_Pos_X)/Menu_Facteur_X)-(Temp2->Pos_X+2)) / 10 * 16 +
(((Mouse_Y-Fenetre_Pos_Y)/Menu_Facteur_Y)-(Temp2->Pos_Y+3)) / 5;
return Temp2->Numero;
return Temp2->Number;
}
}
@ -2413,7 +2413,7 @@ short Fenetre_Numero_bouton_clicke(void)
// des 3 parties importantes de la jauge
Fenetre_Attribut1=0;
return (Fenetre_Attribut1)? Temp3->Numero : 0;
return (Fenetre_Attribut1)? Temp3->Number : 0;
}
}
@ -2421,7 +2421,7 @@ short Fenetre_Numero_bouton_clicke(void)
for (Temp4=Fenetre_Liste_boutons_special; Temp4; Temp4=Temp4->Next)
{
if (Fenetre_click_dans_zone(Temp4->Pos_X,Temp4->Pos_Y,Temp4->Pos_X+Temp4->Width-1,Temp4->Pos_Y+Temp4->Height-1))
return Temp4->Numero;
return Temp4->Number;
}
// Test du click sur une dropdown
@ -2434,7 +2434,7 @@ short Fenetre_Numero_bouton_clicke(void)
else
{
Fenetre_Attribut2=-1;
return Fenetre_bouton_normal_click(Temp5->Pos_X,Temp5->Pos_Y,Temp5->Width,Temp5->Height,Temp5->Numero);
return Fenetre_bouton_normal_click(Temp5->Pos_X,Temp5->Pos_Y,Temp5->Width,Temp5->Height,Temp5->Number);
}
}
}
@ -2468,7 +2468,7 @@ short Fenetre_Numero_bouton_touche(void)
Fenetre_Desenfoncer_bouton_normal(Temp->Pos_X,Temp->Pos_Y,Temp->Width,Temp->Height);
Afficher_curseur();
return Temp->Numero;
return Temp->Number;
}
Temp=Temp->Next;
}
@ -2482,7 +2482,7 @@ short Fenetre_Numero_bouton_touche(void)
while (Temp!=NULL)
{
if (Temp->Raccourci==(Touche&0x0FFF))
return Temp->Numero;
return Temp->Number;
Temp=Temp->Next;
}
}

View File

@ -20,22 +20,22 @@
*/
void Gestion_principale (void);
void Tracer_cadre_de_bouton_du_menu(byte Numero,byte Enfonce);
void Desenclencher_bouton (int Numero);
void Enclencher_bouton (int Numero,byte click);
void Tracer_cadre_de_bouton_du_menu(byte btn_number,byte Enfonce);
void Desenclencher_bouton (int btn_number);
void Enclencher_bouton (int btn_number,byte click);
void Annuler_les_effets (void);
void Restaurer_les_effets (void);
void Ouvrir_fenetre (word width,word height, char * Titre);
void Fermer_fenetre (void);
void Ouvrir_popup (word Pos_X, word Pos_Y, word width, word height);
void Ouvrir_popup (word x_pos, word y_pos, word width, word height);
void Fermer_popup (void);
void Fenetre_Dessiner_bouton_normal(word Pos_X,word Pos_Y,word width,word height,
void Fenetre_Dessiner_bouton_normal(word x_pos,word y_pos,word width,word height,
char * Titre,byte Lettre_soulignee,byte clickable);
void Fenetre_Enfoncer_bouton_normal(word Pos_X,word Pos_Y,word width,word height);
void Fenetre_Desenfoncer_bouton_normal(word Pos_X,word Pos_Y,word width,word height);
void Fenetre_Dessiner_bouton_palette(word Pos_X,word Pos_Y);
void Fenetre_Enfoncer_bouton_normal(word x_pos,word y_pos,word width,word height);
void Fenetre_Desenfoncer_bouton_normal(word x_pos,word y_pos,word width,word height);
void Fenetre_Dessiner_bouton_palette(word x_pos,word y_pos);
void Calculer_hauteur_curseur_jauge(T_Bouton_scroller * button);
void Fenetre_Dessiner_jauge(T_Bouton_scroller * button);
@ -43,30 +43,30 @@ void Fenetre_Dessiner_bouton_scroller(T_Bouton_scroller * button);
void Fenetre_Contenu_bouton_saisie(T_Bouton_special * button, char * content);
void Fenetre_Effacer_bouton_saisie(T_Bouton_special * button);
void Fenetre_Dessiner_bouton_saisie(word Pos_X,word Pos_Y,word Largeur_en_caracteres);
void Fenetre_Dessiner_bouton_saisie(word x_pos,word y_pos,word Largeur_en_caracteres);
T_Bouton_normal * Fenetre_Definir_bouton_normal(word Pos_X, word Pos_Y,
T_Bouton_normal * Fenetre_Definir_bouton_normal(word x_pos, word y_pos,
word width, word height,
char * Titre,byte Lettre_soulignee,
byte clickable, word Raccourci);
T_Bouton_normal * Fenetre_Definir_bouton_repetable(word Pos_X, word Pos_Y,
T_Bouton_normal * Fenetre_Definir_bouton_repetable(word x_pos, word y_pos,
word width, word height,
char * Titre,byte Lettre_soulignee,
byte clickable, word Raccourci);
T_Bouton_palette * Fenetre_Definir_bouton_palette(word Pos_X, word Pos_Y);
T_Bouton_palette * Fenetre_Definir_bouton_palette(word x_pos, word y_pos);
void Fenetre_Effacer_tags(void);
void Tagger_intervalle_palette(byte start,byte end);
T_Bouton_scroller * Fenetre_Definir_bouton_scroller(word Pos_X, word Pos_Y,
T_Bouton_scroller * Fenetre_Definir_bouton_scroller(word x_pos, word y_pos,
word height,
word nb_elements,
word nb_elements_visible,
word Position_initiale);
T_Bouton_special * Fenetre_Definir_bouton_special(word Pos_X,word Pos_Y,word width,word height);
T_Bouton_special * Fenetre_Definir_bouton_saisie(word Pos_X,word Pos_Y,word Largeur_en_caracteres);
T_Bouton_dropdown * Fenetre_Definir_bouton_dropdown(word Pos_X,word Pos_Y,word width,word height,word dropdown_width,char *label,byte display_choice,byte display_centered,byte display_arrow,byte active_button);
void Fenetre_Dropdown_choix(T_Bouton_dropdown * dropdown, word Numero, const char *label);
T_Bouton_special * Fenetre_Definir_bouton_special(word x_pos,word y_pos,word width,word height);
T_Bouton_special * Fenetre_Definir_bouton_saisie(word x_pos,word y_pos,word Largeur_en_caracteres);
T_Bouton_dropdown * Fenetre_Definir_bouton_dropdown(word x_pos,word y_pos,word width,word height,word dropdown_width,char *label,byte display_choice,byte display_centered,byte display_arrow,byte active_button);
void Fenetre_Dropdown_choix(T_Bouton_dropdown * dropdown, word btn_number, const char *label);
void Fenetre_Dropdown_vider_choix(T_Bouton_dropdown * dropdown);
byte Fenetre_click_dans_zone(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y);
short Attendre_click_dans_palette(T_Bouton_palette * button);
@ -76,4 +76,4 @@ short Fenetre_Bouton_clicke(void);
int Numero_bouton_sous_souris(void);
short Fenetre_Numero_bouton_clicke(void);
void Remappe_fond_fenetres(byte * Table_de_conversion, int Min_Y, int Max_Y);
void Pixel_fond(int Pos_X, int Pos_Y, byte Couleur);
void Pixel_fond(int x_pos, int y_pos, byte Couleur);

180
op_c.c
View File

@ -214,26 +214,26 @@ void TC_Delete(Table_conversion * t)
free(t);
}
byte TC_Get(Table_conversion * t,int r,int v,int b)
byte TC_Get(Table_conversion * t,int r,int g,int b)
{
int index;
// On réduit le nombre de bits par couleur
r=(r>>t->red_r);
v=(v>>t->red_v);
g=(g>>t->red_v);
b=(b>>t->red_b);
// On recherche la couleur la plus proche dans la table de conversion
index=(r<<t->dec_r) | (v<<t->dec_v) | (b<<t->dec_b);
index=(r<<t->dec_r) | (g<<t->dec_v) | (b<<t->dec_b);
return t->table[index];
}
void TC_Set(Table_conversion * t,int r,int v,int b,byte i)
void TC_Set(Table_conversion * t,int r,int g,int b,byte i)
{
int index;
index=(r<<t->dec_r) | (v<<t->dec_v) | (b<<t->dec_b);
index=(r<<t->dec_r) | (g<<t->dec_v) | (b<<t->dec_b);
t->table[index]=i;
}
@ -298,33 +298,33 @@ void TO_Delete(Table_occurence * t)
free(t);
}
int TO_Get(Table_occurence * t,int r,int v,int b)
int TO_Get(Table_occurence * t,int r,int g,int b)
{
int index;
index=(r<<t->dec_r) | (v<<t->dec_v) | (b<<t->dec_b);
index=(r<<t->dec_r) | (g<<t->dec_v) | (b<<t->dec_b);
return t->table[index];
}
void TO_Set(Table_occurence * t,int r,int v,int b,int i)
void TO_Set(Table_occurence * t,int r,int g,int b,int i)
{
int index;
r=(r>>t->red_r);
v=(v>>t->red_v);
g=(g>>t->red_v);
b=(b>>t->red_b);
index=(r<<t->dec_r) | (v<<t->dec_v) | (b<<t->dec_b);
index=(r<<t->dec_r) | (g<<t->dec_v) | (b<<t->dec_b);
t->table[index]=i;
}
void TO_Inc(Table_occurence * t,int r,int v,int b)
void TO_Inc(Table_occurence * t,int r,int g,int b)
{
int index;
r=(r>>t->red_r);
v=(v>>t->red_v);
g=(g>>t->red_v);
b=(b>>t->red_b);
index=(r<<t->dec_r) | (v<<t->dec_v) | (b<<t->dec_b);
index=(r<<t->dec_r) | (g<<t->dec_v) | (b<<t->dec_b);
t->table[index]++;
}
@ -334,7 +334,7 @@ void TO_Compter_occurences(Table_occurence * t,Bitmap24B image,int Taille)
int index;
for (index=Taille,ptr=image;index>0;index--,ptr++)
TO_Inc(t,ptr->R,ptr->V,ptr->B);
TO_Inc(t,ptr->R,ptr->G,ptr->B);
}
int TO_Compter_couleurs(Table_occurence * t)
@ -361,7 +361,7 @@ int TO_Compter_couleurs(Table_occurence * t)
void Cluster_Analyser(Cluster * c,Table_occurence * to)
{
int rmin,rmax,vmin,vmax,bmin,bmax;
int r,v,b;
int r,g,b;
// On cherche les mins et les maxs de chaque composante sur la couverture
@ -374,16 +374,16 @@ void Cluster_Analyser(Cluster * c,Table_occurence * to)
c->occurences=0;
/*
for (r=c->rmin<<16;r<=c->rmax<<16;r+=1<<16)
for (v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
for (g=c->vmin<<8;g<=c->vmax<<8;g+=1<<8)
for (b=c->bmin;b<=c->bmax;b++)
{
nbocc=to->table[r + v + b]; // TO_Get
nbocc=to->table[r + g + b]; // TO_Get
if (nbocc)
{
if (r<rmin) rmin=r;
else if (r>rmax) rmax=r;
if (v<vmin) vmin=v;
else if (v>vmax) vmax=v;
if (g<vmin) vmin=g;
else if (g>vmax) vmax=g;
if (b<bmin) bmin=b;
else if (b>bmax) bmax=b;
c->occurences+=nbocc;
@ -396,10 +396,10 @@ void Cluster_Analyser(Cluster * c,Table_occurence * to)
// précédente puisqu'on connait une borne supplémentaire
for(r=c->rmin<<16;r<=c->rmax<<16;r+=1<<16)
for(v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
for(g=c->vmin<<8;g<=c->vmax<<8;g+=1<<8)
for(b=c->bmin;b<=c->bmax;b++)
{
if(to->table[r + v + b]) // TO_Get
if(to->table[r + g + b]) // TO_Get
{
rmin=r;
goto RMAX;
@ -407,43 +407,43 @@ void Cluster_Analyser(Cluster * c,Table_occurence * to)
}
RMAX:
for(r=c->rmax<<16;r>=rmin;r-=1<<16)
for(v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
for(g=c->vmin<<8;g<=c->vmax<<8;g+=1<<8)
for(b=c->bmin;b<=c->bmax;b++)
{
if(to->table[r + v + b]) // TO_Get
if(to->table[r + g + b]) // TO_Get
{
rmax=r;
goto VMIN;
}
}
VMIN:
for(v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
for(g=c->vmin<<8;g<=c->vmax<<8;g+=1<<8)
for(r=rmin;r<=rmax;r+=1<<16)
for(b=c->bmin;b<=c->bmax;b++)
{
if(to->table[r + v + b]) // TO_Get
if(to->table[r + g + b]) // TO_Get
{
vmin=v;
vmin=g;
goto VMAX;
}
}
VMAX:
for(v=c->vmax<<8;v>=vmin;v-=1<<8)
for(g=c->vmax<<8;g>=vmin;g-=1<<8)
for(r=rmin;r<=rmax;r+=1<<16)
for(b=c->bmin;b<=c->bmax;b++)
{
if(to->table[r + v + b]) // TO_Get
if(to->table[r + g + b]) // TO_Get
{
vmax=v;
vmax=g;
goto BMIN;
}
}
BMIN:
for(b=c->bmin;b<=c->bmax;b++)
for(r=rmin;r<=rmax;r+=1<<16)
for(v=vmin;v<=vmax;v+=1<<8)
for(g=vmin;g<=vmax;g+=1<<8)
{
if(to->table[r + v + b]) // TO_Get
if(to->table[r + g + b]) // TO_Get
{
bmin=b;
goto BMAX;
@ -452,9 +452,9 @@ BMIN:
BMAX:
for(b=c->bmax;b>=bmin;b--)
for(r=rmin;r<=rmax;r+=1<<16)
for(v=vmin;v<=vmax;v+=1<<8)
for(g=vmin;g<=vmax;g+=1<<8)
{
if(to->table[r + v + b]) // TO_Get
if(to->table[r + g + b]) // TO_Get
{
bmax=b;
goto ENDCRUSH;
@ -463,10 +463,10 @@ BMAX:
ENDCRUSH:
// Il faut quand même parcourir la partie utile du cluster, pour savoir combien il y a d'occurences
for(r=rmin;r<=rmax;r+=1<<16)
for(v=vmin;v<=vmax;v+=1<<8)
for(g=vmin;g<=vmax;g+=1<<8)
for(b=bmin;b<=bmax;b++)
{
c->occurences+=to->table[r + v + b]; // TO_Get
c->occurences+=to->table[r + g + b]; // TO_Get
}
c->rmin=rmin>>16; c->rmax=rmax>>16;
@ -475,34 +475,34 @@ ENDCRUSH:
// On regarde la composante qui a la variation la plus grande
r=(c->rmax-c->rmin)*299;
v=(c->vmax-c->vmin)*587;
g=(c->vmax-c->vmin)*587;
b=(c->bmax-c->bmin)*114;
if (v>=r)
if (g>=r)
{
// V>=R
if (v>=b)
// G>=R
if (g>=b)
{
// V>=R et V>=B
// G>=R et G>=B
c->plus_large=1;
}
else
{
// V>=R et V<B
// G>=R et G<B
c->plus_large=2;
}
}
else
{
// R>V
// R>G
if (r>=b)
{
// R>V et R>=B
// R>G et R>=B
c->plus_large=0;
}
else
{
// R>V et R<B
// R>G et R<B
c->plus_large=2;
}
}
@ -512,7 +512,7 @@ void Cluster_Split(Cluster * c,Cluster * c1,Cluster * c2,int Teinte,Table_occure
{
int limit;
int cumul;
int r,v,b;
int r,g,b;
limit=(c->occurences)/2;
cumul=0;
@ -520,11 +520,11 @@ void Cluster_Split(Cluster * c,Cluster * c1,Cluster * c2,int Teinte,Table_occure
{
for (r=c->rmin<<16;r<=c->rmax<<16;r+=1<<16)
{
for (v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
for (g=c->vmin<<8;g<=c->vmax<<8;g+=1<<8)
{
for (b=c->bmin;b<=c->bmax;b++)
{
cumul+=to->table[r + v + b];
cumul+=to->table[r + g + b];
if (cumul>=limit)
break;
}
@ -536,7 +536,7 @@ void Cluster_Split(Cluster * c,Cluster * c1,Cluster * c2,int Teinte,Table_occure
}
r>>=16;
v>>=8;
g>>=8;
if (r==c->rmin)
r++;
@ -559,13 +559,13 @@ void Cluster_Split(Cluster * c,Cluster * c1,Cluster * c2,int Teinte,Table_occure
if (Teinte==1)
{
for (v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
for (g=c->vmin<<8;g<=c->vmax<<8;g+=1<<8)
{
for (r=c->rmin<<16;r<=c->rmax<<16;r+=1<<16)
{
for (b=c->bmin;b<=c->bmax;b++)
{
cumul+=to->table[r + v + b];
cumul+=to->table[r + g + b];
if (cumul>=limit)
break;
}
@ -576,22 +576,22 @@ void Cluster_Split(Cluster * c,Cluster * c1,Cluster * c2,int Teinte,Table_occure
break;
}
r>>=16; v>>=8;
r>>=16; g>>=8;
if (v==c->vmin)
v++;
// V est la valeur de dbut du 2nd cluster
if (g==c->vmin)
g++;
// G est la valeur de dbut du 2nd cluster
c1->Rmin=c->Rmin; c1->Rmax=c->Rmax;
c1->rmin=c->rmin; c1->rmax=c->rmax;
c1->Vmin=c->Vmin; c1->Vmax=v-1;
c1->vmin=c->vmin; c1->vmax=v-1;
c1->Vmin=c->Vmin; c1->Vmax=g-1;
c1->vmin=c->vmin; c1->vmax=g-1;
c1->Bmin=c->Bmin; c1->Bmax=c->Bmax;
c1->bmin=c->bmin; c1->bmax=c->bmax;
c2->Rmin=c->Rmin; c2->Rmax=c->Rmax;
c2->rmin=c->rmin; c2->rmax=c->rmax;
c2->Vmin=v; c2->Vmax=c->Vmax;
c2->vmin=v; c2->vmax=c->vmax;
c2->Vmin=g; c2->Vmax=c->Vmax;
c2->vmin=g; c2->vmax=c->vmax;
c2->Bmin=c->Bmin; c2->Bmax=c->Bmax;
c2->bmin=c->bmin; c2->bmax=c->bmax;
}
@ -600,11 +600,11 @@ void Cluster_Split(Cluster * c,Cluster * c1,Cluster * c2,int Teinte,Table_occure
for (b=c->bmin;b<=c->bmax;b++)
{
for (v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
for (g=c->vmin<<8;g<=c->vmax<<8;g+=1<<8)
{
for (r=c->rmin<<16;r<=c->rmax<<16;r+=1<<16)
{
cumul+=to->table[r + v + b];
cumul+=to->table[r + g + b];
if (cumul>=limit)
break;
}
@ -615,7 +615,7 @@ void Cluster_Split(Cluster * c,Cluster * c1,Cluster * c2,int Teinte,Table_occure
break;
}
r>>=16; v>>=8;
r>>=16; g>>=8;
if (b==c->bmin)
b++;
@ -639,29 +639,29 @@ void Cluster_Split(Cluster * c,Cluster * c1,Cluster * c2,int Teinte,Table_occure
void Cluster_Calculer_teinte(Cluster * c,Table_occurence * to)
{
int cumulR,cumulV,cumulB;
int r,v,b;
int r,g,b;
int nbocc;
byte s=0;
cumulR=cumulV=cumulB=0;
for (r=c->rmin;r<=c->rmax;r++)
for (v=c->vmin;v<=c->vmax;v++)
for (g=c->vmin;g<=c->vmax;g++)
for (b=c->bmin;b<=c->bmax;b++)
{
nbocc=TO_Get(to,r,v,b);
nbocc=TO_Get(to,r,g,b);
if (nbocc)
{
cumulR+=r*nbocc;
cumulV+=v*nbocc;
cumulV+=g*nbocc;
cumulB+=b*nbocc;
}
}
c->r=(cumulR<<to->red_r)/c->occurences;
c->v=(cumulV<<to->red_v)/c->occurences;
c->g=(cumulV<<to->red_v)/c->occurences;
c->b=(cumulB<<to->red_b)/c->occurences;
RGBtoHSL(c->r,c->v,c->b,&c->h,&s,&c->l);
RGBtoHSL(c->r,c->g,c->b,&c->h,&s,&c->l);
}
@ -780,9 +780,9 @@ void CS_Set(ClusterSet * cs,Cluster * c)
}
// Détermination de la meilleure palette en utilisant l'algo Median Cut :
// 1) On considère l'espace (R,V,B) comme 1 boîte
// 2) On cherche les extrêmes de la boîte en (R,V,B)
// 3) On trie les pixels de l'image selon l'axe le plus long parmi (R,V,B)
// 1) On considère l'espace (R,G,B) comme 1 boîte
// 2) On cherche les extrêmes de la boîte en (R,G,B)
// 3) On trie les pixels de l'image selon l'axe le plus long parmi (R,G,B)
// 4) On coupe la boîte en deux au milieu, et on compacte pour que chaque bord corresponde bien à un pixel extreme
// 5) On recommence à couper selon le plus grand axe toutes boîtes confondues
// 6) On s'arrête quand on a le nombre de couleurs voulu
@ -893,18 +893,18 @@ void CS_Trier_par_luminance(ClusterSet * cs)
void CS_Generer_TC_et_Palette(ClusterSet * cs,Table_conversion * tc,Composantes * palette)
{
int index;
int r,v,b;
int r,g,b;
for (index=0;index<cs->nb;index++)
{
palette[index].R=cs->clusters[index].r;
palette[index].V=cs->clusters[index].v;
palette[index].G=cs->clusters[index].g;
palette[index].B=cs->clusters[index].b;
for (r=cs->clusters[index].Rmin;r<=cs->clusters[index].Rmax;r++)
for (v=cs->clusters[index].Vmin;v<=cs->clusters[index].Vmax;v++)
for (g=cs->clusters[index].Vmin;g<=cs->clusters[index].Vmax;g++)
for (b=cs->clusters[index].Bmin;b<=cs->clusters[index].Bmax;b++)
TC_Set(tc,r,v,b,index);
TC_Set(tc,r,g,b,index);
}
}
@ -1012,7 +1012,7 @@ void DS_Generer(DegradeSet * ds,ClusterSet * cs)
Table_conversion * Optimiser_palette(Bitmap24B image,int Taille,Composantes * palette,int r,int v,int b)
Table_conversion * Optimiser_palette(Bitmap24B image,int Taille,Composantes * palette,int r,int g,int b)
{
Table_occurence * to;
Table_conversion * tc;
@ -1022,10 +1022,10 @@ Table_conversion * Optimiser_palette(Bitmap24B image,int Taille,Composantes * pa
// Création des éléments nécessaires au calcul de palette optimisée:
to=0; tc=0; cs=0; ds=0;
to=TO_New(r,v,b);
to=TO_New(r,g,b);
if (to!=0)
{
tc=TC_New(r,v,b);
tc=TC_New(r,g,b);
if (tc!=0)
{
@ -1095,7 +1095,7 @@ void Convert_bitmap_24B_to_256_Floyd_Steinberg(Bitmap256 Dest,Bitmap24B Source,i
Bitmap24B Suivant;
Bitmap24B S_plus1;
Bitmap256 d;
int Pos_X,Pos_Y;
int x_pos,y_pos;
int Rouge,Vert,Bleu;
float ERouge,EVert,EBleu;
@ -1108,21 +1108,21 @@ void Convert_bitmap_24B_to_256_Floyd_Steinberg(Bitmap256 Dest,Bitmap24B Source,i
d =Dest;
// On parcours chaque pixel:
for (Pos_Y=0;Pos_Y<height;Pos_Y++)
for (y_pos=0;y_pos<height;y_pos++)
{
for (Pos_X=0;Pos_X<width;Pos_X++)
for (x_pos=0;x_pos<width;x_pos++)
{
// On prends la meilleure couleur de la palette qui traduit la couleur
// 24 bits de la source:
Rouge=Courant->R;
Vert =Courant->V;
Vert =Courant->G;
Bleu =Courant->B;
// Cherche la couleur correspondant dans la palette et la range dans l'image de destination
*d=TC_Get(tc,Rouge,Vert,Bleu);
// Puis on calcule pour chaque composante l'erreur dûe à l'approximation
Rouge-=palette[*d].R;
Vert -=palette[*d].V;
Vert -=palette[*d].G;
Bleu -=palette[*d].B;
// Et dans chaque pixel voisin on propage l'erreur
@ -1130,23 +1130,23 @@ void Convert_bitmap_24B_to_256_Floyd_Steinberg(Bitmap256 Dest,Bitmap24B Source,i
ERouge=(Rouge*7)/16.0;
EVert =(Vert *7)/16.0;
EBleu =(Bleu *7)/16.0;
if (Pos_X+1<width)
if (x_pos+1<width)
{
// Valeur_modifiee fait la somme des 2 params en bornant sur [0,255]
C_plus1->R=Valeur_modifiee(C_plus1->R,ERouge);
C_plus1->V=Valeur_modifiee(C_plus1->V,EVert );
C_plus1->G=Valeur_modifiee(C_plus1->G,EVert );
C_plus1->B=Valeur_modifiee(C_plus1->B,EBleu );
}
// En bas à gauche:
if (Pos_Y+1<height)
if (y_pos+1<height)
{
ERouge=(Rouge*3)/16.0;
EVert =(Vert *3)/16.0;
EBleu =(Bleu *3)/16.0;
if (Pos_X>0)
if (x_pos>0)
{
S_moins1->R=Valeur_modifiee(S_moins1->R,ERouge);
S_moins1->V=Valeur_modifiee(S_moins1->V,EVert );
S_moins1->G=Valeur_modifiee(S_moins1->G,EVert );
S_moins1->B=Valeur_modifiee(S_moins1->B,EBleu );
}
// En bas:
@ -1154,16 +1154,16 @@ void Convert_bitmap_24B_to_256_Floyd_Steinberg(Bitmap256 Dest,Bitmap24B Source,i
EVert =(Vert*5 /16.0);
EBleu =(Bleu*5 /16.0);
Suivant->R=Valeur_modifiee(Suivant->R,ERouge);
Suivant->V=Valeur_modifiee(Suivant->V,EVert );
Suivant->G=Valeur_modifiee(Suivant->G,EVert );
Suivant->B=Valeur_modifiee(Suivant->B,EBleu );
// En bas à droite:
if (Pos_X+1<width)
if (x_pos+1<width)
{
ERouge=(Rouge/16.0);
EVert =(Vert /16.0);
EBleu =(Bleu /16.0);
S_plus1->R=Valeur_modifiee(S_plus1->R,ERouge);
S_plus1->V=Valeur_modifiee(S_plus1->V,EVert );
S_plus1->G=Valeur_modifiee(S_plus1->G,EVert );
S_plus1->B=Valeur_modifiee(S_plus1->B,EBleu );
}
}

14
op_c.h
View File

@ -97,7 +97,7 @@ typedef struct
byte bmin,bmax;
byte plus_large; // Composante ayant la plus grande variation (0=Rouge,1=Vert,2=Bleu)
byte r,v,b; // Couleur synthétisant l'ensemble
byte r,g,b; // Couleur synthétisant l'ensemble
byte h; // Chrominance
byte l; // Luminosité
} Cluster;
@ -144,10 +144,10 @@ typedef struct
Table_conversion * TC_New(int nbb_r,int nbb_g,int nbb_b);
void TC_Delete(Table_conversion * t);
byte TC_Get(Table_conversion * t,int r,int v,int b);
void TC_Set(Table_conversion * t,int r,int v,int b,byte i);
byte TC_Get(Table_conversion * t,int r,int g,int b);
void TC_Set(Table_conversion * t,int r,int g,int b,byte i);
void RGBtoHSL(int r, int v,int b, byte* h, byte*s, byte* l);
void RGBtoHSL(int r, int g,int b, byte* h, byte*s, byte* l);
void HSLtoRGB(byte h, byte s, byte l, byte* r, byte* g, byte* b);
@ -158,9 +158,9 @@ void HSLtoRGB(byte h, byte s, byte l, byte* r, byte* g, byte* b);
void TO_Init(Table_occurence * t);
Table_occurence * TO_New(int nbb_r,int nbb_g,int nbb_b);
void TO_Delete(Table_occurence * t);
int TO_Get(Table_occurence * t,int r,int v,int b);
void TO_Set(Table_occurence * t,int r,int v,int b,int i);
void TO_Inc(Table_occurence * t,int r,int v,int b);
int TO_Get(Table_occurence * t,int r,int g,int b);
void TO_Set(Table_occurence * t,int r,int g,int b,int i);
void TO_Inc(Table_occurence * t,int r,int g,int b);
void TO_Compter_occurences(Table_occurence * t,Bitmap24B image,int Taille);

View File

@ -1521,48 +1521,48 @@ void Pipette_0_1(void)
/////////////////////////////////////////////////// OPERATION_COURBE_4_POINTS
void Courbe_Tracer_croix(short Pos_X, short Pos_Y)
void Courbe_Tracer_croix(short x_pos, short y_pos)
{
short Debut_X,Fin_X;
short Debut_Y,Fin_Y;
short i,Temp;
//byte Temp2;
if (Pos_X>=Limite_Gauche+3)
if (x_pos>=Limite_Gauche+3)
Debut_X=0;
else
Debut_X=3-(Pos_X-Limite_Gauche);
Debut_X=3-(x_pos-Limite_Gauche);
if (Pos_Y>=Limite_Haut+3)
if (y_pos>=Limite_Haut+3)
Debut_Y=0;
else
Debut_Y=3-(Pos_Y-Limite_Haut);
Debut_Y=3-(y_pos-Limite_Haut);
if (Pos_X<=Limite_visible_Droite-3)
if (x_pos<=Limite_visible_Droite-3)
Fin_X=6;
else
Fin_X=3+(Limite_visible_Droite-Pos_X);
Fin_X=3+(Limite_visible_Droite-x_pos);
if (Pos_Y<=Limite_visible_Bas-3)
if (y_pos<=Limite_visible_Bas-3)
Fin_Y=6;
else
Fin_Y=3+(Limite_visible_Bas-Pos_Y);
Fin_Y=3+(Limite_visible_Bas-y_pos);
if (Debut_X<=Fin_X && Debut_Y<=Fin_Y)
{
for (i=Debut_X; i<=Fin_X; i++)
{
Temp=Pos_X+i-3;
Pixel_Preview(Temp,Pos_Y,~Lit_pixel(Temp -Principal_Decalage_X,
Pos_Y-Principal_Decalage_Y));
Temp=x_pos+i-3;
Pixel_Preview(Temp,y_pos,~Lit_pixel(Temp -Principal_Decalage_X,
y_pos-Principal_Decalage_Y));
}
for (i=Debut_Y; i<=Fin_Y; i++)
{
Temp=Pos_Y+i-3;
Pixel_Preview(Pos_X,Temp,~Lit_pixel(Pos_X-Principal_Decalage_X,
Temp=y_pos+i-3;
Pixel_Preview(x_pos,Temp,~Lit_pixel(x_pos-Principal_Decalage_X,
Temp -Principal_Decalage_Y));
}
Mettre_Ecran_A_Jour(Pos_X+Debut_X-3,Pos_Y+Debut_Y-3,Fin_X-Debut_X+1,Fin_Y-Debut_Y+1);
Mettre_Ecran_A_Jour(x_pos+Debut_X-3,y_pos+Debut_Y-3,Fin_X-Debut_X+1,Fin_Y-Debut_Y+1);
}
}
@ -3715,18 +3715,18 @@ void Scroll_12_4(void)
{
short Centre_X;
short Centre_Y;
short Pos_X;
short Pos_Y;
short x_pos;
short y_pos;
short x_offset;
short y_offset;
//char Chaine[5];
Operation_POP(&Pos_Y);
Operation_POP(&Pos_X);
Operation_POP(&y_pos);
Operation_POP(&x_pos);
Operation_POP(&Centre_Y);
Operation_POP(&Centre_X);
if ( (Pinceau_X!=Pos_X) || (Pinceau_Y!=Pos_Y) )
if ( (Pinceau_X!=x_pos) || (Pinceau_Y!=y_pos) )
{
// L'utilisateur a bougé, il faut scroller l'image

18
pages.c
View File

@ -49,7 +49,7 @@ void Initialiser_S_Page(S_Page * Page)
memset(Page->Palette,0,sizeof(T_Palette));
Page->Commentaire[0]='\0';
Page->Repertoire_fichier[0]='\0';
Page->Nom_fichier[0]='\0';
Page->Filename[0]='\0';
Page->Format_fichier=FORMAT_PAR_DEFAUT;
/*
Page->Decalage_X=0;
@ -86,7 +86,7 @@ void Download_infos_page_principal(S_Page * Page)
memcpy(Principal_Palette,Page->Palette,sizeof(T_Palette));
strcpy(Principal_Commentaire,Page->Commentaire);
strcpy(Principal_Repertoire_fichier,Page->Repertoire_fichier);
strcpy(Principal_Nom_fichier,Page->Nom_fichier);
strcpy(Principal_Nom_fichier,Page->Filename);
Principal_Format_fichier=Page->Format_fichier;
/*
Principal_Decalage_X=Page->Decalage_X;
@ -140,7 +140,7 @@ void Upload_infos_page_principal(S_Page * Page)
memcpy(Page->Palette,Principal_Palette,sizeof(T_Palette));
strcpy(Page->Commentaire,Principal_Commentaire);
strcpy(Page->Repertoire_fichier,Principal_Repertoire_fichier);
strcpy(Page->Nom_fichier,Principal_Nom_fichier);
strcpy(Page->Filename,Principal_Nom_fichier);
Page->Format_fichier=Principal_Format_fichier;
/*
Page->Decalage_X=Principal_Decalage_X;
@ -170,7 +170,7 @@ void Download_infos_page_brouillon(S_Page * Page)
memcpy(Brouillon_Palette,Page->Palette,sizeof(T_Palette));
strcpy(Brouillon_Commentaire,Page->Commentaire);
strcpy(Brouillon_Repertoire_fichier,Page->Repertoire_fichier);
strcpy(Brouillon_Nom_fichier,Page->Nom_fichier);
strcpy(Brouillon_Nom_fichier,Page->Filename);
Brouillon_Format_fichier=Page->Format_fichier;
/*
Brouillon_Decalage_X=Page->Decalage_X;
@ -200,7 +200,7 @@ void Upload_infos_page_brouillon(S_Page * Page)
memcpy(Page->Palette,Brouillon_Palette,sizeof(T_Palette));
strcpy(Page->Commentaire,Brouillon_Commentaire);
strcpy(Page->Repertoire_fichier,Brouillon_Repertoire_fichier);
strcpy(Page->Nom_fichier,Brouillon_Nom_fichier);
strcpy(Page->Filename,Brouillon_Nom_fichier);
Page->Format_fichier=Brouillon_Format_fichier;
/*
Page->Decalage_X=Brouillon_Decalage_X;
@ -749,14 +749,14 @@ void Detruire_les_listes_de_backups_en_fin_de_programme(void)
free(Brouillon_Backups);
}
void Nouveau_nombre_de_backups(int Nouveau)
void Nouveau_nombre_de_backups(int nb_backups)
{
Changer_nombre_de_pages_d_une_liste(Principal_Backups,Nouveau+1);
Changer_nombre_de_pages_d_une_liste(Brouillon_Backups,Nouveau+1);
Changer_nombre_de_pages_d_une_liste(Principal_Backups,nb_backups+1);
Changer_nombre_de_pages_d_une_liste(Brouillon_Backups,nb_backups+1);
// Le +1 vient du fait que dans chaque liste, en 1ère position on retrouve
// les infos de la page courante sur le brouillon et la page principale.
// (Nouveau = Nombre de backups, sans compter les pages courantes)
// (nb_backups = Nombre de backups, sans compter les pages courantes)
}
int Backup_avec_nouvelles_dimensions(int Upload,int width,int height)

View File

@ -68,7 +68,7 @@ void Detruire_la_page_courante_d_une_liste(S_Liste_de_pages * list);
int Initialiser_les_listes_de_backups_en_debut_de_programme(int Taille,int width,int height);
void Detruire_les_listes_de_backups_en_fin_de_programme(void);
void Nouveau_nombre_de_backups(int Nouveau);
void Nouveau_nombre_de_backups(int nb_backups);
int Backup_avec_nouvelles_dimensions(int Upload,int width,int height);
int Backuper_et_redimensionner_brouillon(int width,int height);
void Backup(void);

214
palette.c
View File

@ -82,7 +82,7 @@ void Unite_Composantes(int Count)
void Modifier_HSL(T_Palette Palette_depart, T_Palette Palette_arrivee, byte Couleur, short Difference_H, short Difference_S, short Difference_L)
{
byte h, S, l;
RGBtoHSL(Palette_depart[Couleur].R,Palette_depart[Couleur].V,Palette_depart[Couleur].B,&h,&S,&l);
RGBtoHSL(Palette_depart[Couleur].R,Palette_depart[Couleur].G,Palette_depart[Couleur].B,&h,&S,&l);
// La teinte (Hue) est cyclique
h=(Difference_H+256+h);
// Pour les autres (Saturation, Lightness), au lieu d'additionner,
@ -95,10 +95,10 @@ void Modifier_HSL(T_Palette Palette_depart, T_Palette Palette_arrivee, byte Coul
l=(255+Difference_L)*l/255;
else if (Difference_L>0)
l=255-(255-Difference_L)*(255-l)/255;
HSLtoRGB(h,S,l,&Palette_arrivee[Couleur].R,&Palette_arrivee[Couleur].V,&Palette_arrivee[Couleur].B);
HSLtoRGB(h,S,l,&Palette_arrivee[Couleur].R,&Palette_arrivee[Couleur].G,&Palette_arrivee[Couleur].B);
}
void Modifier_Rouge(byte Couleur, short Nouvelle_teinte, T_Palette Palette)
void Modifier_Rouge(byte Couleur, short Nouvelle_teinte, T_Palette palette)
{
if (Nouvelle_teinte< 0)
Nouvelle_teinte= 0;
@ -107,12 +107,12 @@ void Modifier_Rouge(byte Couleur, short Nouvelle_teinte, T_Palette Palette)
// Arrondi
Nouvelle_teinte=Palette_Scale_Component(Nouvelle_teinte);
Palette[Couleur].R=Nouvelle_teinte;
Set_color(Couleur,Palette[Couleur].R,Palette[Couleur].V,Palette[Couleur].B);
palette[Couleur].R=Nouvelle_teinte;
Set_color(Couleur,palette[Couleur].R,palette[Couleur].G,palette[Couleur].B);
}
void Modifier_Vert(byte Couleur, short Nouvelle_teinte, T_Palette Palette)
void Modifier_Vert(byte Couleur, short Nouvelle_teinte, T_Palette palette)
{
if (Nouvelle_teinte< 0)
Nouvelle_teinte= 0;
@ -121,12 +121,12 @@ void Modifier_Vert(byte Couleur, short Nouvelle_teinte, T_Palette Palette)
// Arrondi
Nouvelle_teinte=Palette_Scale_Component(Nouvelle_teinte);
Palette[Couleur].V=Nouvelle_teinte;
Set_color(Couleur,Palette[Couleur].R,Palette[Couleur].V,Palette[Couleur].B);
palette[Couleur].G=Nouvelle_teinte;
Set_color(Couleur,palette[Couleur].R,palette[Couleur].G,palette[Couleur].B);
}
void Modifier_Bleu(byte Couleur, short Nouvelle_teinte, T_Palette Palette)
void Modifier_Bleu(byte Couleur, short Nouvelle_teinte, T_Palette palette)
{
if (Nouvelle_teinte< 0)
Nouvelle_teinte= 0;
@ -135,8 +135,8 @@ void Modifier_Bleu(byte Couleur, short Nouvelle_teinte, T_Palette Palette)
// Arrondi
Nouvelle_teinte=Palette_Scale_Component(Nouvelle_teinte);
Palette[Couleur].B=Nouvelle_teinte;
Set_color(Couleur,Palette[Couleur].R,Palette[Couleur].V,Palette[Couleur].B);
palette[Couleur].B=Nouvelle_teinte;
Set_color(Couleur,palette[Couleur].R,palette[Couleur].G,palette[Couleur].B);
}
void Formate_composante(byte Valeur, char *Chaine)
@ -147,7 +147,7 @@ void Formate_composante(byte Valeur, char *Chaine)
Chaine[4]='\0';
}
void Degrader_palette(short start,short end,T_Palette Palette)
void Degrader_palette(short start,short end,T_Palette palette)
// Modifie la palette pour obtenir un dégradé de couleur entre les deux bornes
// passées en paramètre
{
@ -163,19 +163,19 @@ void Degrader_palette(short start,short end,T_Palette Palette)
// pouvoir faire un dégradé:
if ( (start!=end) && (start+1!=end) )
{
Debut_Rouge=Palette[start].R;
Debut_Vert =Palette[start].V;
Debut_Bleu =Palette[start].B;
Debut_Rouge=palette[start].R;
Debut_Vert =palette[start].G;
Debut_Bleu =palette[start].B;
Fin_Rouge =Palette[end ].R;
Fin_Vert =Palette[end ].V;
Fin_Bleu =Palette[end ].B;
Fin_Rouge =palette[end ].R;
Fin_Vert =palette[end ].G;
Fin_Bleu =palette[end ].B;
for (Indice=start+1;Indice<end;Indice++)
{
Modifier_Rouge(Indice, ((Fin_Rouge-Debut_Rouge) * (Indice-start))/(end-start) + Debut_Rouge,Palette);
Modifier_Vert (Indice, ((Fin_Vert -Debut_Vert ) * (Indice-start))/(end-start) + Debut_Vert ,Palette);
Modifier_Bleu (Indice, ((Fin_Bleu -Debut_Bleu ) * (Indice-start))/(end-start) + Debut_Bleu ,Palette);
Modifier_Rouge(Indice, ((Fin_Rouge-Debut_Rouge) * (Indice-start))/(end-start) + Debut_Rouge,palette);
Modifier_Vert (Indice, ((Fin_Vert -Debut_Vert ) * (Indice-start))/(end-start) + Debut_Vert ,palette);
Modifier_Bleu (Indice, ((Fin_Bleu -Debut_Bleu ) * (Indice-start))/(end-start) + Debut_Bleu ,palette);
}
}
}
@ -202,17 +202,17 @@ void Remap_zone_HIGH(short X1, short Y1, short X2, short Y2,
byte * Table_de_conversion)
// Attention: Remappe une zone de coins X1,Y1 et X2-1,Y2-1 !!!
{
short Pos_X;
short Pos_Y;
short x_pos;
short y_pos;
for (Pos_Y=Y1;Pos_Y<Y2;Pos_Y++)
for (Pos_X=X1;Pos_X<X2;Pos_X++)
for (y_pos=Y1;y_pos<Y2;y_pos++)
for (x_pos=X1;x_pos<X2;x_pos++)
{
if ((Pos_Y>=Fenetre_Pos_Y) && (Pos_Y<Fenetre_Pos_Y+(Fenetre_Hauteur*Menu_Facteur_Y)) &&
(Pos_X>=Fenetre_Pos_X) && (Pos_X<Fenetre_Pos_X+(Fenetre_Largeur*Menu_Facteur_X)) )
Pos_X=Fenetre_Pos_X+(Fenetre_Largeur*Menu_Facteur_X)-1;
if ((y_pos>=Fenetre_Pos_Y) && (y_pos<Fenetre_Pos_Y+(Fenetre_Hauteur*Menu_Facteur_Y)) &&
(x_pos>=Fenetre_Pos_X) && (x_pos<Fenetre_Pos_X+(Fenetre_Largeur*Menu_Facteur_X)) )
x_pos=Fenetre_Pos_X+(Fenetre_Largeur*Menu_Facteur_X)-1;
else
Pixel(Pos_X,Pos_Y,Table_de_conversion[Lit_pixel(Pos_X,Pos_Y)]);
Pixel(x_pos,y_pos,Table_de_conversion[Lit_pixel(x_pos,y_pos)]);
}
}
@ -276,7 +276,7 @@ void Remap_image_HIGH(byte * Table_de_conversion)
}
void Swap(int X_Swap,short Debut_Bloc_1,short Debut_Bloc_2,short Taille_du_bloc,T_Palette Palette, dword * Utilisation_couleur)
void Swap(int X_Swap,short Debut_Bloc_1,short Debut_Bloc_2,short Taille_du_bloc,T_Palette palette, dword * Utilisation_couleur)
{
short Pos_1;
short Pos_2;
@ -289,7 +289,7 @@ void Swap(int X_Swap,short Debut_Bloc_1,short Debut_Bloc_2,short Taille_du_bloc,
dword Utilisation_temporaire[256];
// On fait une copie de la palette
memcpy(Palette_temporaire, Palette, sizeof(T_Palette));
memcpy(Palette_temporaire, palette, sizeof(T_Palette));
// On fait une copie de la table d'utilisation des couleurs
memcpy(Utilisation_temporaire, Utilisation_couleur, sizeof(dword) * 256);
@ -313,9 +313,9 @@ void Swap(int X_Swap,short Debut_Bloc_1,short Debut_Bloc_2,short Taille_du_bloc,
Table_de_conversion[Pos_2]=Pos_1;
Utilisation_couleur[Pos_1]=Utilisation_temporaire[Pos_2];
Palette[Pos_1].R=Palette_temporaire[Pos_2].R;
Palette[Pos_1].V=Palette_temporaire[Pos_2].V;
Palette[Pos_1].B=Palette_temporaire[Pos_2].B;
palette[Pos_1].R=Palette_temporaire[Pos_2].R;
palette[Pos_1].G=Palette_temporaire[Pos_2].G;
palette[Pos_1].B=Palette_temporaire[Pos_2].B;
// On gère la mise à jour de Pos_2
if (Pos_2==Fin_2)
@ -335,9 +335,9 @@ void Swap(int X_Swap,short Debut_Bloc_1,short Debut_Bloc_2,short Taille_du_bloc,
Table_de_conversion[Pos_2]=Pos_1;
Utilisation_couleur[Pos_1]=Utilisation_temporaire[Pos_2];
Palette[Pos_1].R=Palette_temporaire[Pos_2].R;
Palette[Pos_1].V=Palette_temporaire[Pos_2].V;
Palette[Pos_1].B=Palette_temporaire[Pos_2].B;
palette[Pos_1].R=Palette_temporaire[Pos_2].R;
palette[Pos_1].G=Palette_temporaire[Pos_2].G;
palette[Pos_1].B=Palette_temporaire[Pos_2].B;
// On gère la mise à jour de Pos_2
if (Pos_2==Fin_1)
@ -363,17 +363,17 @@ void Swap(int X_Swap,short Debut_Bloc_1,short Debut_Bloc_2,short Taille_du_bloc,
Utilisation_couleur[Pos_2]=Tempo;
// On fait un changement de teinte:
Tempo =Palette[Pos_1].R;
Palette[Pos_1].R=Palette[Pos_2].R;
Palette[Pos_2].R=Tempo;
Tempo =palette[Pos_1].R;
palette[Pos_1].R=palette[Pos_2].R;
palette[Pos_2].R=Tempo;
Tempo =Palette[Pos_1].V;
Palette[Pos_1].V=Palette[Pos_2].V;
Palette[Pos_2].V=Tempo;
Tempo =palette[Pos_1].G;
palette[Pos_1].G=palette[Pos_2].G;
palette[Pos_2].G=Tempo;
Tempo =Palette[Pos_1].B;
Palette[Pos_1].B=Palette[Pos_2].B;
Palette[Pos_2].B=Tempo;
Tempo =palette[Pos_1].B;
palette[Pos_1].B=palette[Pos_2].B;
palette[Pos_2].B=Tempo;
}
}
@ -390,7 +390,7 @@ void Remettre_proprement_les_couleurs_du_menu(dword * Utilisation_couleur)
short Indice,Indice2;
byte Couleur;
byte Table_de_remplacement[256];
Composantes RVB[4];
Composantes rgb[4];
short Nouvelles[4]={255,254,253,252};
// On initialise la table de remplacement
@ -425,16 +425,16 @@ void Remettre_proprement_les_couleurs_du_menu(dword * Utilisation_couleur)
}
} while (Couleur);
// On sauvegarde dans RVB les teintes qu'on va remplacer et on met les
// On sauvegarde dans rgb les teintes qu'on va remplacer et on met les
// couleurs du menu par défaut
for (Indice=0; Indice<4; Indice++)
{
Couleur=Nouvelles[Indice];
RVB[Indice].R=Principal_Palette[Couleur].R;
RVB[Indice].V=Principal_Palette[Couleur].V;
RVB[Indice].B=Principal_Palette[Couleur].B;
rgb[Indice].R=Principal_Palette[Couleur].R;
rgb[Indice].G=Principal_Palette[Couleur].G;
rgb[Indice].B=Principal_Palette[Couleur].B;
Principal_Palette[Couleur].R=Coul_menu_pref[Indice].R;
Principal_Palette[Couleur].V=Coul_menu_pref[Indice].V;
Principal_Palette[Couleur].G=Coul_menu_pref[Indice].G;
Principal_Palette[Couleur].B=Coul_menu_pref[Indice].B;
}
@ -443,7 +443,7 @@ void Remettre_proprement_les_couleurs_du_menu(dword * Utilisation_couleur)
Effacer_curseur();
for (Indice=0; Indice<4; Indice++)
Table_de_remplacement[Nouvelles[Indice]]=Meilleure_couleur_sans_exclusion
(RVB[Indice].R,RVB[Indice].V,RVB[Indice].B);
(rgb[Indice].R,rgb[Indice].G,rgb[Indice].B);
// On fait un changement des couleurs visibles à l'écran et dans l'image
Remap_image_HIGH(Table_de_remplacement);
@ -452,7 +452,7 @@ void Remettre_proprement_les_couleurs_du_menu(dword * Utilisation_couleur)
void Reduce_palette(short * Nb_couleurs_utilisees,int Nb_couleurs_demandees,T_Palette Palette,dword * Utilisation_couleur)
void Reduce_palette(short * Nb_couleurs_utilisees,int Nb_couleurs_demandees,T_Palette palette,dword * Utilisation_couleur)
{
char Chaine[5]; // Buffer d'affichage du compteur
byte Table_de_conversion[256]; // Table de conversion
@ -487,9 +487,9 @@ void Reduce_palette(short * Nb_couleurs_utilisees,int Nb_couleurs_demandees,T_Pa
if (Utilisation_couleur[Couleur_1])
{
// On commence par s'occuper des teintes de la palette
Palette[Couleur_2].R=Palette[Couleur_1].R;
Palette[Couleur_2].V=Palette[Couleur_1].V;
Palette[Couleur_2].B=Palette[Couleur_1].B;
palette[Couleur_2].R=palette[Couleur_1].R;
palette[Couleur_2].G=palette[Couleur_1].G;
palette[Couleur_2].B=palette[Couleur_1].B;
// Ensuite, on met à jour le tableau d'occupation des couleurs.
Utilisation_couleur[Couleur_2]=Utilisation_couleur[Couleur_1];
@ -506,9 +506,9 @@ void Reduce_palette(short * Nb_couleurs_utilisees,int Nb_couleurs_demandees,T_Pa
// On met toutes les couleurs inutilisées en noir
for (;Couleur_2<256;Couleur_2++)
{
Palette[Couleur_2].R=0;
Palette[Couleur_2].V=0;
Palette[Couleur_2].B=0;
palette[Couleur_2].R=0;
palette[Couleur_2].G=0;
palette[Couleur_2].B=0;
Utilisation_couleur[Couleur_2]=0;
}
@ -528,9 +528,9 @@ void Reduce_palette(short * Nb_couleurs_utilisees,int Nb_couleurs_demandees,T_Pa
for (Couleur_2=Couleur_1+1;Couleur_2<(*Nb_couleurs_utilisees);Couleur_2++)
if (Couleur_1!=Couleur_2)
{
Difference =abs((short)Palette[Couleur_1].R-Palette[Couleur_2].R)+
abs((short)Palette[Couleur_1].V-Palette[Couleur_2].V)+
abs((short)Palette[Couleur_1].B-Palette[Couleur_2].B);
Difference =abs((short)palette[Couleur_1].R-palette[Couleur_2].R)+
abs((short)palette[Couleur_1].G-palette[Couleur_2].G)+
abs((short)palette[Couleur_1].B-palette[Couleur_2].B);
if (Difference<=Meilleure_difference)
{
@ -553,14 +553,14 @@ void Reduce_palette(short * Nb_couleurs_utilisees,int Nb_couleurs_demandees,T_Pa
// Meilleure_couleur_2 !
// On met à jour la palette.
Palette[Meilleure_couleur_1].R=Round_div((Utilisation_couleur[Meilleure_couleur_1]*Palette[Meilleure_couleur_1].R)+
(Utilisation_couleur[Meilleure_couleur_2]*Palette[Meilleure_couleur_2].R),
palette[Meilleure_couleur_1].R=Round_div((Utilisation_couleur[Meilleure_couleur_1]*palette[Meilleure_couleur_1].R)+
(Utilisation_couleur[Meilleure_couleur_2]*palette[Meilleure_couleur_2].R),
Meilleure_utilisation);
Palette[Meilleure_couleur_1].V=Round_div((Utilisation_couleur[Meilleure_couleur_1]*Palette[Meilleure_couleur_1].V)+
(Utilisation_couleur[Meilleure_couleur_2]*Palette[Meilleure_couleur_2].V),
palette[Meilleure_couleur_1].G=Round_div((Utilisation_couleur[Meilleure_couleur_1]*palette[Meilleure_couleur_1].G)+
(Utilisation_couleur[Meilleure_couleur_2]*palette[Meilleure_couleur_2].G),
Meilleure_utilisation);
Palette[Meilleure_couleur_1].B=Round_div((Utilisation_couleur[Meilleure_couleur_1]*Palette[Meilleure_couleur_1].B)+
(Utilisation_couleur[Meilleure_couleur_2]*Palette[Meilleure_couleur_2].B),
palette[Meilleure_couleur_1].B=Round_div((Utilisation_couleur[Meilleure_couleur_1]*palette[Meilleure_couleur_1].B)+
(Utilisation_couleur[Meilleure_couleur_2]*palette[Meilleure_couleur_2].B),
Meilleure_utilisation);
// On met à jour la table d'utilisation.
@ -599,9 +599,9 @@ void Reduce_palette(short * Nb_couleurs_utilisees,int Nb_couleurs_demandees,T_Pa
// Et on transfère ses teintes dans les teintes de la couleur qui
// la précède.
Palette[Couleur_1-1].R=Palette[Couleur_1].R;
Palette[Couleur_1-1].V=Palette[Couleur_1].V;
Palette[Couleur_1-1].B=Palette[Couleur_1].B;
palette[Couleur_1-1].R=palette[Couleur_1].R;
palette[Couleur_1-1].G=palette[Couleur_1].G;
palette[Couleur_1-1].B=palette[Couleur_1].B;
}
// Une fois la palette et la table d'utilisation gérées, on peut
@ -618,9 +618,9 @@ void Reduce_palette(short * Nb_couleurs_utilisees,int Nb_couleurs_demandees,T_Pa
// A la fin, on doit passer (dans la palette) les teintes du dernier
// élément de notre ensemble en noir.
Palette[*Nb_couleurs_utilisees].R=0;
Palette[*Nb_couleurs_utilisees].V=0;
Palette[*Nb_couleurs_utilisees].B=0;
palette[*Nb_couleurs_utilisees].R=0;
palette[*Nb_couleurs_utilisees].G=0;
palette[*Nb_couleurs_utilisees].B=0;
// Au passage, on va s'assurer que l'on a pas oublié de la mettre à une
// utilisation nulle.
@ -641,14 +641,14 @@ void Reduce_palette(short * Nb_couleurs_utilisees,int Nb_couleurs_demandees,T_Pa
void Palette_Modifier_jauge(T_Bouton_scroller * slider,
word nb_elements, word Position,
char * Valeur, short Pos_X)
word nb_elements, word position,
char * Valeur, short x_pos)
{
slider->Nb_elements=nb_elements;
slider->Position=Position;
slider->Position=position;
Calculer_hauteur_curseur_jauge(slider);
Fenetre_Dessiner_jauge(slider);
Print_compteur(Pos_X,172,Valeur,CM_Noir,CM_Clair);
Print_compteur(x_pos,172,Valeur,CM_Noir,CM_Clair);
}
@ -656,7 +656,7 @@ void Palette_Modifier_jauge(T_Bouton_scroller * slider,
void Afficher_les_jauges(T_Bouton_scroller * Jauge_rouge,
T_Bouton_scroller * Jauge_verte,
T_Bouton_scroller * Jauge_bleue,
byte Bloc_selectionne, Composantes * Palette)
byte Bloc_selectionne, Composantes * palette)
{
char Chaine[5];
@ -669,9 +669,9 @@ void Afficher_les_jauges(T_Bouton_scroller * Jauge_rouge,
else
{
byte j1, j2, j3;
j1= Palette[Fore_color].R;
j2= Palette[Fore_color].V;
j3= Palette[Fore_color].B;
j1= palette[Fore_color].R;
j2= palette[Fore_color].G;
j3= palette[Fore_color].B;
if (!Palette_mode_RGB)
{
RGBtoHSL(j1,j2,j3,&j1,&j2,&j3);
@ -691,7 +691,7 @@ void Afficher_les_jauges(T_Bouton_scroller * Jauge_rouge,
void Palette_Reafficher_jauges(T_Bouton_scroller * Jauge_rouge,
T_Bouton_scroller * Jauge_verte,
T_Bouton_scroller * Jauge_bleue,
T_Palette Palette,byte start,byte end)
T_Palette palette,byte start,byte end)
{
char Chaine[5];
@ -716,9 +716,9 @@ void Palette_Reafficher_jauges(T_Bouton_scroller * Jauge_rouge,
{
// Dans le cas d'une seule couleur, composantes.
byte j1, j2, j3;
j1= Palette[start].R;
j2= Palette[start].V;
j3= Palette[start].B;
j1= palette[start].R;
j2= palette[start].G;
j3= palette[start].B;
if (!Palette_mode_RGB)
{
RGBtoHSL(j1,j2,j3,&j1,&j2,&j3);
@ -759,7 +759,7 @@ void Bouton_Palette(void)
byte Derniere_couleur;
char Chaine[10];
word i;
//short Pos_X,Pos_Y;
//short x_pos,y_pos;
T_Bouton_normal * Bouton_Used;
T_Bouton_scroller * Jauge_rouge;
T_Bouton_scroller * Jauge_verte;
@ -782,7 +782,7 @@ void Bouton_Palette(void)
Unite_Composantes(Graduations_RGB);
Ouvrir_fenetre(299,188,"Palette");
Ouvrir_fenetre(299,188,"palette");
memcpy(Palette_de_travail,Principal_Palette,sizeof(T_Palette));
memcpy(Palette_backup ,Principal_Palette,sizeof(T_Palette));
@ -809,7 +809,7 @@ void Bouton_Palette(void)
// Jauges de couleur
Palette_mode_RGB=1;
Jauge_rouge = Fenetre_Definir_bouton_scroller(182, 81, 88,Color_Count,1,Color_Max-Palette_de_travail[Fore_color].R*Color_Max/255);// 2
Jauge_verte = Fenetre_Definir_bouton_scroller(209, 81, 88,Color_Count,1,Color_Max-Palette_de_travail[Fore_color].V*Color_Max/255);// 3
Jauge_verte = Fenetre_Definir_bouton_scroller(209, 81, 88,Color_Count,1,Color_Max-Palette_de_travail[Fore_color].G*Color_Max/255);// 3
Jauge_bleue = Fenetre_Definir_bouton_scroller(236, 81, 88,Color_Count,1,Color_Max-Palette_de_travail[Fore_color].B*Color_Max/255);// 4
Print_dans_fenetre(184,71,"R",CM_Fonce,CM_Clair);
Print_dans_fenetre(211,71,"G",CM_Fonce,CM_Clair);
@ -825,7 +825,7 @@ void Bouton_Palette(void)
// Affichage des valeurs de la couleur courante (pour 1 couleur)
Formate_composante(Principal_Palette[Fore_color].R*Color_Max/255,Chaine);
Print_compteur(176,172,Chaine,CM_Noir,CM_Clair);
Formate_composante(Principal_Palette[Fore_color].V*Color_Max/255,Chaine);
Formate_composante(Principal_Palette[Fore_color].G*Color_Max/255,Chaine);
Print_compteur(203,172,Chaine,CM_Noir,CM_Clair);
Formate_composante(Principal_Palette[Fore_color].B*Color_Max/255,Chaine);
Print_compteur(230,172,Chaine,CM_Noir,CM_Clair);
@ -895,7 +895,7 @@ void Bouton_Palette(void)
case 0 : // Nulle part
break;
case -1 : // Hors de la fenêtre
case 1 : // Palette
case 1 : // palette
if ( (Mouse_X!=Ancien_Mouse_X) || (Mouse_Y!=Ancien_Mouse_Y) || (Mouse_K!=Ancien_Mouse_K) )
{
Effacer_curseur();
@ -1029,7 +1029,7 @@ void Bouton_Palette(void)
255-Jauge_verte->Position,
255-Jauge_bleue->Position,
&Palette_de_travail[Fore_color].R,
&Palette_de_travail[Fore_color].V,
&Palette_de_travail[Fore_color].G,
&Palette_de_travail[Fore_color].B);
Formate_composante((int)255-Jauge_rouge->Position,Chaine);
}
@ -1088,7 +1088,7 @@ void Bouton_Palette(void)
if(Palette_mode_RGB)
{
Modifier_Vert (Fore_color,(Color_Max-Jauge_verte->Position)*255/Color_Max,Palette_de_travail);
Formate_composante(Palette_de_travail[Fore_color].V*Color_Max/255,Chaine);
Formate_composante(Palette_de_travail[Fore_color].G*Color_Max/255,Chaine);
}
else
{
@ -1097,7 +1097,7 @@ void Bouton_Palette(void)
255-Jauge_verte->Position,
255-Jauge_bleue->Position,
&Palette_de_travail[Fore_color].R,
&Palette_de_travail[Fore_color].V,
&Palette_de_travail[Fore_color].G,
&Palette_de_travail[Fore_color].B);
Formate_composante((int)255-Jauge_verte->Position,Chaine);
}
@ -1108,7 +1108,7 @@ void Bouton_Palette(void)
if(Palette_mode_RGB)
{
for (i=Debut_block; i<=Fin_block; i++)
Modifier_Vert (i,Palette_temporaire[i].V+(Color_Max-Jauge_verte->Position)*255/Color_Max,Palette_de_travail);
Modifier_Vert (i,Palette_temporaire[i].G+(Color_Max-Jauge_verte->Position)*255/Color_Max,Palette_de_travail);
}
else
{
@ -1165,7 +1165,7 @@ void Bouton_Palette(void)
255-Jauge_verte->Position,
255-Jauge_bleue->Position,
&Palette_de_travail[Fore_color].R,
&Palette_de_travail[Fore_color].V,
&Palette_de_travail[Fore_color].G,
&Palette_de_travail[Fore_color].B);
Formate_composante((int)255-Jauge_bleue->Position,Chaine);
}
@ -1235,7 +1235,7 @@ void Bouton_Palette(void)
// Grey Scale
for (i=Debut_block;i<=Fin_block;i++)
{
Couleur_temporaire=(dword)( ((dword)Palette_de_travail[i].R*30) + ((dword)Palette_de_travail[i].V*59) + ((dword)Palette_de_travail[i].B*11) )/100;
Couleur_temporaire=(dword)( ((dword)Palette_de_travail[i].R*30) + ((dword)Palette_de_travail[i].G*59) + ((dword)Palette_de_travail[i].B*11) )/100;
Modifier_Rouge(i,Couleur_temporaire,Palette_de_travail);
Modifier_Vert (i,Couleur_temporaire,Palette_de_travail);
Modifier_Bleu (i,Couleur_temporaire,Palette_de_travail);
@ -1435,7 +1435,7 @@ void Bouton_Palette(void)
{
Couleur_temporaire=Debut_block+(i % (Fin_block+1-Debut_block));
Palette_de_travail[i].R=Palette_backup[Couleur_temporaire].R;
Palette_de_travail[i].V=Palette_backup[Couleur_temporaire].V;
Palette_de_travail[i].G=Palette_backup[Couleur_temporaire].G;
Palette_de_travail[i].B=Palette_backup[Couleur_temporaire].B;
}
}
@ -1486,7 +1486,7 @@ void Bouton_Palette(void)
(Jauge_verte->Position)--;
Fenetre_Dessiner_jauge(Jauge_verte);
Modifier_Vert (Fore_color,(Color_Max-Jauge_verte->Position)*255/Color_Max,Palette_de_travail);
Formate_composante(Palette_de_travail[Fore_color].V*Color_Max/255,Chaine);
Formate_composante(Palette_de_travail[Fore_color].G*Color_Max/255,Chaine);
Print_compteur(203,172,Chaine,CM_Noir,CM_Clair);
}
if (Jauge_bleue->Position)
@ -1519,7 +1519,7 @@ void Bouton_Palette(void)
for (i=Debut_block; i<=Fin_block; i++)
{
Modifier_Rouge(i,Palette_temporaire[i].R+(Color_Max-Jauge_rouge->Position)*255/Color_Max,Palette_de_travail);
Modifier_Vert (i,Palette_temporaire[i].V+(Color_Max-Jauge_verte->Position)*255/Color_Max,Palette_de_travail);
Modifier_Vert (i,Palette_temporaire[i].G+(Color_Max-Jauge_verte->Position)*255/Color_Max,Palette_de_travail);
Modifier_Bleu (i,Palette_temporaire[i].B+(Color_Max-Jauge_bleue->Position)*255/Color_Max,Palette_de_travail);
}
@ -1611,7 +1611,7 @@ void Bouton_Palette(void)
(Jauge_verte->Position)++;
Fenetre_Dessiner_jauge(Jauge_verte);
Modifier_Vert (Fore_color,(Color_Max-Jauge_verte->Position)*255/Color_Max,Palette_de_travail);
Formate_composante(Palette_de_travail[Fore_color].V*Color_Max/255,Chaine);
Formate_composante(Palette_de_travail[Fore_color].G*Color_Max/255,Chaine);
Print_compteur(203,172,Chaine,CM_Noir,CM_Clair);
}
if (Jauge_bleue->Position<Color_Max)
@ -1644,7 +1644,7 @@ void Bouton_Palette(void)
for (i=Debut_block; i<=Fin_block; i++)
{
Modifier_Rouge(i,Palette_temporaire[i].R+(Color_Max-Jauge_rouge->Position)*255/Color_Max,Palette_de_travail);
Modifier_Vert (i,Palette_temporaire[i].V+(Color_Max-Jauge_verte->Position)*255/Color_Max,Palette_de_travail);
Modifier_Vert (i,Palette_temporaire[i].G+(Color_Max-Jauge_verte->Position)*255/Color_Max,Palette_de_travail);
Modifier_Bleu (i,Palette_temporaire[i].B+(Color_Max-Jauge_bleue->Position)*255/Color_Max,Palette_de_travail);
}
@ -1724,7 +1724,7 @@ void Bouton_Palette(void)
for (i=Debut_block;i<=Fin_block;i++)
{
Modifier_Rouge(i,255-Palette_de_travail[i].R,Palette_de_travail);
Modifier_Vert (i,255-Palette_de_travail[i].V,Palette_de_travail);
Modifier_Vert (i,255-Palette_de_travail[i].G,Palette_de_travail);
Modifier_Bleu (i,255-Palette_de_travail[i].B,Palette_de_travail);
}
Palette_Reafficher_jauges(Jauge_rouge,Jauge_verte,Jauge_bleue,Palette_de_travail,Debut_block,Fin_block);
@ -1747,7 +1747,7 @@ void Bouton_Palette(void)
{
Couleur_temporaire=Fin_block-(i-Debut_block);
Modifier_Rouge(i,Palette_backup[Couleur_temporaire].R,Palette_de_travail);
Modifier_Vert (i,Palette_backup[Couleur_temporaire].V,Palette_de_travail);
Modifier_Vert (i,Palette_backup[Couleur_temporaire].G,Palette_de_travail);
Modifier_Bleu (i,Palette_backup[Couleur_temporaire].B,Palette_de_travail);
if (Bouton_clicke==22)
{
@ -1844,7 +1844,7 @@ void Bouton_Palette(void)
oh=h; ol=l; os=s;
// On trie par Chrominance (H) et Luminance (L)
RGBtoHSL(Palette_de_travail[Couleur_temporaire].R,
Palette_de_travail[Couleur_temporaire].V,
Palette_de_travail[Couleur_temporaire].G,
Palette_de_travail[Couleur_temporaire].B,&h,&s,&l);
if(
@ -2091,7 +2091,7 @@ void Bouton_Palette_secondaire(void)
Fenetre_Definir_bouton_normal(139,126,53,14,"OK" , 0,1,SDLK_RETURN); // 3
Fenetre_Definir_bouton_normal( 80,126,53,14,"Cancel" , 0,1,TOUCHE_ESC); // 4
Fenetre_Afficher_cadre(10,55,122,51);
Print_dans_fenetre(18,59,"Palette layout",CM_Fonce,CM_Clair);
Print_dans_fenetre(18,59,"palette layout",CM_Fonce,CM_Clair);
Print_dans_fenetre(35,77,"Cols",CM_Fonce,CM_Clair);
Print_dans_fenetre(84,77,"Lines",CM_Fonce,CM_Clair);
Print_dans_fenetre(157,66,"RGB",CM_Fonce,CM_Clair);

View File

@ -123,10 +123,10 @@ void Pixel_Preview_Loupe_Double (word X,word Y,byte Couleur)
}
}
void Ligne_horizontale_XOR_Double(word Pos_X,word Pos_Y,word width)
void Ligne_horizontale_XOR_Double(word x_pos,word y_pos,word width)
{
//On calcule la valeur initiale de Dest:
byte* Dest=Pos_Y*4*Largeur_ecran+Pos_X*2+Ecran;
byte* Dest=y_pos*4*Largeur_ecran+x_pos*2+Ecran;
int X;
@ -134,10 +134,10 @@ void Ligne_horizontale_XOR_Double(word Pos_X,word Pos_Y,word width)
*(Dest+X+2*Largeur_ecran+1)=*(Dest+X+2*Largeur_ecran)=*(Dest+X+1)=*(Dest+X)=~*(Dest+X);
}
void Ligne_verticale_XOR_Double(word Pos_X,word Pos_Y,word height)
void Ligne_verticale_XOR_Double(word x_pos,word y_pos,word height)
{
int i;
byte *Dest=Ecran+Pos_X*2+Pos_Y*Largeur_ecran*4;
byte *Dest=Ecran+x_pos*2+y_pos*Largeur_ecran*4;
for (i=height;i>0;i--)
{
*Dest=*(Dest+1)=*(Dest+Largeur_ecran*2)=*(Dest+Largeur_ecran*2+1)=~*Dest;
@ -145,10 +145,10 @@ void Ligne_verticale_XOR_Double(word Pos_X,word Pos_Y,word height)
}
}
void Display_brush_Color_Double(word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
void Display_brush_Color_Double(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
{
// Dest = Position à l'écran
byte* Dest = Ecran + Pos_Y * 4 * Largeur_ecran + Pos_X * 2;
byte* Dest = Ecran + y_pos * 4 * Largeur_ecran + x_pos * 2;
// Src = Position dans la brosse
byte* Src = Brosse + y_offset * Largeur_brosse + x_offset;
@ -175,15 +175,15 @@ void Display_brush_Color_Double(word Pos_X,word Pos_Y,word x_offset,word y_offse
Dest = Dest + Largeur_ecran*4 - width*2;
Src = Src + Largeur_brosse - width;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
void Display_brush_Mono_Double(word Pos_X, word Pos_Y,
void Display_brush_Mono_Double(word x_pos, word y_pos,
word x_offset, word y_offset, word width, word height,
byte Couleur_de_transparence, byte Couleur, word Largeur_brosse)
/* On affiche la brosse en monochrome */
{
byte* Dest=Pos_Y*4*Largeur_ecran+Pos_X*2+Ecran; // Dest = adr destination à
byte* Dest=y_pos*4*Largeur_ecran+x_pos*2+Ecran; // Dest = adr destination à
// l'écran
byte* Src=Largeur_brosse*y_offset+x_offset+Brosse; // Src = adr ds
// la brosse
@ -207,13 +207,13 @@ void Display_brush_Mono_Double(word Pos_X, word Pos_Y,
Src+=Largeur_brosse-width;
Dest+=Largeur_ecran*4-width*2;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
void Clear_brush_Double(word Pos_X,word Pos_Y,__attribute__((unused)) word x_offset,__attribute__((unused)) word y_offset,word width,word height,__attribute__((unused))byte Couleur_de_transparence,word image_width)
void Clear_brush_Double(word x_pos,word y_pos,__attribute__((unused)) word x_offset,__attribute__((unused)) word y_offset,word width,word height,__attribute__((unused))byte Couleur_de_transparence,word image_width)
{
byte* Dest=Ecran+Pos_X*2+Pos_Y*4*Largeur_ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src = ( Pos_Y + Principal_Decalage_Y ) * image_width + Pos_X + Principal_Decalage_X + Principal_Ecran; //Coords de départ ds la source (Src)
byte* Dest=Ecran+x_pos*2+y_pos*4*Largeur_ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src = ( y_pos + Principal_Decalage_Y ) * image_width + x_pos + Principal_Decalage_X + Principal_Ecran; //Coords de départ ds la source (Src)
int y;
int x;
@ -234,14 +234,14 @@ void Clear_brush_Double(word Pos_X,word Pos_Y,__attribute__((unused)) word x_off
Src+=image_width-width;
Dest+=Largeur_ecran*4-width*2;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
// Affiche une brosse (arbitraire) à l'écran
void Affiche_brosse_Double(byte * brush, word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
void Affiche_brosse_Double(byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
{
// Dest = Position à l'écran
byte* Dest = Ecran + Pos_Y * 4 * Largeur_ecran + Pos_X * 2;
byte* Dest = Ecran + y_pos * 4 * Largeur_ecran + x_pos * 2;
// Src = Position dans la brosse
byte* Src = brush + y_offset * Largeur_brosse + x_offset;
@ -269,10 +269,10 @@ void Affiche_brosse_Double(byte * brush, word Pos_X,word Pos_Y,word x_offset,wor
}
}
void Remap_screen_Double(word Pos_X,word Pos_Y,word width,word height,byte * Table_de_conversion)
void Remap_screen_Double(word x_pos,word y_pos,word width,word height,byte * Table_de_conversion)
{
// Dest = coords a l'écran
byte* Dest = Ecran + Pos_Y * 4 * Largeur_ecran + Pos_X * 2;
byte* Dest = Ecran + y_pos * 4 * Largeur_ecran + x_pos * 2;
int x,y;
// Pour chaque ligne
@ -289,23 +289,23 @@ void Remap_screen_Double(word Pos_X,word Pos_Y,word width,word height,byte * Tab
Dest = Dest + Largeur_ecran*4 - width*2;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
void Afficher_une_ligne_ecran_fast_Double(word Pos_X,word Pos_Y,word width,byte * line)
void Afficher_une_ligne_ecran_fast_Double(word x_pos,word y_pos,word width,byte * line)
/* On affiche toute une ligne de pixels telle quelle. */
/* Utilisée si le buffer contient déja des pixel doublés. */
{
memcpy(Ecran+Pos_X*2+Pos_Y*4*Largeur_ecran,line,width*2);
memcpy(Ecran+Pos_X*2+(Pos_Y*4+2)*Largeur_ecran,line,width*2);
memcpy(Ecran+x_pos*2+y_pos*4*Largeur_ecran,line,width*2);
memcpy(Ecran+x_pos*2+(y_pos*4+2)*Largeur_ecran,line,width*2);
}
void Afficher_une_ligne_ecran_Double(word Pos_X,word Pos_Y,word width,byte * line)
void Afficher_une_ligne_ecran_Double(word x_pos,word y_pos,word width,byte * line)
/* On affiche une ligne de pixels en les doublant. */
{
int x;
byte *Dest;
Dest=Ecran+Pos_X*2+Pos_Y*4*Largeur_ecran;
Dest=Ecran+x_pos*2+y_pos*4*Largeur_ecran;
for(x=width;x>0;x--)
{
*(Dest+Largeur_ecran*2+1)=*(Dest+Largeur_ecran*2)=*(Dest+1)=*Dest=*line;
@ -314,12 +314,12 @@ void Afficher_une_ligne_ecran_Double(word Pos_X,word Pos_Y,word width,byte * lin
}
}
void Afficher_une_ligne_transparente_mono_a_l_ecran_Double(
word Pos_X, word Pos_Y, word width, byte* line,
word x_pos, word y_pos, word width, byte* line,
byte Couleur_transparence, byte Couleur)
// Affiche une ligne à l'écran avec une couleur + transparence.
// Utilisé par les brosses en mode zoom
{
byte* Dest = Ecran+ Pos_Y*ZOOMX*Largeur_ecran + Pos_X*ZOOMX;
byte* Dest = Ecran+ y_pos*ZOOMX*Largeur_ecran + x_pos*ZOOMX;
int x;
// Pour chaque pixel
for(x=0;x<width;x++)
@ -333,9 +333,9 @@ void Afficher_une_ligne_transparente_mono_a_l_ecran_Double(
}
}
void Lire_une_ligne_ecran_Double(word Pos_X,word Pos_Y,word width,byte * line)
void Lire_une_ligne_ecran_Double(word x_pos,word y_pos,word width,byte * line)
{
memcpy(line,Largeur_ecran * 4 * Pos_Y + Pos_X * 2 + Ecran,width*2);
memcpy(line,Largeur_ecran * 4 * y_pos + x_pos * 2 + Ecran,width*2);
}
void Afficher_partie_de_l_ecran_zoomee_Double(
@ -379,7 +379,7 @@ void Afficher_partie_de_l_ecran_zoomee_Double(
}
// Affiche une partie de la brosse couleur zoomée
void Display_brush_Color_zoom_Double(word Pos_X,word Pos_Y,
void Display_brush_Color_zoom_Double(word x_pos,word y_pos,
word x_offset,word y_offset,
word width, // width non zoomée
word Pos_Y_Fin,byte Couleur_de_transparence,
@ -387,7 +387,7 @@ void Display_brush_Color_zoom_Double(word Pos_X,word Pos_Y,
byte * Buffer)
{
byte* Src = Brosse+y_offset*Largeur_brosse + x_offset;
word y = Pos_Y;
word y = y_pos;
byte bx;
// Pour chaque ligne
@ -397,9 +397,9 @@ void Display_brush_Color_zoom_Double(word Pos_X,word Pos_Y,
// On affiche facteur fois la ligne zoomée
for(bx=Loupe_Facteur;bx>0;bx--)
{
Afficher_une_ligne_transparente_a_l_ecran_Wide(Pos_X,y*ZOOMX,width*Loupe_Facteur,Buffer,Couleur_de_transparence);
Afficher_une_ligne_transparente_a_l_ecran_Wide(x_pos,y*ZOOMX,width*Loupe_Facteur,Buffer,Couleur_de_transparence);
// TODO: pas clair ici
memcpy(Ecran + (y*ZOOMY+1)*ZOOMX*Largeur_ecran + Pos_X*ZOOMX, Ecran + y*ZOOMX*ZOOMY*Largeur_ecran + Pos_X*ZOOMX, width*ZOOMX*Loupe_Facteur);
memcpy(Ecran + (y*ZOOMY+1)*ZOOMX*Largeur_ecran + x_pos*ZOOMX, Ecran + y*ZOOMX*ZOOMY*Largeur_ecran + x_pos*ZOOMX, width*ZOOMX*Loupe_Facteur);
y++;
if(y==Pos_Y_Fin)
{
@ -411,7 +411,7 @@ void Display_brush_Color_zoom_Double(word Pos_X,word Pos_Y,
// ATTENTION zone jamais atteinte
}
void Display_brush_Mono_zoom_Double(word Pos_X, word Pos_Y,
void Display_brush_Mono_zoom_Double(word x_pos, word y_pos,
word x_offset, word y_offset,
word width, // width non zoomée
word Pos_Y_Fin,
@ -422,7 +422,7 @@ void Display_brush_Mono_zoom_Double(word Pos_X, word Pos_Y,
{
byte* Src = Brosse + y_offset * Largeur_brosse + x_offset;
int y=Pos_Y*ZOOMY;
int y=y_pos*ZOOMY;
//Pour chaque ligne à zoomer :
while(1)
@ -441,7 +441,7 @@ void Display_brush_Mono_zoom_Double(word Pos_X, word Pos_Y,
{
// On affiche la ligne zoomée
Afficher_une_ligne_transparente_mono_a_l_ecran_Double(
Pos_X, y, width * Loupe_Facteur,
x_pos, y, width * Loupe_Facteur,
Buffer, Couleur_de_transparence, Couleur
);
// On passe à la ligne suivante
@ -449,8 +449,8 @@ void Display_brush_Mono_zoom_Double(word Pos_X, word Pos_Y,
// On vérifie qu'on est pas à la ligne finale
if(y == Pos_Y_Fin*ZOOMX)
{
UpdateRect( Pos_X, Pos_Y,
width * Loupe_Facteur, Pos_Y_Fin - Pos_Y );
UpdateRect( x_pos, y_pos,
width * Loupe_Facteur, Pos_Y_Fin - y_pos );
return;
}
BX --;
@ -462,12 +462,12 @@ void Display_brush_Mono_zoom_Double(word Pos_X, word Pos_Y,
}
}
void Clear_brush_zoom_Double(word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,__attribute__((unused)) byte Couleur_de_transparence,word image_width,byte * Buffer)
void Clear_brush_zoom_Double(word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,__attribute__((unused)) byte Couleur_de_transparence,word image_width,byte * Buffer)
{
// En fait on va recopier l'image non zoomée dans la partie zoomée !
byte* Src = Principal_Ecran + y_offset * image_width + x_offset;
int y = Pos_Y;
int y = y_pos;
int bx;
// Pour chaque ligne à zoomer
@ -479,15 +479,15 @@ void Clear_brush_zoom_Double(word Pos_X,word Pos_Y,word x_offset,word y_offset,w
// Pour chaque ligne
do{
// TODO a verifier
Afficher_une_ligne_ecran_fast_Double(Pos_X,y,
Afficher_une_ligne_ecran_fast_Double(x_pos,y,
width * Loupe_Facteur,Buffer);
// Ligne suivante
y++;
if(y==Pos_Y_Fin)
{
UpdateRect(Pos_X,Pos_Y,
width*Loupe_Facteur,Pos_Y_Fin-Pos_Y);
UpdateRect(x_pos,y_pos,
width*Loupe_Facteur,Pos_Y_Fin-y_pos);
return;
}
bx--;

View File

@ -26,19 +26,19 @@
void Block_Double (word Debut_X,word Debut_Y,word width,word height,byte Couleur);
void Pixel_Preview_Normal_Double (word X,word Y,byte Couleur);
void Pixel_Preview_Loupe_Double (word X,word Y,byte Couleur);
void Ligne_horizontale_XOR_Double (word Pos_X,word Pos_Y,word width);
void Ligne_verticale_XOR_Double (word Pos_X,word Pos_Y,word height);
void Display_brush_Color_Double (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Display_brush_Mono_Double (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse);
void Clear_brush_Double (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word image_width);
void Remap_screen_Double (word Pos_X,word Pos_Y,word width,word height,byte * Table_de_conversion);
void Ligne_horizontale_XOR_Double (word x_pos,word y_pos,word width);
void Ligne_verticale_XOR_Double (word x_pos,word y_pos,word height);
void Display_brush_Color_Double (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Display_brush_Mono_Double (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse);
void Clear_brush_Double (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word image_width);
void Remap_screen_Double (word x_pos,word y_pos,word width,word height,byte * Table_de_conversion);
void Afficher_partie_de_l_ecran_Double (word width,word height,word image_width);
void Afficher_une_ligne_ecran_Double (word Pos_X,word Pos_Y,word width,byte * line);
void Lire_une_ligne_ecran_Double (word Pos_X,word Pos_Y,word width,byte * line);
void Afficher_une_ligne_ecran_Double (word x_pos,word y_pos,word width,byte * line);
void Lire_une_ligne_ecran_Double (word x_pos,word y_pos,word width,byte * line);
void Afficher_partie_de_l_ecran_zoomee_Double(word width,word height,word image_width,byte * Buffer);
void Display_brush_Color_zoom_Double (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_brosse,byte * Buffer);
void Display_brush_Mono_zoom_Double (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse,byte * Buffer);
void Clear_brush_zoom_Double (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word image_width,byte * Buffer);
void Affiche_brosse_Double (byte * brush, word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Display_brush_Color_zoom_Double (word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_brosse,byte * Buffer);
void Display_brush_Mono_zoom_Double (word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse,byte * Buffer);
void Clear_brush_zoom_Double (word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word image_width,byte * Buffer);
void Affiche_brosse_Double (byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Afficher_une_ligne_ecran_fast_Double (word Pos_X,word Pos_Y,word width,byte * line);
void Afficher_une_ligne_ecran_fast_Double (word x_pos,word y_pos,word width,byte * line);

View File

@ -108,10 +108,10 @@ void Pixel_Preview_Loupe_Simple (word X,word Y,byte Couleur)
}
}
void Ligne_horizontale_XOR_Simple(word Pos_X,word Pos_Y,word width)
void Ligne_horizontale_XOR_Simple(word x_pos,word y_pos,word width)
{
//On calcule la valeur initiale de Dest:
byte* Dest=Pos_Y*Largeur_ecran+Pos_X+Ecran;
byte* Dest=y_pos*Largeur_ecran+x_pos+Ecran;
int X;
@ -119,21 +119,21 @@ void Ligne_horizontale_XOR_Simple(word Pos_X,word Pos_Y,word width)
*(Dest+X)=~*(Dest+X);
}
void Ligne_verticale_XOR_Simple(word Pos_X,word Pos_Y,word height)
void Ligne_verticale_XOR_Simple(word x_pos,word y_pos,word height)
{
int i;
byte color;
for (i=Pos_Y;i<Pos_Y+height;i++)
for (i=y_pos;i<y_pos+height;i++)
{
color=*(Ecran+Pos_X+i*Largeur_ecran);
*(Ecran+Pos_X+i*Largeur_ecran)=~color;
color=*(Ecran+x_pos+i*Largeur_ecran);
*(Ecran+x_pos+i*Largeur_ecran)=~color;
}
}
void Display_brush_Color_Simple(word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
void Display_brush_Color_Simple(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
{
// Dest = Position à l'écran
byte* Dest = Ecran + Pos_Y * Largeur_ecran + Pos_X;
byte* Dest = Ecran + y_pos * Largeur_ecran + x_pos;
// Src = Position dans la brosse
byte* Src = Brosse + y_offset * Largeur_brosse + x_offset;
@ -159,15 +159,15 @@ void Display_brush_Color_Simple(word Pos_X,word Pos_Y,word x_offset,word y_offse
Dest = Dest + Largeur_ecran - width;
Src = Src + Largeur_brosse - width;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
void Display_brush_Mono_Simple(word Pos_X, word Pos_Y,
void Display_brush_Mono_Simple(word x_pos, word y_pos,
word x_offset, word y_offset, word width, word height,
byte Couleur_de_transparence, byte Couleur, word Largeur_brosse)
/* On affiche la brosse en monochrome */
{
byte* Dest=Pos_Y*Largeur_ecran+Pos_X+Ecran; // Dest = adr Destination à
byte* Dest=y_pos*Largeur_ecran+x_pos+Ecran; // Dest = adr Destination à
// l'écran
byte* Src=Largeur_brosse*y_offset+x_offset+Brosse; // Src = adr ds
// la brosse
@ -191,13 +191,13 @@ void Display_brush_Mono_Simple(word Pos_X, word Pos_Y,
Src+=Largeur_brosse-width;
Dest+=Largeur_ecran-width;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
void Clear_brush_Simple(word Pos_X,word Pos_Y,__attribute__((unused)) word x_offset,__attribute__((unused)) word y_offset,word width,word height,__attribute__((unused))byte Couleur_de_transparence,word image_width)
void Clear_brush_Simple(word x_pos,word y_pos,__attribute__((unused)) word x_offset,__attribute__((unused)) word y_offset,word width,word height,__attribute__((unused))byte Couleur_de_transparence,word image_width)
{
byte* Dest=Ecran+Pos_X+Pos_Y*Largeur_ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src = ( Pos_Y + Principal_Decalage_Y ) * image_width + Pos_X + Principal_Decalage_X + Principal_Ecran; //Coords de départ ds la source (Src)
byte* Dest=Ecran+x_pos+y_pos*Largeur_ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src = ( y_pos + Principal_Decalage_Y ) * image_width + x_pos + Principal_Decalage_X + Principal_Ecran; //Coords de départ ds la source (Src)
int y;
for(y=height;y!=0;y--)
@ -210,14 +210,14 @@ void Clear_brush_Simple(word Pos_X,word Pos_Y,__attribute__((unused)) word x_off
Src+=image_width;
Dest+=Largeur_ecran;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
// Affiche une brosse (arbitraire) à l'écran
void Affiche_brosse_Simple(byte * brush, word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
void Affiche_brosse_Simple(byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
{
// Dest = Position à l'écran
byte* Dest = Ecran + Pos_Y * Largeur_ecran + Pos_X;
byte* Dest = Ecran + y_pos * Largeur_ecran + x_pos;
// Src = Position dans la brosse
byte* Src = brush + y_offset * Largeur_brosse + x_offset;
@ -245,10 +245,10 @@ void Affiche_brosse_Simple(byte * brush, word Pos_X,word Pos_Y,word x_offset,wor
}
}
void Remap_screen_Simple(word Pos_X,word Pos_Y,word width,word height,byte * Table_de_conversion)
void Remap_screen_Simple(word x_pos,word y_pos,word width,word height,byte * Table_de_conversion)
{
// Dest = coords a l'écran
byte* Dest = Ecran + Pos_Y * Largeur_ecran + Pos_X;
byte* Dest = Ecran + y_pos * Largeur_ecran + x_pos;
int x,y;
// Pour chaque ligne
@ -264,22 +264,22 @@ void Remap_screen_Simple(word Pos_X,word Pos_Y,word width,word height,byte * Tab
Dest = Dest + Largeur_ecran - width;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
void Afficher_une_ligne_ecran_Simple(word Pos_X,word Pos_Y,word width,byte * line)
void Afficher_une_ligne_ecran_Simple(word x_pos,word y_pos,word width,byte * line)
/* On affiche toute une ligne de pixels. Utilisé pour les textes. */
{
memcpy(Ecran+Pos_X+Pos_Y*Largeur_ecran,line,width);
memcpy(Ecran+x_pos+y_pos*Largeur_ecran,line,width);
}
void Afficher_une_ligne_transparente_mono_a_l_ecran_Simple(
word Pos_X, word Pos_Y, word width, byte* line,
word x_pos, word y_pos, word width, byte* line,
byte Couleur_transparence, byte Couleur)
// Affiche une ligne à l'écran avec une couleur + transparence.
// Utilisé par les brosses en mode zoom
{
byte* Dest = Ecran+ Pos_Y * Largeur_ecran + Pos_X;
byte* Dest = Ecran+ y_pos * Largeur_ecran + x_pos;
int x;
// Pour chaque pixel
for(x=0;x<width;x++)
@ -291,9 +291,9 @@ void Afficher_une_ligne_transparente_mono_a_l_ecran_Simple(
}
}
void Lire_une_ligne_ecran_Simple(word Pos_X,word Pos_Y,word width,byte * line)
void Lire_une_ligne_ecran_Simple(word x_pos,word y_pos,word width,byte * line)
{
memcpy(line,Largeur_ecran * Pos_Y + Pos_X + Ecran,width);
memcpy(line,Largeur_ecran * y_pos + x_pos + Ecran,width);
}
void Afficher_partie_de_l_ecran_zoomee_Simple(
@ -336,10 +336,10 @@ void Afficher_partie_de_l_ecran_zoomee_Simple(
// ATTENTION on n'arrive jamais ici !
}
void Afficher_une_ligne_transparente_a_l_ecran_Simple(word Pos_X,word Pos_Y,word width,byte* line,byte Couleur_transparence)
void Afficher_une_ligne_transparente_a_l_ecran_Simple(word x_pos,word y_pos,word width,byte* line,byte Couleur_transparence)
{
byte* Src = line;
byte* Dest = Ecran + Pos_Y * Largeur_ecran + Pos_X;
byte* Dest = Ecran + y_pos * Largeur_ecran + x_pos;
word x;
@ -354,7 +354,7 @@ void Afficher_une_ligne_transparente_a_l_ecran_Simple(word Pos_X,word Pos_Y,word
}
// Affiche une partie de la brosse couleur zoomée
void Display_brush_Color_zoom_Simple(word Pos_X,word Pos_Y,
void Display_brush_Color_zoom_Simple(word x_pos,word y_pos,
word x_offset,word y_offset,
word width, // width non zoomée
word Pos_Y_Fin,byte Couleur_de_transparence,
@ -362,7 +362,7 @@ void Display_brush_Color_zoom_Simple(word Pos_X,word Pos_Y,
byte * Buffer)
{
byte* Src = Brosse+y_offset*Largeur_brosse + x_offset;
word y = Pos_Y;
word y = y_pos;
byte bx;
// Pour chaque ligne
@ -372,7 +372,7 @@ void Display_brush_Color_zoom_Simple(word Pos_X,word Pos_Y,
// On affiche facteur fois la ligne zoomée
for(bx=Loupe_Facteur;bx>0;bx--)
{
Afficher_une_ligne_transparente_a_l_ecran_Simple(Pos_X,y,width*Loupe_Facteur,Buffer,Couleur_de_transparence);
Afficher_une_ligne_transparente_a_l_ecran_Simple(x_pos,y,width*Loupe_Facteur,Buffer,Couleur_de_transparence);
y++;
if(y==Pos_Y_Fin)
{
@ -384,7 +384,7 @@ void Display_brush_Color_zoom_Simple(word Pos_X,word Pos_Y,
// ATTENTION zone jamais atteinte
}
void Display_brush_Mono_zoom_Simple(word Pos_X, word Pos_Y,
void Display_brush_Mono_zoom_Simple(word x_pos, word y_pos,
word x_offset, word y_offset,
word width, // width non zoomée
word Pos_Y_Fin,
@ -395,7 +395,7 @@ void Display_brush_Mono_zoom_Simple(word Pos_X, word Pos_Y,
{
byte* Src = Brosse + y_offset * Largeur_brosse + x_offset;
int y=Pos_Y;
int y=y_pos;
//Pour chaque ligne à zoomer :
while(1)
@ -414,7 +414,7 @@ void Display_brush_Mono_zoom_Simple(word Pos_X, word Pos_Y,
{
// On affiche la ligne zoomée
Afficher_une_ligne_transparente_mono_a_l_ecran_Simple(
Pos_X, y, width * Loupe_Facteur,
x_pos, y, width * Loupe_Facteur,
Buffer, Couleur_de_transparence, Couleur
);
// On passe à la ligne suivante
@ -422,8 +422,8 @@ void Display_brush_Mono_zoom_Simple(word Pos_X, word Pos_Y,
// On vérifie qu'on est pas à la ligne finale
if(y == Pos_Y_Fin)
{
UpdateRect( Pos_X, Pos_Y,
width * Loupe_Facteur, Pos_Y_Fin - Pos_Y );
UpdateRect( x_pos, y_pos,
width * Loupe_Facteur, Pos_Y_Fin - y_pos );
return;
}
BX --;
@ -435,11 +435,11 @@ void Display_brush_Mono_zoom_Simple(word Pos_X, word Pos_Y,
}
}
void Clear_brush_zoom_Simple(word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,__attribute__((unused)) byte Couleur_de_transparence,word image_width,byte * Buffer)
void Clear_brush_zoom_Simple(word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,__attribute__((unused)) byte Couleur_de_transparence,word image_width,byte * Buffer)
{
// En fait on va recopier l'image non zoomée dans la partie zoomée !
byte* Src = Principal_Ecran + y_offset * image_width + x_offset;
int y = Pos_Y;
int y = y_pos;
int bx;
// Pour chaque ligne à zoomer
@ -450,15 +450,15 @@ void Clear_brush_zoom_Simple(word Pos_X,word Pos_Y,word x_offset,word y_offset,w
// Pour chaque ligne
do{
Afficher_une_ligne_ecran_Simple(Pos_X,y,
Afficher_une_ligne_ecran_Simple(x_pos,y,
width * Loupe_Facteur,Buffer);
// Ligne suivante
y++;
if(y==Pos_Y_Fin)
{
UpdateRect(Pos_X,Pos_Y,
width*Loupe_Facteur,Pos_Y_Fin-Pos_Y);
UpdateRect(x_pos,y_pos,
width*Loupe_Facteur,Pos_Y_Fin-y_pos);
return;
}
bx--;

View File

@ -26,22 +26,22 @@
void Block_Simple (word Debut_X,word Debut_Y,word width,word height,byte Couleur);
void Pixel_Preview_Normal_Simple (word X,word Y,byte Couleur);
void Pixel_Preview_Loupe_Simple (word X,word Y,byte Couleur);
void Ligne_horizontale_XOR_Simple (word Pos_X,word Pos_Y,word width);
void Ligne_verticale_XOR_Simple (word Pos_X,word Pos_Y,word height);
void Display_brush_Color_Simple (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Display_brush_Mono_Simple (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse);
void Clear_brush_Simple (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word image_width);
void Remap_screen_Simple (word Pos_X,word Pos_Y,word width,word height,byte * Table_de_conversion);
void Ligne_horizontale_XOR_Simple (word x_pos,word y_pos,word width);
void Ligne_verticale_XOR_Simple (word x_pos,word y_pos,word height);
void Display_brush_Color_Simple (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Display_brush_Mono_Simple (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse);
void Clear_brush_Simple (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word image_width);
void Remap_screen_Simple (word x_pos,word y_pos,word width,word height,byte * Table_de_conversion);
void Afficher_partie_de_l_ecran_Simple (word width,word height,word image_width);
void Afficher_une_ligne_ecran_Simple (word Pos_X,word Pos_Y,word width,byte * line);
void Lire_une_ligne_ecran_Simple (word Pos_X,word Pos_Y,word width,byte * line);
void Afficher_une_ligne_ecran_Simple (word x_pos,word y_pos,word width,byte * line);
void Lire_une_ligne_ecran_Simple (word x_pos,word y_pos,word width,byte * line);
void Afficher_partie_de_l_ecran_zoomee_Simple(word width,word height,word image_width,byte * Buffer);
void Display_brush_Color_zoom_Simple (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_brosse,byte * Buffer);
void Display_brush_Mono_zoom_Simple (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse,byte * Buffer);
void Clear_brush_zoom_Simple (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word image_width,byte * Buffer);
void Affiche_brosse_Simple (byte * brush, word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Display_brush_Color_zoom_Simple (word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_brosse,byte * Buffer);
void Display_brush_Mono_zoom_Simple (word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse,byte * Buffer);
void Clear_brush_zoom_Simple (word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word image_width,byte * Buffer);
void Affiche_brosse_Simple (byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Afficher_une_ligne_transparente_mono_a_l_ecran_Simple(
word Pos_X, word Pos_Y, word width, byte* line,
word x_pos, word y_pos, word width, byte* line,
byte Couleur_transparence, byte Couleur);
void Afficher_une_ligne_transparente_a_l_ecran_Simple(word Pos_X,word Pos_Y,word width,byte* line,byte Couleur_transparence);
void Afficher_une_ligne_transparente_a_l_ecran_Simple(word x_pos,word y_pos,word width,byte* line,byte Couleur_transparence);

View File

@ -112,36 +112,36 @@ void Pixel_Preview_Loupe_Tall (word X,word Y,byte Couleur)
}
}
void Ligne_horizontale_XOR_Tall(word Pos_X,word Pos_Y,word width)
void Ligne_horizontale_XOR_Tall(word x_pos,word y_pos,word width)
{
//On calcule la valeur initiale de Dest:
byte* Dest=Pos_Y*2*Largeur_ecran+Pos_X+Ecran;
byte* Dest=y_pos*2*Largeur_ecran+x_pos+Ecran;
int X;
for (X=0;X<width;X++)
*(Dest+X)=~*(Dest+X);
Dest=(Pos_Y*2+1)*Largeur_ecran+Pos_X+Ecran;
Dest=(y_pos*2+1)*Largeur_ecran+x_pos+Ecran;
for (X=0;X<width;X++)
*(Dest+X)=~*(Dest+X);
}
void Ligne_verticale_XOR_Tall(word Pos_X,word Pos_Y,word height)
void Ligne_verticale_XOR_Tall(word x_pos,word y_pos,word height)
{
int i;
byte color;
for (i=Pos_Y*2;i<(Pos_Y+height)*2;i++)
for (i=y_pos*2;i<(y_pos+height)*2;i++)
{
color=*(Ecran+Pos_X+i*Largeur_ecran);
*(Ecran+Pos_X+i*Largeur_ecran)=~color;
color=*(Ecran+x_pos+i*Largeur_ecran);
*(Ecran+x_pos+i*Largeur_ecran)=~color;
}
}
void Display_brush_Color_Tall(word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
void Display_brush_Color_Tall(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
{
// Dest = Position à l'écran
byte* Dest = Ecran + Pos_Y * 2 * Largeur_ecran + Pos_X;
byte* Dest = Ecran + y_pos * 2 * Largeur_ecran + x_pos;
// Src = Position dans la brosse
byte* Src = Brosse + y_offset * Largeur_brosse + x_offset;
@ -168,15 +168,15 @@ void Display_brush_Color_Tall(word Pos_X,word Pos_Y,word x_offset,word y_offset,
Dest = Dest + 2 * Largeur_ecran - width;
Src = Src + Largeur_brosse - width;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
void Display_brush_Mono_Tall(word Pos_X, word Pos_Y,
void Display_brush_Mono_Tall(word x_pos, word y_pos,
word x_offset, word y_offset, word width, word height,
byte Couleur_de_transparence, byte Couleur, word Largeur_brosse)
/* On affiche la brosse en monochrome */
{
byte* Dest=Pos_Y*2*Largeur_ecran+Pos_X+Ecran; // Dest = adr Destination à
byte* Dest=y_pos*2*Largeur_ecran+x_pos+Ecran; // Dest = adr Destination à
// l'écran
byte* Src=Largeur_brosse*y_offset+x_offset+Brosse; // Src = adr ds
// la brosse
@ -203,13 +203,13 @@ void Display_brush_Mono_Tall(word Pos_X, word Pos_Y,
Src+=Largeur_brosse-width;
Dest+=2*Largeur_ecran-width;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
void Clear_brush_Tall(word Pos_X,word Pos_Y,__attribute__((unused)) word x_offset,__attribute__((unused)) word y_offset,word width,word height,__attribute__((unused))byte Couleur_de_transparence,word image_width)
void Clear_brush_Tall(word x_pos,word y_pos,__attribute__((unused)) word x_offset,__attribute__((unused)) word y_offset,word width,word height,__attribute__((unused))byte Couleur_de_transparence,word image_width)
{
byte* Dest=Ecran+Pos_X+Pos_Y*2*Largeur_ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src = ( Pos_Y + Principal_Decalage_Y ) * image_width + Pos_X + Principal_Decalage_X + Principal_Ecran; //Coords de départ ds la source (Src)
byte* Dest=Ecran+x_pos+y_pos*2*Largeur_ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src = ( y_pos + Principal_Decalage_Y ) * image_width + x_pos + Principal_Decalage_X + Principal_Ecran; //Coords de départ ds la source (Src)
int y;
for(y=height;y!=0;y--)
@ -224,14 +224,14 @@ void Clear_brush_Tall(word Pos_X,word Pos_Y,__attribute__((unused)) word x_offse
Src+=image_width;
Dest+=Largeur_ecran;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
// Affiche une brosse (arbitraire) à l'écran
void Affiche_brosse_Tall(byte * brush, word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
void Affiche_brosse_Tall(byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
{
// Dest = Position à l'écran
byte* Dest = Ecran + Pos_Y * 2 * Largeur_ecran + Pos_X;
byte* Dest = Ecran + y_pos * 2 * Largeur_ecran + x_pos;
// Src = Position dans la brosse
byte* Src = brush + y_offset * Largeur_brosse + x_offset;
@ -260,10 +260,10 @@ void Affiche_brosse_Tall(byte * brush, word Pos_X,word Pos_Y,word x_offset,word
}
}
void Remap_screen_Tall(word Pos_X,word Pos_Y,word width,word height,byte * Table_de_conversion)
void Remap_screen_Tall(word x_pos,word y_pos,word width,word height,byte * Table_de_conversion)
{
// Dest = coords a l'écran
byte* Dest = Ecran + Pos_Y * 2 * Largeur_ecran + Pos_X;
byte* Dest = Ecran + y_pos * 2 * Largeur_ecran + x_pos;
int x,y;
// Pour chaque ligne
@ -279,19 +279,19 @@ void Remap_screen_Tall(word Pos_X,word Pos_Y,word width,word height,byte * Table
Dest = Dest + Largeur_ecran - width;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
void Afficher_une_ligne_ecran_Tall(word Pos_X,word Pos_Y,word width,byte * line)
void Afficher_une_ligne_ecran_Tall(word x_pos,word y_pos,word width,byte * line)
/* On affiche toute une ligne de pixels. Utilisé pour les textes. */
{
memcpy(Ecran+Pos_X+Pos_Y*2*Largeur_ecran,line,width);
memcpy(Ecran+Pos_X+(Pos_Y*2+1)*Largeur_ecran,line,width);
memcpy(Ecran+x_pos+y_pos*2*Largeur_ecran,line,width);
memcpy(Ecran+x_pos+(y_pos*2+1)*Largeur_ecran,line,width);
}
void Lire_une_ligne_ecran_Tall(word Pos_X,word Pos_Y,word width,byte * line)
void Lire_une_ligne_ecran_Tall(word x_pos,word y_pos,word width,byte * line)
{
memcpy(line,Largeur_ecran * 2 * Pos_Y + Pos_X + Ecran,width);
memcpy(line,Largeur_ecran * 2 * y_pos + x_pos + Ecran,width);
}
void Afficher_partie_de_l_ecran_zoomee_Tall(
@ -335,7 +335,7 @@ void Afficher_partie_de_l_ecran_zoomee_Tall(
}
// Affiche une partie de la brosse couleur zoomée
void Display_brush_Color_zoom_Tall(word Pos_X,word Pos_Y,
void Display_brush_Color_zoom_Tall(word x_pos,word y_pos,
word x_offset,word y_offset,
word width, // width non zoomée
word Pos_Y_Fin,byte Couleur_de_transparence,
@ -343,7 +343,7 @@ void Display_brush_Color_zoom_Tall(word Pos_X,word Pos_Y,
byte * Buffer)
{
byte* Src = Brosse+y_offset*Largeur_brosse + x_offset;
word y = Pos_Y;
word y = y_pos;
byte bx;
// Pour chaque ligne
@ -353,8 +353,8 @@ void Display_brush_Color_zoom_Tall(word Pos_X,word Pos_Y,
// On affiche facteur fois la ligne zoomée
for(bx=Loupe_Facteur;bx>0;bx--)
{
Afficher_une_ligne_transparente_a_l_ecran_Simple(Pos_X,y*2,width*Loupe_Facteur,Buffer,Couleur_de_transparence);
memcpy(Ecran + (y*2 +1) * Largeur_ecran + Pos_X, Ecran + y*2* Largeur_ecran + Pos_X, width*Loupe_Facteur);
Afficher_une_ligne_transparente_a_l_ecran_Simple(x_pos,y*2,width*Loupe_Facteur,Buffer,Couleur_de_transparence);
memcpy(Ecran + (y*2 +1) * Largeur_ecran + x_pos, Ecran + y*2* Largeur_ecran + x_pos, width*Loupe_Facteur);
y++;
if(y==Pos_Y_Fin)
{
@ -366,7 +366,7 @@ void Display_brush_Color_zoom_Tall(word Pos_X,word Pos_Y,
// ATTENTION zone jamais atteinte
}
void Display_brush_Mono_zoom_Tall(word Pos_X, word Pos_Y,
void Display_brush_Mono_zoom_Tall(word x_pos, word y_pos,
word x_offset, word y_offset,
word width, // width non zoomée
word Pos_Y_Fin,
@ -377,7 +377,7 @@ void Display_brush_Mono_zoom_Tall(word Pos_X, word Pos_Y,
{
byte* Src = Brosse + y_offset * Largeur_brosse + x_offset;
int y=Pos_Y*2;
int y=y_pos*2;
//Pour chaque ligne à zoomer :
while(1)
@ -396,7 +396,7 @@ void Display_brush_Mono_zoom_Tall(word Pos_X, word Pos_Y,
{
// On affiche la ligne zoomée
Afficher_une_ligne_transparente_mono_a_l_ecran_Simple(
Pos_X, y, width * Loupe_Facteur,
x_pos, y, width * Loupe_Facteur,
Buffer, Couleur_de_transparence, Couleur
);
// On passe à la ligne suivante
@ -404,8 +404,8 @@ void Display_brush_Mono_zoom_Tall(word Pos_X, word Pos_Y,
// On vérifie qu'on est pas à la ligne finale
if(y == Pos_Y_Fin*2)
{
UpdateRect( Pos_X, Pos_Y,
width * Loupe_Facteur, Pos_Y_Fin - Pos_Y );
UpdateRect( x_pos, y_pos,
width * Loupe_Facteur, Pos_Y_Fin - y_pos );
return;
}
BX --;
@ -417,11 +417,11 @@ void Display_brush_Mono_zoom_Tall(word Pos_X, word Pos_Y,
}
}
void Clear_brush_zoom_Tall(word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,__attribute__((unused)) byte Couleur_de_transparence,word image_width,byte * Buffer)
void Clear_brush_zoom_Tall(word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,__attribute__((unused)) byte Couleur_de_transparence,word image_width,byte * Buffer)
{
// En fait on va recopier l'image non zoomée dans la partie zoomée !
byte* Src = Principal_Ecran + y_offset * image_width + x_offset;
int y = Pos_Y;
int y = y_pos;
int bx;
// Pour chaque ligne à zoomer
@ -432,15 +432,15 @@ void Clear_brush_zoom_Tall(word Pos_X,word Pos_Y,word x_offset,word y_offset,wor
// Pour chaque ligne
do{
Afficher_une_ligne_ecran_Tall(Pos_X,y,
Afficher_une_ligne_ecran_Tall(x_pos,y,
width * Loupe_Facteur,Buffer);
// Ligne suivante
y++;
if(y==Pos_Y_Fin)
{
UpdateRect(Pos_X,Pos_Y,
width*Loupe_Facteur,Pos_Y_Fin-Pos_Y);
UpdateRect(x_pos,y_pos,
width*Loupe_Facteur,Pos_Y_Fin-y_pos);
return;
}
bx--;

View File

@ -26,17 +26,17 @@
void Block_Tall (word Debut_X,word Debut_Y,word width,word height,byte Couleur);
void Pixel_Preview_Normal_Tall (word X,word Y,byte Couleur);
void Pixel_Preview_Loupe_Tall (word X,word Y,byte Couleur);
void Ligne_horizontale_XOR_Tall (word Pos_X,word Pos_Y,word width);
void Ligne_verticale_XOR_Tall (word Pos_X,word Pos_Y,word height);
void Display_brush_Color_Tall (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Display_brush_Mono_Tall (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse);
void Clear_brush_Tall (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word image_width);
void Remap_screen_Tall (word Pos_X,word Pos_Y,word width,word height,byte * Table_de_conversion);
void Ligne_horizontale_XOR_Tall (word x_pos,word y_pos,word width);
void Ligne_verticale_XOR_Tall (word x_pos,word y_pos,word height);
void Display_brush_Color_Tall (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Display_brush_Mono_Tall (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse);
void Clear_brush_Tall (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word image_width);
void Remap_screen_Tall (word x_pos,word y_pos,word width,word height,byte * Table_de_conversion);
void Afficher_partie_de_l_ecran_Tall (word width,word height,word image_width);
void Afficher_une_ligne_ecran_Tall (word Pos_X,word Pos_Y,word width,byte * line);
void Lire_une_ligne_ecran_Tall (word Pos_X,word Pos_Y,word width,byte * line);
void Afficher_une_ligne_ecran_Tall (word x_pos,word y_pos,word width,byte * line);
void Lire_une_ligne_ecran_Tall (word x_pos,word y_pos,word width,byte * line);
void Afficher_partie_de_l_ecran_zoomee_Tall(word width,word height,word image_width,byte * Buffer);
void Display_brush_Color_zoom_Tall (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_brosse,byte * Buffer);
void Display_brush_Mono_zoom_Tall (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse,byte * Buffer);
void Clear_brush_zoom_Tall (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word image_width,byte * Buffer);
void Affiche_brosse_Tall (byte * brush, word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Display_brush_Color_zoom_Tall (word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_brosse,byte * Buffer);
void Display_brush_Mono_zoom_Tall (word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse,byte * Buffer);
void Clear_brush_zoom_Tall (word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word image_width,byte * Buffer);
void Affiche_brosse_Tall (byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);

View File

@ -115,10 +115,10 @@ void Pixel_Preview_Loupe_Wide (word X,word Y,byte Couleur)
}
}
void Ligne_horizontale_XOR_Wide(word Pos_X,word Pos_Y,word width)
void Ligne_horizontale_XOR_Wide(word x_pos,word y_pos,word width)
{
//On calcule la valeur initiale de Dest:
byte* Dest=Pos_Y*2*Largeur_ecran+Pos_X*2+Ecran;
byte* Dest=y_pos*2*Largeur_ecran+x_pos*2+Ecran;
int X;
@ -126,11 +126,11 @@ void Ligne_horizontale_XOR_Wide(word Pos_X,word Pos_Y,word width)
*(Dest+X+1)=*(Dest+X)=~*(Dest+X);
}
void Ligne_verticale_XOR_Wide(word Pos_X,word Pos_Y,word height)
void Ligne_verticale_XOR_Wide(word x_pos,word y_pos,word height)
{
int i;
byte color;
byte *Dest=Ecran+Pos_X*2+Pos_Y*Largeur_ecran*2;
byte *Dest=Ecran+x_pos*2+y_pos*Largeur_ecran*2;
for (i=height;i>0;i--)
{
color=~*Dest;
@ -140,10 +140,10 @@ void Ligne_verticale_XOR_Wide(word Pos_X,word Pos_Y,word height)
}
}
void Display_brush_Color_Wide(word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
void Display_brush_Color_Wide(word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
{
// Dest = Position à l'écran
byte* Dest = Ecran + Pos_Y * 2 * Largeur_ecran + Pos_X * 2;
byte* Dest = Ecran + y_pos * 2 * Largeur_ecran + x_pos * 2;
// Src = Position dans la brosse
byte* Src = Brosse + y_offset * Largeur_brosse + x_offset;
@ -170,15 +170,15 @@ void Display_brush_Color_Wide(word Pos_X,word Pos_Y,word x_offset,word y_offset,
Dest = Dest + (Largeur_ecran - width)*2;
Src = Src + Largeur_brosse - width;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
void Display_brush_Mono_Wide(word Pos_X, word Pos_Y,
void Display_brush_Mono_Wide(word x_pos, word y_pos,
word x_offset, word y_offset, word width, word height,
byte Couleur_de_transparence, byte Couleur, word Largeur_brosse)
/* On affiche la brosse en monochrome */
{
byte* Dest=Pos_Y*2*Largeur_ecran+Pos_X*2+Ecran; // Dest = adr Destination à
byte* Dest=y_pos*2*Largeur_ecran+x_pos*2+Ecran; // Dest = adr Destination à
// l'écran
byte* Src=Largeur_brosse*y_offset+x_offset+Brosse; // Src = adr ds
// la brosse
@ -202,13 +202,13 @@ void Display_brush_Mono_Wide(word Pos_X, word Pos_Y,
Src+=Largeur_brosse-width;
Dest+=(Largeur_ecran-width)*2;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
void Clear_brush_Wide(word Pos_X,word Pos_Y,__attribute__((unused)) word x_offset,__attribute__((unused)) word y_offset,word width,word height,__attribute__((unused))byte Couleur_de_transparence,word image_width)
void Clear_brush_Wide(word x_pos,word y_pos,__attribute__((unused)) word x_offset,__attribute__((unused)) word y_offset,word width,word height,__attribute__((unused))byte Couleur_de_transparence,word image_width)
{
byte* Dest=Ecran+Pos_X*2+Pos_Y*2*Largeur_ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src = ( Pos_Y + Principal_Decalage_Y ) * image_width + Pos_X + Principal_Decalage_X + Principal_Ecran; //Coords de départ ds la source (Src)
byte* Dest=Ecran+x_pos*2+y_pos*2*Largeur_ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src = ( y_pos + Principal_Decalage_Y ) * image_width + x_pos + Principal_Decalage_X + Principal_Ecran; //Coords de départ ds la source (Src)
int y;
int x;
@ -229,14 +229,14 @@ void Clear_brush_Wide(word Pos_X,word Pos_Y,__attribute__((unused)) word x_offse
Src+=image_width-width;
Dest+=(Largeur_ecran-width)*2;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
// Affiche une brosse (arbitraire) à l'écran
void Affiche_brosse_Wide(byte * brush, word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
void Affiche_brosse_Wide(byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse)
{
// Dest = Position à l'écran
byte* Dest = Ecran + Pos_Y * 2 * Largeur_ecran + Pos_X * 2;
byte* Dest = Ecran + y_pos * 2 * Largeur_ecran + x_pos * 2;
// Src = Position dans la brosse
byte* Src = brush + y_offset * Largeur_brosse + x_offset;
@ -264,10 +264,10 @@ void Affiche_brosse_Wide(byte * brush, word Pos_X,word Pos_Y,word x_offset,word
}
}
void Remap_screen_Wide(word Pos_X,word Pos_Y,word width,word height,byte * Table_de_conversion)
void Remap_screen_Wide(word x_pos,word y_pos,word width,word height,byte * Table_de_conversion)
{
// Dest = coords a l'écran
byte* Dest = Ecran + Pos_Y * 2 * Largeur_ecran + Pos_X * 2;
byte* Dest = Ecran + y_pos * 2 * Largeur_ecran + x_pos * 2;
int x,y;
// Pour chaque ligne
@ -283,22 +283,22 @@ void Remap_screen_Wide(word Pos_X,word Pos_Y,word width,word height,byte * Table
Dest = Dest + (Largeur_ecran - width)*2;
}
UpdateRect(Pos_X,Pos_Y,width,height);
UpdateRect(x_pos,y_pos,width,height);
}
void Afficher_une_ligne_ecran_fast_Wide(word Pos_X,word Pos_Y,word width,byte * line)
void Afficher_une_ligne_ecran_fast_Wide(word x_pos,word y_pos,word width,byte * line)
/* On affiche toute une ligne de pixels telle quelle. */
/* Utilisée si le buffer contient déja des pixel doublés. */
{
memcpy(Ecran+Pos_X*2+Pos_Y*2*Largeur_ecran,line,width*2);
memcpy(Ecran+x_pos*2+y_pos*2*Largeur_ecran,line,width*2);
}
void Afficher_une_ligne_ecran_Wide(word Pos_X,word Pos_Y,word width,byte * line)
void Afficher_une_ligne_ecran_Wide(word x_pos,word y_pos,word width,byte * line)
/* On affiche une ligne de pixels en les doublant. */
{
int x;
byte *Dest;
Dest=Ecran+Pos_X*2+Pos_Y*2*Largeur_ecran;
Dest=Ecran+x_pos*2+y_pos*2*Largeur_ecran;
for(x=width;x>0;x--)
{
*Dest=*line;
@ -309,12 +309,12 @@ void Afficher_une_ligne_ecran_Wide(word Pos_X,word Pos_Y,word width,byte * line)
}
}
void Afficher_une_ligne_transparente_mono_a_l_ecran_Wide(
word Pos_X, word Pos_Y, word width, byte* line,
word x_pos, word y_pos, word width, byte* line,
byte Couleur_transparence, byte Couleur)
// Affiche une ligne à l'écran avec une couleur + transparence.
// Utilisé par les brosses en mode zoom
{
byte* Dest = Ecran+ Pos_Y*2 * Largeur_ecran + Pos_X*2;
byte* Dest = Ecran+ y_pos*2 * Largeur_ecran + x_pos*2;
int x;
// Pour chaque pixel
for(x=0;x<width;x++)
@ -329,9 +329,9 @@ void Afficher_une_ligne_transparente_mono_a_l_ecran_Wide(
}
}
void Lire_une_ligne_ecran_Wide(word Pos_X,word Pos_Y,word width,byte * line)
void Lire_une_ligne_ecran_Wide(word x_pos,word y_pos,word width,byte * line)
{
memcpy(line,Largeur_ecran * 2 * Pos_Y + Pos_X * 2 + Ecran,width*2);
memcpy(line,Largeur_ecran * 2 * y_pos + x_pos * 2 + Ecran,width*2);
}
void Afficher_partie_de_l_ecran_zoomee_Wide(
@ -374,10 +374,10 @@ void Afficher_partie_de_l_ecran_zoomee_Wide(
// ATTENTION on n'arrive jamais ici !
}
void Afficher_une_ligne_transparente_a_l_ecran_Wide(word Pos_X,word Pos_Y,word width,byte* line,byte Couleur_transparence)
void Afficher_une_ligne_transparente_a_l_ecran_Wide(word x_pos,word y_pos,word width,byte* line,byte Couleur_transparence)
{
byte* Src = line;
byte* Dest = Ecran + Pos_Y * 2 * Largeur_ecran + Pos_X * 2;
byte* Dest = Ecran + y_pos * 2 * Largeur_ecran + x_pos * 2;
word x;
@ -395,7 +395,7 @@ void Afficher_une_ligne_transparente_a_l_ecran_Wide(word Pos_X,word Pos_Y,word w
}
// Affiche une partie de la brosse couleur zoomée
void Display_brush_Color_zoom_Wide(word Pos_X,word Pos_Y,
void Display_brush_Color_zoom_Wide(word x_pos,word y_pos,
word x_offset,word y_offset,
word width, // width non zoomée
word Pos_Y_Fin,byte Couleur_de_transparence,
@ -403,7 +403,7 @@ void Display_brush_Color_zoom_Wide(word Pos_X,word Pos_Y,
byte * Buffer)
{
byte* Src = Brosse+y_offset*Largeur_brosse + x_offset;
word y = Pos_Y;
word y = y_pos;
byte bx;
// Pour chaque ligne
@ -413,7 +413,7 @@ void Display_brush_Color_zoom_Wide(word Pos_X,word Pos_Y,
// On affiche facteur fois la ligne zoomée
for(bx=Loupe_Facteur;bx>0;bx--)
{
Afficher_une_ligne_transparente_a_l_ecran_Wide(Pos_X,y,width*Loupe_Facteur,Buffer,Couleur_de_transparence);
Afficher_une_ligne_transparente_a_l_ecran_Wide(x_pos,y,width*Loupe_Facteur,Buffer,Couleur_de_transparence);
y++;
if(y==Pos_Y_Fin)
{
@ -425,7 +425,7 @@ void Display_brush_Color_zoom_Wide(word Pos_X,word Pos_Y,
// ATTENTION zone jamais atteinte
}
void Display_brush_Mono_zoom_Wide(word Pos_X, word Pos_Y,
void Display_brush_Mono_zoom_Wide(word x_pos, word y_pos,
word x_offset, word y_offset,
word width, // width non zoomée
word Pos_Y_Fin,
@ -436,7 +436,7 @@ void Display_brush_Mono_zoom_Wide(word Pos_X, word Pos_Y,
{
byte* Src = Brosse + y_offset * Largeur_brosse + x_offset;
int y=Pos_Y;
int y=y_pos;
//Pour chaque ligne à zoomer :
while(1)
@ -455,7 +455,7 @@ void Display_brush_Mono_zoom_Wide(word Pos_X, word Pos_Y,
{
// On affiche la ligne zoomée
Afficher_une_ligne_transparente_mono_a_l_ecran_Wide(
Pos_X, y, width * Loupe_Facteur,
x_pos, y, width * Loupe_Facteur,
Buffer, Couleur_de_transparence, Couleur
);
// On passe à la ligne suivante
@ -463,8 +463,8 @@ void Display_brush_Mono_zoom_Wide(word Pos_X, word Pos_Y,
// On vérifie qu'on est pas à la ligne finale
if(y == Pos_Y_Fin)
{
UpdateRect( Pos_X, Pos_Y,
width * Loupe_Facteur, Pos_Y_Fin - Pos_Y );
UpdateRect( x_pos, y_pos,
width * Loupe_Facteur, Pos_Y_Fin - y_pos );
return;
}
BX --;
@ -476,11 +476,11 @@ void Display_brush_Mono_zoom_Wide(word Pos_X, word Pos_Y,
}
}
void Clear_brush_zoom_Wide(word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,__attribute__((unused)) byte Couleur_de_transparence,word image_width,byte * Buffer)
void Clear_brush_zoom_Wide(word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,__attribute__((unused)) byte Couleur_de_transparence,word image_width,byte * Buffer)
{
// En fait on va recopier l'image non zoomée dans la partie zoomée !
byte* Src = Principal_Ecran + y_offset * image_width + x_offset;
int y = Pos_Y;
int y = y_pos;
int bx;
// Pour chaque ligne à zoomer
@ -491,15 +491,15 @@ void Clear_brush_zoom_Wide(word Pos_X,word Pos_Y,word x_offset,word y_offset,wor
// Pour chaque ligne
do{
Afficher_une_ligne_ecran_fast_Wide(Pos_X,y,
Afficher_une_ligne_ecran_fast_Wide(x_pos,y,
width * Loupe_Facteur,Buffer);
// Ligne suivante
y++;
if(y==Pos_Y_Fin)
{
UpdateRect(Pos_X,Pos_Y,
width*Loupe_Facteur,Pos_Y_Fin-Pos_Y);
UpdateRect(x_pos,y_pos,
width*Loupe_Facteur,Pos_Y_Fin-y_pos);
return;
}
bx--;

View File

@ -26,20 +26,20 @@
void Block_Wide (word Debut_X,word Debut_Y,word width,word height,byte Couleur);
void Pixel_Preview_Normal_Wide (word X,word Y,byte Couleur);
void Pixel_Preview_Loupe_Wide (word X,word Y,byte Couleur);
void Ligne_horizontale_XOR_Wide (word Pos_X,word Pos_Y,word width);
void Ligne_verticale_XOR_Wide (word Pos_X,word Pos_Y,word height);
void Display_brush_Color_Wide (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Display_brush_Mono_Wide (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse);
void Clear_brush_Wide (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word image_width);
void Remap_screen_Wide (word Pos_X,word Pos_Y,word width,word height,byte * Table_de_conversion);
void Ligne_horizontale_XOR_Wide (word x_pos,word y_pos,word width);
void Ligne_verticale_XOR_Wide (word x_pos,word y_pos,word height);
void Display_brush_Color_Wide (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Display_brush_Mono_Wide (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse);
void Clear_brush_Wide (word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word image_width);
void Remap_screen_Wide (word x_pos,word y_pos,word width,word height,byte * Table_de_conversion);
void Afficher_partie_de_l_ecran_Wide (word width,word height,word image_width);
void Afficher_une_ligne_ecran_Wide (word Pos_X,word Pos_Y,word width,byte * line);
void Lire_une_ligne_ecran_Wide (word Pos_X,word Pos_Y,word width,byte * line);
void Afficher_une_ligne_ecran_Wide (word x_pos,word y_pos,word width,byte * line);
void Lire_une_ligne_ecran_Wide (word x_pos,word y_pos,word width,byte * line);
void Afficher_partie_de_l_ecran_zoomee_Wide(word width,word height,word image_width,byte * Buffer);
void Display_brush_Color_zoom_Wide (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_brosse,byte * Buffer);
void Display_brush_Mono_zoom_Wide (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse,byte * Buffer);
void Clear_brush_zoom_Wide (word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word image_width,byte * Buffer);
void Affiche_brosse_Wide (byte * brush, word Pos_X,word Pos_Y,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Display_brush_Color_zoom_Wide (word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_brosse,byte * Buffer);
void Display_brush_Mono_zoom_Wide (word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse,byte * Buffer);
void Clear_brush_zoom_Wide (word x_pos,word y_pos,word x_offset,word y_offset,word width,word Pos_Y_Fin,byte Couleur_de_transparence,word image_width,byte * Buffer);
void Affiche_brosse_Wide (byte * brush, word x_pos,word y_pos,word x_offset,word y_offset,word width,word height,byte Couleur_de_transparence,word Largeur_brosse);
void Afficher_une_ligne_ecran_fast_Wide (word Pos_X,word Pos_Y,word width,byte * line);
void Afficher_une_ligne_transparente_a_l_ecran_Wide(word Pos_X,word Pos_Y,word width,byte* line,byte Couleur_transparence);
void Afficher_une_ligne_ecran_fast_Wide (word x_pos,word y_pos,word width,byte * line);
void Afficher_une_ligne_transparente_a_l_ecran_Wide(word x_pos,word y_pos,word width,byte* line,byte Couleur_transparence);

View File

@ -469,10 +469,10 @@ int Charger_INI(T_Config * Conf)
goto Erreur_Retour;
Conf->Coul_menu_pref[0].R=0;
Conf->Coul_menu_pref[0].V=0;
Conf->Coul_menu_pref[0].G=0;
Conf->Coul_menu_pref[0].B=0;
Conf->Coul_menu_pref[3].R=255;
Conf->Coul_menu_pref[3].V=255;
Conf->Coul_menu_pref[3].G=255;
Conf->Coul_menu_pref[3].B=255;
if ((Retour=Charger_INI_Get_values (file,Buffer,"Light_color",3,Valeurs)))
@ -484,7 +484,7 @@ int Charger_INI(T_Config * Conf)
if ((Valeurs[2]<0) || (Valeurs[2]>63))
goto Erreur_ERREUR_INI_CORROMPU;
Conf->Coul_menu_pref[2].R=(Valeurs[0]<<2)|(Valeurs[0]>>4);
Conf->Coul_menu_pref[2].V=(Valeurs[1]<<2)|(Valeurs[1]>>4);
Conf->Coul_menu_pref[2].G=(Valeurs[1]<<2)|(Valeurs[1]>>4);
Conf->Coul_menu_pref[2].B=(Valeurs[2]<<2)|(Valeurs[2]>>4);
if ((Retour=Charger_INI_Get_values (file,Buffer,"Dark_color",3,Valeurs)))
@ -496,7 +496,7 @@ int Charger_INI(T_Config * Conf)
if ((Valeurs[2]<0) || (Valeurs[2]>63))
goto Erreur_ERREUR_INI_CORROMPU;
Conf->Coul_menu_pref[1].R=(Valeurs[0]<<2)|(Valeurs[0]>>4);
Conf->Coul_menu_pref[1].V=(Valeurs[1]<<2)|(Valeurs[1]>>4);
Conf->Coul_menu_pref[1].G=(Valeurs[1]<<2)|(Valeurs[1]>>4);
Conf->Coul_menu_pref[1].B=(Valeurs[2]<<2)|(Valeurs[2]>>4);
if ((Retour=Charger_INI_Get_values (file,Buffer,"Menu_ratio",1,Valeurs)))

View File

@ -45,30 +45,30 @@
#define COULEUR_FOND_CURSEUR CM_Fonce
// Suppresion d'un caractère à une certaine POSITION dans une CHAINE.
void Supprimer_caractere(char * Chaine, byte Position)
void Supprimer_caractere(char * Chaine, byte position)
{
for (;Chaine[Position]!='\0';Position++)
Chaine[Position]=Chaine[Position+1];
for (;Chaine[position]!='\0';position++)
Chaine[position]=Chaine[position+1];
}
void Inserer_caractere(char * Chaine, char letter, byte Position)
void Inserer_caractere(char * Chaine, char letter, byte position)
// Insertion d'une LETTRE à une certaine POSITION
// dans une CHAINE d'une certaine TAILLE.
{
char Char_tempo;
for (;letter!='\0';Position++)
for (;letter!='\0';position++)
{
// On mémorise le caractère qui se trouve en "Position"
Char_tempo=Chaine[Position];
// On mémorise le caractère qui se trouve en "position"
Char_tempo=Chaine[position];
// On splotch la lettre à insérer
Chaine[Position]=letter;
Chaine[position]=letter;
// On place le caractère mémorisé dans "letter" comme nouvelle lettre à insérer
letter=Char_tempo;
}
// On termine la chaine
Chaine[Position]='\0';
Chaine[position]='\0';
}
int CaractereValide(int c)
@ -84,29 +84,29 @@ int CaractereValide(int c)
#else
char CaracteresInterdits[] = {'/', '|', '?', '*', '<', '>'};
#endif
int Position;
int position;
if (c < ' ' || c > 255)
return 0;
for (Position=0; Position<(long)sizeof(CaracteresInterdits); Position++)
if (c == CaracteresInterdits[Position])
for (position=0; position<(long)sizeof(CaracteresInterdits); position++)
if (c == CaracteresInterdits[position])
return 0;
return 1;
}
void Rafficher_toute_la_chaine(word Pos_X,word Pos_Y,char * Chaine,byte Position)
void Rafficher_toute_la_chaine(word x_pos,word y_pos,char * Chaine,byte position)
{
Print_dans_fenetre(Pos_X,Pos_Y,Chaine,COULEUR_TEXTE,COULEUR_FOND);
Print_char_dans_fenetre(Pos_X+(Position<<3),Pos_Y,Chaine[Position],COULEUR_TEXTE_CURSEUR,COULEUR_FOND_CURSEUR);
Print_dans_fenetre(x_pos,y_pos,Chaine,COULEUR_TEXTE,COULEUR_FOND);
Print_char_dans_fenetre(x_pos+(position<<3),y_pos,Chaine[position],COULEUR_TEXTE_CURSEUR,COULEUR_FOND_CURSEUR);
}
/****************************************************************************
* Enhanced super scanf deluxe pro plus giga mieux :-) *
****************************************************************************/
byte Readline(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte Type_saisie)
byte Readline(word x_pos,word y_pos,char * Chaine,byte Taille_affichee,byte Type_saisie)
// Paramètres:
// Pos_X, Pos_Y : Coordonnées de la saisie dans la fenêtre
// x_pos, y_pos : Coordonnées de la saisie dans la fenêtre
// Chaine : Chaîne recevant la saisie (et contenant éventuellement une valeur initiale)
// Taille_maxi : Nombre de caractères logeant dans la zone de saisie
// Type_saisie : 0=Chaîne, 1=Nombre, 2=Nom de fichier
@ -120,15 +120,15 @@ byte Readline(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte Type
Taille_maxi = 255;
else
Taille_maxi = Taille_affichee;
return Readline_ex(Pos_X,Pos_Y,Chaine,Taille_affichee,Taille_maxi,Type_saisie);
return Readline_ex(x_pos,y_pos,Chaine,Taille_affichee,Taille_maxi,Type_saisie);
}
/****************************************************************************
* Enhanced super scanf deluxe pro plus giga mieux :-) *
****************************************************************************/
byte Readline_ex(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte Taille_maxi, byte Type_saisie)
byte Readline_ex(word x_pos,word y_pos,char * Chaine,byte Taille_affichee,byte Taille_maxi, byte Type_saisie)
// Paramètres:
// Pos_X, Pos_Y : Coordonnées de la saisie dans la fenêtre
// x_pos, y_pos : Coordonnées de la saisie dans la fenêtre
// Chaine : Chaîne recevant la saisie (et contenant éventuellement une valeur initiale)
// Taille_maxi : Nombre de caractères logeant dans la zone de saisie
// Type_saisie : 0=Chaîne, 1=Nombre, 2=Nom de fichier
@ -137,18 +137,18 @@ byte Readline_ex(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte T
{
char Chaine_initiale[256];
char Chaine_affichee[256];
byte Position;
byte position;
byte Taille;
word Touche_lue=0;
byte Touche_autorisee;
byte Offset=0; // Indice du premier caractère affiché
byte offset=0; // Indice du premier caractère affiché
Effacer_curseur();
// Effacement de la chaîne
Block(Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y),
Block(Fenetre_Pos_X+(x_pos*Menu_Facteur_X),Fenetre_Pos_Y+(y_pos*Menu_Facteur_Y),
Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3),COULEUR_FOND);
UpdateRect(Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y),
UpdateRect(Fenetre_Pos_X+(x_pos*Menu_Facteur_X),Fenetre_Pos_Y+(y_pos*Menu_Facteur_Y),
Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3));
// Mise à jour des variables se rapportant à la chaîne en fonction de la chaîne initiale
@ -162,19 +162,19 @@ byte Readline_ex(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte T
Taille=strlen(Chaine);
Position=(Taille<Taille_maxi)? Taille:Taille-1;
if (Position-Offset>Taille_affichee)
Offset=Position-Taille_affichee+1;
position=(Taille<Taille_maxi)? Taille:Taille-1;
if (position-offset>Taille_affichee)
offset=position-Taille_affichee+1;
// Formatage d'une partie de la chaine (si trop longue pour tenir)
strncpy(Chaine_affichee, Chaine + Offset, Taille_affichee);
strncpy(Chaine_affichee, Chaine + offset, Taille_affichee);
Chaine_affichee[Taille_affichee]='\0';
if (Offset>0)
if (offset>0)
Chaine_affichee[0]=CARACTERE_TRIANGLE_GAUCHE;
if (Taille_affichee + Offset + 1 < Taille )
if (Taille_affichee + offset + 1 < Taille )
Chaine_affichee[Taille_affichee-1]=CARACTERE_TRIANGLE_DROIT;
Rafficher_toute_la_chaine(Pos_X,Pos_Y,Chaine_affichee,Position - Offset);
UpdateRect(Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y),
Rafficher_toute_la_chaine(x_pos,y_pos,Chaine_affichee,position - offset);
UpdateRect(Fenetre_Pos_X+(x_pos*Menu_Facteur_X),Fenetre_Pos_Y+(y_pos*Menu_Facteur_Y),
Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3));
Flush_update();
@ -190,73 +190,73 @@ byte Readline_ex(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte T
switch (Touche_lue)
{
case SDLK_DELETE : // Suppr.
if (Position<Taille)
if (position<Taille)
{
Supprimer_caractere(Chaine,Position);
Supprimer_caractere(Chaine,position);
Taille--;
// Effacement de la chaîne
Block(Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y),
Block(Fenetre_Pos_X+(x_pos*Menu_Facteur_X),Fenetre_Pos_Y+(y_pos*Menu_Facteur_Y),
Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3),COULEUR_FOND);
goto affichage;
}
break;
case SDLK_LEFT : // Gauche
if (Position>0)
if (position>0)
{
// Effacement de la chaîne
if (Position==Taille)
Block(Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y),
if (position==Taille)
Block(Fenetre_Pos_X+(x_pos*Menu_Facteur_X),Fenetre_Pos_Y+(y_pos*Menu_Facteur_Y),
Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3),COULEUR_FOND);
Position--;
if (Offset > 0 && (Position == 0 || Position < (Offset + 1)))
Offset--;
position--;
if (offset > 0 && (position == 0 || position < (offset + 1)))
offset--;
goto affichage;
}
break;
case SDLK_RIGHT : // Droite
if ((Position<Taille) && (Position<Taille_maxi-1))
if ((position<Taille) && (position<Taille_maxi-1))
{
Position++;
//if (Position > Taille_affichee + Offset - 2)
//if (Offset + Taille_affichee < Taille_maxi && (Position == Taille || (Position > Taille_affichee + Offset - 2)))
if (Chaine_affichee[Position-Offset]==CARACTERE_TRIANGLE_DROIT || Position-Offset>=Taille_affichee)
Offset++;
position++;
//if (position > Taille_affichee + offset - 2)
//if (offset + Taille_affichee < Taille_maxi && (position == Taille || (position > Taille_affichee + offset - 2)))
if (Chaine_affichee[position-offset]==CARACTERE_TRIANGLE_DROIT || position-offset>=Taille_affichee)
offset++;
goto affichage;
}
break;
case SDLK_HOME : // Home
if (Position)
if (position)
{
// Effacement de la chaîne
if (Position==Taille)
Block(Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y),
if (position==Taille)
Block(Fenetre_Pos_X+(x_pos*Menu_Facteur_X),Fenetre_Pos_Y+(y_pos*Menu_Facteur_Y),
Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3),COULEUR_FOND);
Position = 0;
Offset = 0;
position = 0;
offset = 0;
goto affichage;
}
break;
case SDLK_END : // End
if ((Position<Taille) && (Position<Taille_maxi-1))
if ((position<Taille) && (position<Taille_maxi-1))
{
Position=(Taille<Taille_maxi)?Taille:Taille-1;
if (Position-Offset>Taille_affichee)
Offset=Position-Taille_affichee+1;
position=(Taille<Taille_maxi)?Taille:Taille-1;
if (position-offset>Taille_affichee)
offset=position-Taille_affichee+1;
goto affichage;
}
break;
case SDLK_BACKSPACE : // Backspace : combinaison de gauche + suppr
if (Position)
if (position)
{
Position--;
if (Offset > 0 && (Position == 0 || Position < (Offset + 1)))
Offset--;
Supprimer_caractere(Chaine,Position);
position--;
if (offset > 0 && (position == 0 || position < (offset + 1)))
offset--;
Supprimer_caractere(Chaine,position);
Taille--;
// Effacement de la chaîne
Block(Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y),
Block(Fenetre_Pos_X+(x_pos*Menu_Facteur_X),Fenetre_Pos_Y+(y_pos*Menu_Facteur_Y),
Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3),COULEUR_FOND);
goto affichage;
}
@ -294,15 +294,15 @@ byte Readline_ex(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte T
if (Touche_autorisee)
{
// ... alors on l'insère ...
Inserer_caractere(Chaine,Touche_lue,Position/*,Taille*/);
Inserer_caractere(Chaine,Touche_lue,position/*,Taille*/);
// ce qui augmente la taille de la chaine
Taille++;
// et qui risque de déplacer le curseur vers la droite
if (Taille<Taille_maxi)
{
Position++;
if (Chaine_affichee[Position-Offset]==CARACTERE_TRIANGLE_DROIT || Position-Offset>=Taille_affichee)
Offset++;
position++;
if (Chaine_affichee[position-offset]==CARACTERE_TRIANGLE_DROIT || position-offset>=Taille_affichee)
offset++;
}
// Enfin, on raffiche la chaine
goto affichage;
@ -313,15 +313,15 @@ byte Readline_ex(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte T
affichage:
Taille=strlen(Chaine);
// Formatage d'une partie de la chaine (si trop longue pour tenir)
strncpy(Chaine_affichee, Chaine + Offset, Taille_affichee);
strncpy(Chaine_affichee, Chaine + offset, Taille_affichee);
Chaine_affichee[Taille_affichee]='\0';
if (Offset>0)
if (offset>0)
Chaine_affichee[0]=CARACTERE_TRIANGLE_GAUCHE;
if (Taille_affichee + Offset + 0 < Taille )
if (Taille_affichee + offset + 0 < Taille )
Chaine_affichee[Taille_affichee-1]=CARACTERE_TRIANGLE_DROIT;
Rafficher_toute_la_chaine(Pos_X,Pos_Y,Chaine_affichee,Position - Offset);
UpdateRect(Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y),
Rafficher_toute_la_chaine(x_pos,y_pos,Chaine_affichee,position - offset);
UpdateRect(Fenetre_Pos_X+(x_pos*Menu_Facteur_X),Fenetre_Pos_Y+(y_pos*Menu_Facteur_Y),
Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3));
} // Fin du "switch(Touche_lue)"
Flush_update();
@ -329,7 +329,7 @@ affichage:
} // Fin du "while"
// Effacement de la chaîne
Block(Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y),
Block(Fenetre_Pos_X+(x_pos*Menu_Facteur_X),Fenetre_Pos_Y+(y_pos*Menu_Facteur_Y),
Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3),COULEUR_FOND);
// On raffiche la chaine correctement
if (Type_saisie==1)
@ -339,13 +339,13 @@ affichage:
strcpy(Chaine,"0");
Taille=1;
}
Print_dans_fenetre(Pos_X+((Taille_maxi-Taille)<<3),Pos_Y,Chaine,COULEUR_TEXTE,COULEUR_FOND);
Print_dans_fenetre(x_pos+((Taille_maxi-Taille)<<3),y_pos,Chaine,COULEUR_TEXTE,COULEUR_FOND);
}
else
{
Print_dans_fenetre_limite(Pos_X,Pos_Y,Chaine,Taille_affichee,COULEUR_TEXTE,COULEUR_FOND);
Print_dans_fenetre_limite(x_pos,y_pos,Chaine,Taille_affichee,COULEUR_TEXTE,COULEUR_FOND);
}
UpdateRect(Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y),
UpdateRect(Fenetre_Pos_X+(x_pos*Menu_Facteur_X),Fenetre_Pos_Y+(y_pos*Menu_Facteur_Y),
Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3));
return (Touche_lue==SDLK_RETURN);

View File

@ -19,18 +19,18 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
byte Readline(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte Type_saisie);
byte Readline(word x_pos,word y_pos,char * Chaine,byte Taille_affichee,byte Type_saisie);
// Paramètres:
// Pos_X, Pos_Y : Coordonnées de la saisie dans la fenêtre
// x_pos, y_pos : Coordonnées de la saisie dans la fenêtre
// Chaine : Chaîne recevant la saisie (et contenant éventuellement une valeur initiale)
// Taille_affichee : Nombre de caractères logeant dans la zone de saisie
// Type_saisie : 0=Chaîne, 1=Nombre, 2=Nom de fichier (255 caractères réels)
// Sortie:
// 0: Sortie par annulation (Esc.) / 1: sortie par acceptation (Return)
byte Readline_ex(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte Taille_maxi, byte Type_saisie);
byte Readline_ex(word x_pos,word y_pos,char * Chaine,byte Taille_affichee,byte Taille_maxi, byte Type_saisie);
// Paramètres:
// Pos_X, Pos_Y : Coordonnées de la saisie dans la fenêtre
// x_pos, y_pos : Coordonnées de la saisie dans la fenêtre
// Chaine : Chaîne recevant la saisie (et contenant éventuellement une valeur initiale)
// Taille_affichee : Nombre de caractères logeant dans la zone de saisie
// Taille_maxi : Nombre de caractères logeant dans la zone de saisie

View File

@ -461,13 +461,13 @@ int Sauver_INI(T_Config * Conf)
goto Erreur_Retour;
Valeurs[0]=Conf->Coul_menu_pref[2].R>>2;
Valeurs[1]=Conf->Coul_menu_pref[2].V>>2;
Valeurs[1]=Conf->Coul_menu_pref[2].G>>2;
Valeurs[2]=Conf->Coul_menu_pref[2].B>>2;
if ((Retour=Sauver_INI_Set_values (Ancien_fichier,Nouveau_fichier,Buffer,"Light_color",3,Valeurs,0)))
goto Erreur_Retour;
Valeurs[0]=Conf->Coul_menu_pref[1].R>>2;
Valeurs[1]=Conf->Coul_menu_pref[1].V>>2;
Valeurs[1]=Conf->Coul_menu_pref[1].G>>2;
Valeurs[2]=Conf->Coul_menu_pref[1].B>>2;
if ((Retour=Sauver_INI_Set_values (Ancien_fichier,Nouveau_fichier,Buffer,"Dark_color",3,Valeurs,0)))
goto Erreur_Retour;

View File

@ -176,7 +176,7 @@ SDL_Color Conversion_couleur_SDL(byte index)
{
SDL_Color Couleur;
Couleur.r = Principal_Palette[index].R;
Couleur.g = Principal_Palette[index].V;
Couleur.g = Principal_Palette[index].G;
Couleur.b = Principal_Palette[index].B;
Couleur.unused = 255;
return Couleur;

68
shade.c
View File

@ -72,7 +72,7 @@ void Shade_Blocs_degrades(void)
short Shade_traite,Ancien_shade_traite;
word Taille_shade=0;
word Debut_shade=0;
short Pos_X,Pos_Y;
short x_pos,y_pos;
short Taille_X,Taille_Y;
short Debut_X,Debut_Y,Fin_X,Fin_Y;
@ -104,10 +104,10 @@ void Shade_Blocs_degrades(void)
cursor=0;
Ancien_shade_traite=-1;
for (Pos_Y=Debut_Y;Pos_Y<Fin_Y;Pos_Y++)
for (y_pos=Debut_Y;y_pos<Fin_Y;y_pos++)
{
// On regarde quel shade on va afficher en preview
Shade_traite=((Pos_Y-Debut_Y)*Nb_shades)/Taille_Y;
Shade_traite=((y_pos-Debut_Y)*Nb_shades)/Taille_Y;
// Si ce n'est pas le shade précédemment traité on calcule ses infos
if (Shade_traite>Ancien_shade_traite)
{
@ -122,10 +122,10 @@ void Shade_Blocs_degrades(void)
Ancien_shade_traite=Shade_traite;
}
for (Pos_X=Debut_X;Pos_X<Fin_X;Pos_X++)
for (x_pos=Debut_X;x_pos<Fin_X;x_pos++)
{
Pixel(Pos_X,Pos_Y,Shade_Liste[Shade_Actuel].List
[(((Pos_X-Debut_X)*Taille_shade)/Taille_X)+Debut_shade]);
Pixel(x_pos,y_pos,Shade_Liste[Shade_Actuel].List
[(((x_pos-Debut_X)*Taille_shade)/Taille_X)+Debut_shade]);
}
}
}
@ -142,41 +142,41 @@ void Shade_Blocs_degrades(void)
void Tagger_shades(word Select_Debut,word Select_Fin)
{
word line, Colonne;
word Position;
word Pos_X, Pos_Y;
word position;
word x_pos, y_pos;
if (Select_Fin<Select_Debut)
{
Position =Select_Fin;
position =Select_Fin;
Select_Fin =Select_Debut;
Select_Debut=Position;
Select_Debut=position;
}
for (line=0; line<8; line++)
for (Colonne=0; Colonne<64; Colonne++)
{
Position=(line<<6)+Colonne;
Pos_X=Fenetre_Pos_X+(Menu_Facteur_X*((Colonne<<2)+8));
Pos_Y=Fenetre_Pos_Y+(Menu_Facteur_Y*((line*7)+131));
position=(line<<6)+Colonne;
x_pos=Fenetre_Pos_X+(Menu_Facteur_X*((Colonne<<2)+8));
y_pos=Fenetre_Pos_Y+(Menu_Facteur_Y*((line*7)+131));
// On regarde si la case est "disablée"
if (Shade_Liste[Shade_Actuel].List[Position]&0x8000)
if (Shade_Liste[Shade_Actuel].List[position]&0x8000)
{
if ((Position>=Select_Debut) && (Position<=Select_Fin))
if ((position>=Select_Debut) && (position<=Select_Fin))
{
Block(Pos_X,Pos_Y,Menu_Facteur_X<<2,Menu_Facteur_Y,CM_Blanc);
Block(Pos_X,Pos_Y+Menu_Facteur_Y,Menu_Facteur_X<<2,Menu_Facteur_Y,CM_Noir);
Block(x_pos,y_pos,Menu_Facteur_X<<2,Menu_Facteur_Y,CM_Blanc);
Block(x_pos,y_pos+Menu_Facteur_Y,Menu_Facteur_X<<2,Menu_Facteur_Y,CM_Noir);
}
else
Block(Pos_X,Pos_Y,Menu_Facteur_X<<2,Menu_Facteur_Y<<1,CM_Blanc);
Block(x_pos,y_pos,Menu_Facteur_X<<2,Menu_Facteur_Y<<1,CM_Blanc);
}
else // "enablée"
{
if ((Position>=Select_Debut) && (Position<=Select_Fin))
Block(Pos_X,Pos_Y,Menu_Facteur_X<<2,Menu_Facteur_Y<<1,CM_Noir);
if ((position>=Select_Debut) && (position<=Select_Fin))
Block(x_pos,y_pos,Menu_Facteur_X<<2,Menu_Facteur_Y<<1,CM_Noir);
else
Block(Pos_X,Pos_Y,Menu_Facteur_X<<2,Menu_Facteur_Y<<1,CM_Clair);
Block(x_pos,y_pos,Menu_Facteur_X<<2,Menu_Facteur_Y<<1,CM_Clair);
}
}
UpdateRect(Fenetre_Pos_X+8*Menu_Facteur_X,Fenetre_Pos_Y+131*Menu_Facteur_Y,Menu_Facteur_X*64<<2,Menu_Facteur_Y*8<<3);
@ -233,14 +233,14 @@ void Afficher_tout_le_shade(word Select_Debut1,word Select_Fin1,
word Select_Debut2,word Select_Fin2)
{
word line, Colonne;
word Position;
word position;
for (line=0; line<8; line++)
for (Colonne=0; Colonne<64; Colonne++)
{
Position=(line<<6)+Colonne;
position=(line<<6)+Colonne;
// On regarde si c'est une couleur ou un bloc vide
if (Shade_Liste[Shade_Actuel].List[Position]&0x0100) // Vide
if (Shade_Liste[Shade_Actuel].List[position]&0x0100) // Vide
{
Fenetre_Afficher_cadre_bombe((Colonne<<2)+8,(line*7)+127,4,4);
Block(Fenetre_Pos_X+(Menu_Facteur_X*((Colonne<<2)+9)),
@ -251,7 +251,7 @@ void Afficher_tout_le_shade(word Select_Debut1,word Select_Fin1,
Block(Fenetre_Pos_X+(Menu_Facteur_X*((Colonne<<2)+8)),
Fenetre_Pos_Y+(Menu_Facteur_Y*((line*7)+127)),
Menu_Facteur_X<<2,Menu_Facteur_Y<<2,
Shade_Liste[Shade_Actuel].List[Position]&0xFF);
Shade_Liste[Shade_Actuel].List[position]&0xFF);
}
UpdateRect(Fenetre_Pos_X+7*Menu_Facteur_X,Fenetre_Pos_Y+126*Menu_Facteur_Y,Menu_Facteur_X*((64<<2)+2),Menu_Facteur_Y*((8<<2)+2));
Tagger_shades(Select_Debut2,Select_Fin2);
@ -319,16 +319,16 @@ void Inserer_shade(byte Premiere_couleur, byte Derniere_couleur, word Select_Deb
}
void Inserer_case_vide_dans_shade(word Position)
void Inserer_case_vide_dans_shade(word position)
{
word cursor;
if (Position>=512) return;
if (position>=512) return;
for (cursor=511;cursor>Position;cursor--)
for (cursor=511;cursor>position;cursor--)
Shade_Liste[Shade_Actuel].List[cursor]=Shade_Liste[Shade_Actuel].List[cursor-1];
Shade_Liste[Shade_Actuel].List[Position]=0x0100;
Shade_Liste[Shade_Actuel].List[position]=0x0100;
}
@ -506,7 +506,7 @@ int Menu_Shade(void)
// Déclaration & tracé de la zone de saisie du pas
Print_dans_fenetre(272,165,"Step",CM_Fonce,CM_Clair);
Bouton_saisie = Fenetre_Definir_bouton_saisie(274,174,3); // 15
Num2str(Shade_Liste[Shade_Actuel].Pas,Chaine,3);
Num2str(Shade_Liste[Shade_Actuel].Step,Chaine,3);
Fenetre_Contenu_bouton_saisie(Bouton_saisie,Chaine);
// Bouton Undo
@ -591,7 +591,7 @@ int Menu_Shade(void)
Num2str(Shade_Actuel+1,Chaine,1);
Print_dans_fenetre(210,55,Chaine,CM_Noir,CM_Clair);
// Affichade du Pas
Num2str(Shade_Liste[Shade_Actuel].Pas,Chaine,3);
Num2str(Shade_Liste[Shade_Actuel].Step,Chaine,3);
Print_dans_fenetre(276,176,Chaine,CM_Noir,CM_Clair);
// Tracé du bloc dégradé:
Afficher_tout_le_shade(Premiere_couleur,Derniere_couleur,Select_Debut,Select_Fin);
@ -827,7 +827,7 @@ int Menu_Shade(void)
break;
case 15 : // Saisie du pas
Num2str(Shade_Liste[Shade_Actuel].Pas,Chaine,3);
Num2str(Shade_Liste[Shade_Actuel].Step,Chaine,3);
Readline(276,176,Chaine,3,1);
Temp=atoi(Chaine);
// On corrige le pas
@ -843,7 +843,7 @@ int Menu_Shade(void)
Num2str(Temp,Chaine,3);
Fenetre_Contenu_bouton_saisie(Bouton_saisie,Chaine);
}
Shade_Liste[Shade_Actuel].Pas=Temp;
Shade_Liste[Shade_Actuel].Step=Temp;
Afficher_curseur();
break;
@ -1012,7 +1012,7 @@ void Bouton_Shade_Menu(void)
else // OK
{
Liste2tables(Shade_Liste[Shade_Actuel].List,
Shade_Liste[Shade_Actuel].Pas,
Shade_Liste[Shade_Actuel].Step,
Shade_Liste[Shade_Actuel].Mode,
Shade_Table_gauche,Shade_Table_droite);

View File

@ -33,7 +33,7 @@
void Modifier_pinceau(int width, int height)
{
int Pos_X,Pos_Y;
int x_pos,y_pos;
int X,Y;
float Rayon2;
@ -50,90 +50,90 @@ void Modifier_pinceau(int width, int height)
case FORME_PINCEAU_ROND :
Rayon2=Pinceau_Decalage_X+0.414213562; // [0.410..0.415[
Rayon2*=Rayon2;
for (Pos_Y=0; Pos_Y<Pinceau_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Pinceau_Largeur; Pos_X++)
for (y_pos=0; y_pos<Pinceau_Hauteur; y_pos++)
for (x_pos=0; x_pos<Pinceau_Largeur; x_pos++)
{
X=Pos_X-Pinceau_Decalage_X;
Y=Pos_Y-Pinceau_Decalage_Y;
Pinceau_Sprite[(Pos_Y*TAILLE_MAXI_PINCEAU)+Pos_X]=( ((X*X)+(Y*Y)) < Rayon2 );
X=x_pos-Pinceau_Decalage_X;
Y=y_pos-Pinceau_Decalage_Y;
Pinceau_Sprite[(y_pos*TAILLE_MAXI_PINCEAU)+x_pos]=( ((X*X)+(Y*Y)) < Rayon2 );
}
break;
case FORME_PINCEAU_CARRE :
for (Pos_X=0,Pos_Y=0; Pos_X<Pinceau_Hauteur; Pos_X++,Pos_Y+=TAILLE_MAXI_PINCEAU)
memset(Pinceau_Sprite+Pos_Y,1,Pinceau_Largeur);
for (x_pos=0,y_pos=0; x_pos<Pinceau_Hauteur; x_pos++,y_pos+=TAILLE_MAXI_PINCEAU)
memset(Pinceau_Sprite+y_pos,1,Pinceau_Largeur);
break;
case FORME_PINCEAU_ROND_TRAME :
Rayon2=Pinceau_Decalage_X+0.414213562; // [0.410..0.415[
Rayon2*=Rayon2;
for (Pos_Y=0; Pos_Y<Pinceau_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Pinceau_Largeur; Pos_X++)
for (y_pos=0; y_pos<Pinceau_Hauteur; y_pos++)
for (x_pos=0; x_pos<Pinceau_Largeur; x_pos++)
{
X=Pos_X-Pinceau_Decalage_X;
Y=Pos_Y-Pinceau_Decalage_Y;
Pinceau_Sprite[(Pos_Y*TAILLE_MAXI_PINCEAU)+Pos_X]=( (!((Pos_X+Pos_Y)&1)) && (((X*X)+(Y*Y)) < Rayon2));
X=x_pos-Pinceau_Decalage_X;
Y=y_pos-Pinceau_Decalage_Y;
Pinceau_Sprite[(y_pos*TAILLE_MAXI_PINCEAU)+x_pos]=( (!((x_pos+y_pos)&1)) && (((X*X)+(Y*Y)) < Rayon2));
}
break;
case FORME_PINCEAU_CARRE_TRAME:
for (Pos_Y=0; Pos_Y<Pinceau_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Pinceau_Largeur; Pos_X++)
Pinceau_Sprite[(Pos_Y*TAILLE_MAXI_PINCEAU)+Pos_X]=!((Pos_X+Pos_Y)&1);
for (y_pos=0; y_pos<Pinceau_Hauteur; y_pos++)
for (x_pos=0; x_pos<Pinceau_Largeur; x_pos++)
Pinceau_Sprite[(y_pos*TAILLE_MAXI_PINCEAU)+x_pos]=!((x_pos+y_pos)&1);
break;
case FORME_PINCEAU_PLUS:
X=Pinceau_Largeur>>1;
for (Pos_Y=0; Pos_Y<Pinceau_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Pinceau_Largeur; Pos_X++)
Pinceau_Sprite[(Pos_Y*TAILLE_MAXI_PINCEAU)+Pos_X]=((Pos_X==X) || (Pos_Y==X));
for (y_pos=0; y_pos<Pinceau_Hauteur; y_pos++)
for (x_pos=0; x_pos<Pinceau_Largeur; x_pos++)
Pinceau_Sprite[(y_pos*TAILLE_MAXI_PINCEAU)+x_pos]=((x_pos==X) || (y_pos==X));
break;
case FORME_PINCEAU_SLASH:
X=Pinceau_Largeur>>1;
for (Pos_Y=0; Pos_Y<Pinceau_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Pinceau_Largeur; Pos_X++)
Pinceau_Sprite[(Pos_Y*TAILLE_MAXI_PINCEAU)+Pos_X]=(Pos_X==(Pinceau_Largeur-(Pos_Y+1)));
for (y_pos=0; y_pos<Pinceau_Hauteur; y_pos++)
for (x_pos=0; x_pos<Pinceau_Largeur; x_pos++)
Pinceau_Sprite[(y_pos*TAILLE_MAXI_PINCEAU)+x_pos]=(x_pos==(Pinceau_Largeur-(y_pos+1)));
break;
case FORME_PINCEAU_ANTISLASH:
X=Pinceau_Largeur>>1;
for (Pos_Y=0; Pos_Y<Pinceau_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Pinceau_Largeur; Pos_X++)
Pinceau_Sprite[(Pos_Y*TAILLE_MAXI_PINCEAU)+Pos_X]=(Pos_X==Pos_Y);
for (y_pos=0; y_pos<Pinceau_Hauteur; y_pos++)
for (x_pos=0; x_pos<Pinceau_Largeur; x_pos++)
Pinceau_Sprite[(y_pos*TAILLE_MAXI_PINCEAU)+x_pos]=(x_pos==y_pos);
break;
case FORME_PINCEAU_BARRE_HORIZONTALE:
memset(Pinceau_Sprite,1,Pinceau_Largeur);
break;
case FORME_PINCEAU_BARRE_VERTICALE:
for (Pos_Y=0; Pos_Y<Pinceau_Hauteur; Pos_Y++)
Pinceau_Sprite[(Pos_Y*TAILLE_MAXI_PINCEAU)]=1;
for (y_pos=0; y_pos<Pinceau_Hauteur; y_pos++)
Pinceau_Sprite[(y_pos*TAILLE_MAXI_PINCEAU)]=1;
break;
case FORME_PINCEAU_X:
X=Pinceau_Largeur>>1;
for (Pos_Y=0; Pos_Y<Pinceau_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Pinceau_Largeur; Pos_X++)
Pinceau_Sprite[(Pos_Y*TAILLE_MAXI_PINCEAU)+Pos_X]=( (Pos_X==Pos_Y) || (Pos_X==(Pinceau_Hauteur-(Pos_Y+1))) );
for (y_pos=0; y_pos<Pinceau_Hauteur; y_pos++)
for (x_pos=0; x_pos<Pinceau_Largeur; x_pos++)
Pinceau_Sprite[(y_pos*TAILLE_MAXI_PINCEAU)+x_pos]=( (x_pos==y_pos) || (x_pos==(Pinceau_Hauteur-(y_pos+1))) );
break;
case FORME_PINCEAU_LOSANGE:
X=Pinceau_Largeur>>1;
for (Pos_Y=0; Pos_Y<Pinceau_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Pinceau_Largeur; Pos_X++)
for (y_pos=0; y_pos<Pinceau_Hauteur; y_pos++)
for (x_pos=0; x_pos<Pinceau_Largeur; x_pos++)
{
if (Pos_X<=X)
Y=X-Pos_X;
if (x_pos<=X)
Y=X-x_pos;
else
Y=Pos_X-X;
if (Pos_Y<=X)
Y+=X-Pos_Y;
Y=x_pos-X;
if (y_pos<=X)
Y+=X-y_pos;
else
Y+=Pos_Y-X;
Pinceau_Sprite[(Pos_Y*TAILLE_MAXI_PINCEAU)+Pos_X]=(Y<=X);
Y+=y_pos-X;
Pinceau_Sprite[(y_pos*TAILLE_MAXI_PINCEAU)+x_pos]=(Y<=X);
}
break;
case FORME_PINCEAU_ALEATOIRE:
Rayon2=Pinceau_Decalage_X+0.414213562; // [0.410..0.415[
Rayon2*=Rayon2;
for (Pos_Y=0; Pos_Y<Pinceau_Hauteur; Pos_Y++)
for (Pos_X=0; Pos_X<Pinceau_Largeur; Pos_X++)
for (y_pos=0; y_pos<Pinceau_Hauteur; y_pos++)
for (x_pos=0; x_pos<Pinceau_Largeur; x_pos++)
{
X=Pos_X-Pinceau_Decalage_X;
Y=Pos_Y-Pinceau_Decalage_Y;
Pinceau_Sprite[(Pos_Y*TAILLE_MAXI_PINCEAU)+Pos_X]=( (((X*X)+(Y*Y)) < Rayon2) && (!(rand()&7)) );
X=x_pos-Pinceau_Decalage_X;
Y=y_pos-Pinceau_Decalage_Y;
Pinceau_Sprite[(y_pos*TAILLE_MAXI_PINCEAU)+x_pos]=( (((X*X)+(Y*Y)) < Rayon2) && (!(rand()&7)) );
}
}
}

View File

@ -58,13 +58,13 @@ typedef void (* fonction_affiche_brosse) (byte *,word,word,word,word,word,word,b
typedef struct
{
byte R;
byte V;
byte G;
byte B;
}__attribute__ ((__packed__)) Composantes, T_Palette[256];
typedef struct T_Bouton_normal
{
short Numero;
short Number;
word Pos_X;
word Pos_Y;
word Width;
@ -77,7 +77,7 @@ typedef struct T_Bouton_normal
typedef struct T_Bouton_palette
{
short Numero;
short Number;
word Pos_X;
word Pos_Y;
struct T_Bouton_palette * Next;
@ -85,7 +85,7 @@ typedef struct T_Bouton_palette
typedef struct T_Bouton_scroller
{
short Numero;
short Number;
word Pos_X;
word Pos_Y;
word Height;
@ -98,7 +98,7 @@ typedef struct T_Bouton_scroller
typedef struct T_Bouton_special
{
short Numero;
short Number;
word Pos_X;
word Pos_Y;
word Width;
@ -108,14 +108,14 @@ typedef struct T_Bouton_special
typedef struct T_Dropdown_choix
{
short Numero;
short Number;
const char * Label;
struct T_Dropdown_choix * Next;
} T_Dropdown_choix;
typedef struct T_Bouton_dropdown
{
short Numero;
short Number;
word Pos_X;
word Pos_Y;
word Width;
@ -168,7 +168,7 @@ typedef struct
typedef struct
{
word List[512]; // Liste de couleurs
byte Pas; // Pas d'incrémentation/décrémentation
byte Step; // Pas d'incrémentation/décrémentation
byte Mode; // Mode d'utilisation (Normal/Boucle/Non-saturé)
} T_Shade;
@ -194,13 +194,13 @@ typedef struct
typedef struct
{
byte Numero;
byte Number;
word Taille;
} __attribute__((__packed__)) Config_Chunk;
typedef struct
{
word Numero;
word Number;
word Touche;
word Touche2;
} __attribute__((__packed__)) Config_Infos_touche;
@ -267,7 +267,7 @@ typedef struct
char Commentaire[TAILLE_COMMENTAIRE+1]; // Commentaire de l'image
char Repertoire_fichier[TAILLE_CHEMIN_FICHIER]; // |_ Nom complet =
char Nom_fichier[TAILLE_CHEMIN_FICHIER]; // | Repertoire_fichier+"\"+Nom_fichier
char Filename[TAILLE_CHEMIN_FICHIER]; // | Repertoire_fichier+"\"+Nom_fichier
byte Format_fichier; // Format auquel il faut lire et écrire le fichier
/*

Binary file not shown.

344
windows.c
View File

@ -67,7 +67,7 @@ void Pixel_dans_fenetre(word X,word Y,byte Couleur)
// -- Cadre général avec couleurs paramètrables --
void Fenetre_Afficher_cadre_general(word Pos_X,word Pos_Y,word width,word height,
void Fenetre_Afficher_cadre_general(word x_pos,word y_pos,word width,word height,
byte Couleur_HG,byte Couleur_BD,byte Couleur_S,byte Couleur_CHG,byte Couleur_CBD)
// Paramètres de couleurs:
// Couleur_HG =Bords Haut et Gauche
@ -77,62 +77,62 @@ void Fenetre_Afficher_cadre_general(word Pos_X,word Pos_Y,word width,word height
// Couleur_CBD=Coin Bas-Droite
{
// Bord haut (sans les extrémités)
Block(Fenetre_Pos_X+((Pos_X+1)*Menu_Facteur_X),
Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y),
Block(Fenetre_Pos_X+((x_pos+1)*Menu_Facteur_X),
Fenetre_Pos_Y+(y_pos*Menu_Facteur_Y),
(width-2)*Menu_Facteur_X,Menu_Facteur_Y,Couleur_HG);
// Bord bas (sans les extrémités)
Block(Fenetre_Pos_X+((Pos_X+1)*Menu_Facteur_X),
Fenetre_Pos_Y+((Pos_Y+height-1)*Menu_Facteur_Y),
Block(Fenetre_Pos_X+((x_pos+1)*Menu_Facteur_X),
Fenetre_Pos_Y+((y_pos+height-1)*Menu_Facteur_Y),
(width-2)*Menu_Facteur_X,Menu_Facteur_Y,Couleur_BD);
// Bord gauche (sans les extrémités)
Block(Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),
Fenetre_Pos_Y+((Pos_Y+1)*Menu_Facteur_Y),
Block(Fenetre_Pos_X+(x_pos*Menu_Facteur_X),
Fenetre_Pos_Y+((y_pos+1)*Menu_Facteur_Y),
Menu_Facteur_X,(height-2)*Menu_Facteur_Y,Couleur_HG);
// Bord droite (sans les extrémités)
Block(Fenetre_Pos_X+((Pos_X+width-1)*Menu_Facteur_X),
Fenetre_Pos_Y+((Pos_Y+1)*Menu_Facteur_Y),
Block(Fenetre_Pos_X+((x_pos+width-1)*Menu_Facteur_X),
Fenetre_Pos_Y+((y_pos+1)*Menu_Facteur_Y),
Menu_Facteur_X,(height-2)*Menu_Facteur_Y,Couleur_BD);
// Coin haut gauche
Pixel_dans_fenetre(Pos_X,Pos_Y,Couleur_CHG);
Pixel_dans_fenetre(x_pos,y_pos,Couleur_CHG);
// Coin haut droite
Pixel_dans_fenetre(Pos_X+width-1,Pos_Y,Couleur_S);
Pixel_dans_fenetre(x_pos+width-1,y_pos,Couleur_S);
// Coin bas droite
Pixel_dans_fenetre(Pos_X+width-1,Pos_Y+height-1,Couleur_CBD);
Pixel_dans_fenetre(x_pos+width-1,y_pos+height-1,Couleur_CBD);
// Coin bas gauche
Pixel_dans_fenetre(Pos_X,Pos_Y+height-1,Couleur_S);
Pixel_dans_fenetre(x_pos,y_pos+height-1,Couleur_S);
}
// -- Cadre dont tout le contour est d'une seule couleur --
void Fenetre_Afficher_cadre_mono(word Pos_X,word Pos_Y,word width,word height,byte Couleur)
void Fenetre_Afficher_cadre_mono(word x_pos,word y_pos,word width,word height,byte Couleur)
{
Fenetre_Afficher_cadre_general(Pos_X,Pos_Y,width,height,Couleur,Couleur,Couleur,Couleur,Couleur);
Fenetre_Afficher_cadre_general(x_pos,y_pos,width,height,Couleur,Couleur,Couleur,Couleur,Couleur);
}
// -- Cadre creux: foncé en haut-gauche et clair en bas-droite --
void Fenetre_Afficher_cadre_creux(word Pos_X,word Pos_Y,word width,word height)
void Fenetre_Afficher_cadre_creux(word x_pos,word y_pos,word width,word height)
{
Fenetre_Afficher_cadre_general(Pos_X,Pos_Y,width,height,CM_Fonce,CM_Blanc,CM_Clair,CM_Fonce,CM_Blanc);
Fenetre_Afficher_cadre_general(x_pos,y_pos,width,height,CM_Fonce,CM_Blanc,CM_Clair,CM_Fonce,CM_Blanc);
}
// -- Cadre bombé: clair en haut-gauche et foncé en bas-droite --
void Fenetre_Afficher_cadre_bombe(word Pos_X,word Pos_Y,word width,word height)
void Fenetre_Afficher_cadre_bombe(word x_pos,word y_pos,word width,word height)
{
Fenetre_Afficher_cadre_general(Pos_X,Pos_Y,width,height,CM_Blanc,CM_Fonce,CM_Clair,CM_Blanc,CM_Fonce);
Fenetre_Afficher_cadre_general(x_pos,y_pos,width,height,CM_Blanc,CM_Fonce,CM_Clair,CM_Blanc,CM_Fonce);
}
// -- Cadre de séparation: un cadre bombé dans un cadre creux (3D!!!) --
void Fenetre_Afficher_cadre(word Pos_X,word Pos_Y,word width,word height)
void Fenetre_Afficher_cadre(word x_pos,word y_pos,word width,word height)
{
Fenetre_Afficher_cadre_creux(Pos_X,Pos_Y,width,height);
Fenetre_Afficher_cadre_bombe(Pos_X+1,Pos_Y+1,width-2,height-2);
Fenetre_Afficher_cadre_creux(x_pos,y_pos,width,height);
Fenetre_Afficher_cadre_bombe(x_pos+1,y_pos+1,width-2,height-2);
}
@ -332,17 +332,17 @@ int Couleur_palette()
void Afficher_menu(void)
{
word Pos_X;
word Pos_Y;
word x_pos;
word y_pos;
char Chaine[4];
if (Menu_visible)
{
// Affichage du sprite du menu
for (Pos_Y=0;Pos_Y<HAUTEUR_MENU;Pos_Y++)
for (Pos_X=0;Pos_X<LARGEUR_MENU;Pos_X++)
Pixel_dans_menu(Pos_X,Pos_Y,BLOCK_MENU[Pos_Y][Pos_X]);
for (y_pos=0;y_pos<HAUTEUR_MENU;y_pos++)
for (x_pos=0;x_pos<LARGEUR_MENU;x_pos++)
Pixel_dans_menu(x_pos,y_pos,BLOCK_MENU[y_pos][x_pos]);
// Affichage de la bande grise sous la palette
Block(LARGEUR_MENU*Menu_Facteur_X,Menu_Ordonnee_Texte-Menu_Facteur_Y,Largeur_ecran-(LARGEUR_MENU*Menu_Facteur_X),9*Menu_Facteur_Y,CM_Clair);
@ -384,8 +384,8 @@ void Afficher_menu(void)
void Print_general(short X,short Y,const char * Chaine,byte Couleur_texte,byte Couleur_fond)
{
word Indice;
int Pos_X;
int Pos_Y;
int x_pos;
int y_pos;
byte *font_pixel;
short Reel_X;
short Reel_Y;
@ -393,16 +393,16 @@ void Print_general(short X,short Y,const char * Chaine,byte Couleur_texte,byte C
byte Repeat_Menu_Facteur_Y;
Reel_Y=Y;
for (Pos_Y=0;Pos_Y<8<<3;Pos_Y+=1<<3)
for (y_pos=0;y_pos<8<<3;y_pos+=1<<3)
{
Reel_X=0; // Position dans le buffer
for (Indice=0;Chaine[Indice]!='\0';Indice++)
{
// Pointeur sur le premier pixel du caractère
font_pixel=Fonte+(((unsigned char)Chaine[Indice])<<6);
for (Pos_X=0;Pos_X<8;Pos_X+=1)
for (x_pos=0;x_pos<8;x_pos+=1)
for (Repeat_Menu_Facteur_X=0;Repeat_Menu_Facteur_X<Menu_Facteur_X*Pixel_width;Repeat_Menu_Facteur_X++)
Buffer_de_ligne_horizontale[Reel_X++]=*(font_pixel+Pos_X+Pos_Y)?Couleur_texte:Couleur_fond;
Buffer_de_ligne_horizontale[Reel_X++]=*(font_pixel+x_pos+y_pos)?Couleur_texte:Couleur_fond;
}
for (Repeat_Menu_Facteur_Y=0;Repeat_Menu_Facteur_Y<Menu_Facteur_Y;Repeat_Menu_Facteur_Y++)
Afficher_ligne_fast(X,Reel_Y++,Indice*Menu_Facteur_X*8,Buffer_de_ligne_horizontale);
@ -411,30 +411,30 @@ void Print_general(short X,short Y,const char * Chaine,byte Couleur_texte,byte C
// -- Afficher un caractère dans une fenêtre --
void Print_char_dans_fenetre(short Pos_X,short Pos_Y,const unsigned char c,byte Couleur_texte,byte Couleur_fond)
void Print_char_dans_fenetre(short x_pos,short y_pos,const unsigned char c,byte Couleur_texte,byte Couleur_fond)
{
short X,Y;
byte *pixel;
Pos_X=(Pos_X*Menu_Facteur_X)+Fenetre_Pos_X;
Pos_Y=(Pos_Y*Menu_Facteur_Y)+Fenetre_Pos_Y;
x_pos=(x_pos*Menu_Facteur_X)+Fenetre_Pos_X;
y_pos=(y_pos*Menu_Facteur_Y)+Fenetre_Pos_Y;
// Premier pixel du caractère
pixel=Fonte + (c<<6);
for (Y=0;Y<8;Y++)
for (X=0;X<8;X++)
Block(Pos_X+(X*Menu_Facteur_X), Pos_Y+(Y*Menu_Facteur_Y),
Block(x_pos+(X*Menu_Facteur_X), y_pos+(Y*Menu_Facteur_Y),
Menu_Facteur_X, Menu_Facteur_Y,
(*(pixel++)?Couleur_texte:Couleur_fond));
}
// -- Afficher un caractère sans fond dans une fenêtre --
void Print_char_transparent_dans_fenetre(short Pos_X,short Pos_Y,const unsigned char c,byte Couleur)
void Print_char_transparent_dans_fenetre(short x_pos,short y_pos,const unsigned char c,byte Couleur)
{
short X,Y;
byte *pixel;
Pos_X=(Pos_X*Menu_Facteur_X)+Fenetre_Pos_X;
Pos_Y=(Pos_Y*Menu_Facteur_Y)+Fenetre_Pos_Y;
x_pos=(x_pos*Menu_Facteur_X)+Fenetre_Pos_X;
y_pos=(y_pos*Menu_Facteur_Y)+Fenetre_Pos_Y;
// Premier pixel du caractère
pixel=Fonte + (c<<6);
@ -442,7 +442,7 @@ void Print_char_transparent_dans_fenetre(short Pos_X,short Pos_Y,const unsigned
for (X=0;X<8;X++)
{
if (*(pixel++))
Block(Pos_X+(X*Menu_Facteur_X), Pos_Y+(Y*Menu_Facteur_Y),
Block(x_pos+(X*Menu_Facteur_X), y_pos+(Y*Menu_Facteur_Y),
Menu_Facteur_X, Menu_Facteur_Y, Couleur);
}
}
@ -474,10 +474,10 @@ void Print_dans_fenetre(short X,short Y,const char * Chaine,byte Couleur_texte,b
// -- Afficher une chaîne dans le menu --
void Print_dans_menu(const char * Chaine, short Position)
void Print_dans_menu(const char * Chaine, short position)
{
Print_general((18+(Position<<3))*Menu_Facteur_X,Menu_Ordonnee_Texte,Chaine,CM_Noir,CM_Clair);
UpdateRect((18+(Position<<3))*Menu_Facteur_X,Menu_Ordonnee_Texte,strlen(Chaine)*8*Menu_Facteur_X,8*Menu_Facteur_Y);
Print_general((18+(position<<3))*Menu_Facteur_X,Menu_Ordonnee_Texte,Chaine,CM_Noir,CM_Clair);
UpdateRect((18+(position<<3))*Menu_Facteur_X,Menu_Ordonnee_Texte,strlen(Chaine)*8*Menu_Facteur_X,8*Menu_Facteur_Y);
}
// -- Afficher les coordonnées du pinceau dans le menu --
@ -692,8 +692,8 @@ void Print_compteur(short X,short Y,const char * Chaine,byte Couleur_texte,byte
} };
word Indice;
short Pos_X;
short Pos_Y;
short x_pos;
short y_pos;
for (Indice=0;Chaine[Indice]!='\0';Indice++)
{
int Numero_car;
@ -725,12 +725,12 @@ void Print_compteur(short X,short Y,const char * Chaine,byte Couleur_texte,byte
Numero_car=13;
break;
}
for (Pos_Y=0;Pos_Y<8;Pos_Y++)
for (y_pos=0;y_pos<8;y_pos++)
{
for (Pos_X=0;Pos_X<6;Pos_X++)
for (x_pos=0;x_pos<6;x_pos++)
{
byte Couleur = (thin_font[Numero_car][Pos_Y] & (1 << (6-Pos_X))) ? Couleur_texte:Couleur_fond;
Pixel_dans_fenetre(X+(Indice*6+Pos_X),Y+Pos_Y,Couleur);
byte Couleur = (thin_font[Numero_car][y_pos] & (1 << (6-x_pos))) ? Couleur_texte:Couleur_fond;
Pixel_dans_fenetre(X+(Indice*6+x_pos),Y+y_pos,Couleur);
}
}
}
@ -810,8 +810,8 @@ void Warning_message(char * Message)
void Afficher_sprite_dans_menu(int Numero_bouton,int Numero_sprite)
{
word Pos_X;
word Pos_Y;
word x_pos;
word y_pos;
word Pos_menu_X;
word Pos_menu_Y;
byte Couleur;
@ -824,12 +824,12 @@ void Afficher_sprite_dans_menu(int Numero_bouton,int Numero_sprite)
Pos_menu_X+=1;
}
for (Pos_Y=0;Pos_Y<HAUTEUR_SPRITE_MENU;Pos_Y++)
for (Pos_X=0;Pos_X<LARGEUR_SPRITE_MENU;Pos_X++)
for (y_pos=0;y_pos<HAUTEUR_SPRITE_MENU;y_pos++)
for (x_pos=0;x_pos<LARGEUR_SPRITE_MENU;x_pos++)
{
Couleur=SPRITE_MENU[Numero_sprite][Pos_Y][Pos_X];
Pixel_dans_menu(Pos_menu_X+Pos_X,Pos_menu_Y+Pos_Y,Couleur);
BLOCK_MENU[Pos_menu_Y+Pos_Y][Pos_menu_X+Pos_X]=Couleur;
Couleur=SPRITE_MENU[Numero_sprite][y_pos][x_pos];
Pixel_dans_menu(Pos_menu_X+x_pos,Pos_menu_Y+y_pos,Couleur);
BLOCK_MENU[Pos_menu_Y+y_pos][Pos_menu_X+x_pos]=Couleur;
}
UpdateRect(Menu_Facteur_X*(Bouton[Numero_bouton].Decalage_X+1),
(Bouton[Numero_bouton].Decalage_Y+1)*Menu_Facteur_Y+Menu_Ordonnee,
@ -840,7 +840,7 @@ void Afficher_sprite_dans_menu(int Numero_bouton,int Numero_sprite)
void Afficher_pinceau_dans_menu(void)
{
short Pos_X,Pos_Y;
short x_pos,y_pos;
short Debut_X;
short Pos_menu_X,Pos_menu_Y;
short Debut_menu_X;
@ -850,18 +850,18 @@ void Afficher_pinceau_dans_menu(void)
{
case FORME_PINCEAU_BROSSE_COULEUR : // Brosse en couleur
case FORME_PINCEAU_BROSSE_MONOCHROME : // Brosse monochrome
for (Pos_menu_Y=2,Pos_Y=0;Pos_Y<HAUTEUR_SPRITE_MENU;Pos_menu_Y++,Pos_Y++)
for (Pos_menu_X=1,Pos_X=0;Pos_X<LARGEUR_SPRITE_MENU;Pos_menu_X++,Pos_X++)
for (Pos_menu_Y=2,y_pos=0;y_pos<HAUTEUR_SPRITE_MENU;Pos_menu_Y++,y_pos++)
for (Pos_menu_X=1,x_pos=0;x_pos<LARGEUR_SPRITE_MENU;Pos_menu_X++,x_pos++)
{
Couleur=SPRITE_MENU[4][Pos_Y][Pos_X];
Couleur=SPRITE_MENU[4][y_pos][x_pos];
Pixel_dans_menu(Pos_menu_X,Pos_menu_Y,Couleur);
BLOCK_MENU[Pos_menu_Y][Pos_menu_X]=Couleur;
}
break;
default : // Pinceau
// On efface le pinceau précédent
for (Pos_menu_Y=2,Pos_Y=0;Pos_Y<HAUTEUR_SPRITE_MENU;Pos_menu_Y++,Pos_Y++)
for (Pos_menu_X=1,Pos_X=0;Pos_X<LARGEUR_SPRITE_MENU;Pos_menu_X++,Pos_X++)
for (Pos_menu_Y=2,y_pos=0;y_pos<HAUTEUR_SPRITE_MENU;Pos_menu_Y++,y_pos++)
for (Pos_menu_X=1,x_pos=0;x_pos<LARGEUR_SPRITE_MENU;Pos_menu_X++,x_pos++)
{
Pixel_dans_menu(Pos_menu_X,Pos_menu_Y,CM_Clair);
BLOCK_MENU[Pos_menu_Y][Pos_menu_X]=CM_Clair;
@ -879,16 +879,16 @@ void Afficher_pinceau_dans_menu(void)
Pos_menu_Y=9-Pinceau_Decalage_Y;
if (Pos_menu_Y<2)
{
Pos_Y=Pinceau_Decalage_Y-7;
y_pos=Pinceau_Decalage_Y-7;
Pos_menu_Y=2;
}
else
Pos_Y=0;
y_pos=0;
for (;((Pos_Y<Pinceau_Hauteur) && (Pos_menu_Y<16));Pos_menu_Y++,Pos_Y++)
for (Pos_menu_X=Debut_menu_X,Pos_X=Debut_X;((Pos_X<Pinceau_Largeur) && (Pos_menu_X<15));Pos_menu_X++,Pos_X++)
for (;((y_pos<Pinceau_Hauteur) && (Pos_menu_Y<16));Pos_menu_Y++,y_pos++)
for (Pos_menu_X=Debut_menu_X,x_pos=Debut_X;((x_pos<Pinceau_Largeur) && (Pos_menu_X<15));Pos_menu_X++,x_pos++)
{
Couleur=(Pinceau_Sprite[(Pos_Y*TAILLE_MAXI_PINCEAU)+Pos_X])?CM_Noir:CM_Clair;
Couleur=(Pinceau_Sprite[(y_pos*TAILLE_MAXI_PINCEAU)+x_pos])?CM_Noir:CM_Clair;
Pixel_dans_menu(Pos_menu_X,Pos_menu_Y,Couleur);
BLOCK_MENU[Pos_menu_Y][Pos_menu_X]=Couleur;
}
@ -898,11 +898,11 @@ void Afficher_pinceau_dans_menu(void)
// -- Dessiner un pinceau prédéfini dans la fenêtre --
void Afficher_pinceau_dans_fenetre(word X,word Y,int Numero)
void Afficher_pinceau_dans_fenetre(word X,word Y,int number)
// Pinceau = 0..NB_SPRITES_PINCEAU-1 : Pinceau prédéfini
{
word Pos_X;
word Pos_Y;
word x_pos;
word y_pos;
word Pos_fenetre_X;
word Pos_fenetre_Y;
int Taille_X;
@ -917,18 +917,18 @@ void Afficher_pinceau_dans_fenetre(word X,word Y,int Numero)
if (Taille_Y<1)
Taille_Y=1;
Orig_X = (X + 8)*Menu_Facteur_X - (Pinceau_predefini_Decalage_X[Numero])*Taille_X+Fenetre_Pos_X;
Orig_Y = (Y + 8)*Menu_Facteur_Y - (Pinceau_predefini_Decalage_Y[Numero])*Taille_Y+Fenetre_Pos_Y;
Orig_X = (X + 8)*Menu_Facteur_X - (Pinceau_predefini_Decalage_X[number])*Taille_X+Fenetre_Pos_X;
Orig_Y = (Y + 8)*Menu_Facteur_Y - (Pinceau_predefini_Decalage_Y[number])*Taille_Y+Fenetre_Pos_Y;
for (Pos_fenetre_Y=0,Pos_Y=0; Pos_Y<Pinceau_predefini_Hauteur[Numero]; Pos_fenetre_Y++,Pos_Y++)
for (Pos_fenetre_X=0,Pos_X=0; Pos_X<Pinceau_predefini_Largeur[Numero]; Pos_fenetre_X++,Pos_X++)
Block(Orig_X+Pos_fenetre_X*Taille_X,Orig_Y+Pos_fenetre_Y*Taille_Y,Taille_X,Taille_Y,(SPRITE_PINCEAU[Numero][Pos_Y][Pos_X])?CM_Noir:CM_Clair);
for (Pos_fenetre_Y=0,y_pos=0; y_pos<Pinceau_predefini_Hauteur[number]; Pos_fenetre_Y++,y_pos++)
for (Pos_fenetre_X=0,x_pos=0; x_pos<Pinceau_predefini_Largeur[number]; Pos_fenetre_X++,x_pos++)
Block(Orig_X+Pos_fenetre_X*Taille_X,Orig_Y+Pos_fenetre_Y*Taille_Y,Taille_X,Taille_Y,(SPRITE_PINCEAU[number][y_pos][x_pos])?CM_Noir:CM_Clair);
// On n'utilise pas Pixel_dans_fenetre() car on ne dessine pas
// forcément avec la même taille de pixel.
UpdateRect( ToWinX(Orig_X), ToWinY(Orig_Y),
ToWinL(Pinceau_predefini_Largeur[Numero]),
ToWinH(Pinceau_predefini_Hauteur[Numero])
ToWinL(Pinceau_predefini_Largeur[number]),
ToWinH(Pinceau_predefini_Hauteur[number])
);
}
@ -949,16 +949,16 @@ void Dessiner_zigouigoui(word X,word Y, byte Couleur, short Sens)
// -- Dessiner un bloc de couleurs dégradé verticalement
void Bloc_degrade_dans_fenetre(word Pos_X,word Pos_Y,word Debut_block,word Fin_block)
void Bloc_degrade_dans_fenetre(word x_pos,word y_pos,word Debut_block,word Fin_block)
{
word Total_lignes =Menu_Facteur_Y<<6; // <=> à 64 lignes fct(Menu_Facteur)
word Nb_couleurs =(Debut_block<=Fin_block)?Fin_block-Debut_block+1:Debut_block-Fin_block+1;
word Ligne_en_cours=(Debut_block<=Fin_block)?0:Total_lignes-1;
word Debut_X =Fenetre_Pos_X+(Menu_Facteur_X*Pos_X);
word Debut_X =Fenetre_Pos_X+(Menu_Facteur_X*x_pos);
word Largeur_ligne =Menu_Facteur_X<<4; // <=> à 16 pixels fct(Menu_Facteur)
word Debut_Y =Fenetre_Pos_Y+(Menu_Facteur_Y*Pos_Y);
word Debut_Y =Fenetre_Pos_Y+(Menu_Facteur_Y*y_pos);
word Fin_Y =Debut_Y+Total_lignes;
word Indice;
@ -972,21 +972,21 @@ void Bloc_degrade_dans_fenetre(word Pos_X,word Pos_Y,word Debut_block,word Fin_b
for (Indice=Debut_Y;Indice<Fin_Y;Indice++,Ligne_en_cours++)
Block(Debut_X,Indice,Largeur_ligne,1,Debut_block+(Nb_couleurs*Ligne_en_cours)/Total_lignes);
UpdateRect(ToWinX(Pos_X),ToWinY(Pos_Y),ToWinL(16),ToWinH(64));
UpdateRect(ToWinX(x_pos),ToWinY(y_pos),ToWinL(16),ToWinH(64));
}
// -- Dessiner un petit sprite représentant le type d'un drive --
void Fenetre_Afficher_sprite_drive(word Pos_X,word Pos_Y,byte Type)
void Fenetre_Afficher_sprite_drive(word x_pos,word y_pos,byte Type)
{
word i,j;
for (j=0; j<HAUTEUR_SPRITE_DRIVE; j++)
for (i=0; i<LARGEUR_SPRITE_DRIVE; i++)
Pixel_dans_fenetre(Pos_X+i,Pos_Y+j,SPRITE_DRIVE[Type][j][i]);
UpdateRect(ToWinX(Pos_X),ToWinY(Pos_Y),ToWinL(LARGEUR_SPRITE_DRIVE),ToWinH(HAUTEUR_SPRITE_DRIVE));
Pixel_dans_fenetre(x_pos+i,y_pos+j,SPRITE_DRIVE[Type][j][i]);
UpdateRect(ToWinX(x_pos),ToWinY(y_pos),ToWinL(LARGEUR_SPRITE_DRIVE),ToWinH(HAUTEUR_SPRITE_DRIVE));
}
@ -1080,18 +1080,18 @@ void Afficher_palette_du_menu_en_evitant_la_fenetre(byte * Table)
{
// Affichage du bloc directement dans le "buffer de fond" de la fenetre.
// Cela permet au bloc de couleur d'apparaitre si on déplace la fenetre.
short Pos_X;
short Pos_Y;
short x_pos;
short y_pos;
short relative_x; // besoin d'une variable signée
short relative_y; // besoin d'une variable signée
// Attention aux unités
relative_x = ((short)Debut_X - (short)Fenetre_Pos_X);
relative_y = ((short)Debut_Y - (short)Fenetre_Pos_Y);
for (Pos_Y=relative_y;Pos_Y<(relative_y+height)&&Pos_Y<Fenetre_Hauteur*Menu_Facteur_Y;Pos_Y++)
for (Pos_X=relative_x;Pos_X<(relative_x+width)&&Pos_X<Fenetre_Largeur*Menu_Facteur_X;Pos_X++)
if (Pos_X>=0&&Pos_Y>=0)
Pixel_fond(Pos_X,Pos_Y,Vraie_couleur);
for (y_pos=relative_y;y_pos<(relative_y+height)&&y_pos<Fenetre_Hauteur*Menu_Facteur_Y;y_pos++)
for (x_pos=relative_x;x_pos<(relative_x+width)&&x_pos<Fenetre_Largeur*Menu_Facteur_X;x_pos++)
if (x_pos>=0&&y_pos>=0)
Pixel_fond(x_pos,y_pos,Vraie_couleur);
}
}
}
@ -1186,7 +1186,7 @@ void Calculer_coordonnees_pinceau(void)
void Afficher_limites_de_l_image(void)
{
short start;
short Pos;
short pos;
short end;
byte Droite_visible;
byte Bas_visible;
@ -1211,8 +1211,8 @@ void Afficher_limites_de_l_image(void)
Ancienne_Limite_Zoom=Limite_Droite_Zoom;
Limite_Droite_Zoom=Limite_visible_Droite_Zoom;
for (Pos=start;Pos<=end;Pos++)
Pixel_Preview(Principal_Largeur_image,Pos,((Pos+Principal_Hauteur_image)&1)?CM_Blanc:CM_Noir);
for (pos=start;pos<=end;pos++)
Pixel_Preview(Principal_Largeur_image,pos,((pos+Principal_Hauteur_image)&1)?CM_Blanc:CM_Noir);
UpdateRect(Principal_Largeur_image,start,1,end-start + 1);
// On restaure la bonne valeur des limites
@ -1230,8 +1230,8 @@ void Afficher_limites_de_l_image(void)
Ancienne_Limite_Zoom=Limite_Bas_Zoom;
Limite_Bas_Zoom=Limite_visible_Bas_Zoom;
for (Pos=start;Pos<=end;Pos++)
Pixel_Preview(Pos,Principal_Hauteur_image,((Pos+Principal_Hauteur_image)&1)?CM_Blanc:CM_Noir);
for (pos=start;pos<=end;pos++)
Pixel_Preview(pos,Principal_Hauteur_image,((pos+Principal_Hauteur_image)&1)?CM_Blanc:CM_Noir);
UpdateRect(start,Principal_Hauteur_image,end-start + 1,1);
@ -1425,10 +1425,10 @@ void Afficher_barre_de_split(void)
// -- Afficher une barre horizontale XOR zoomée
void Ligne_horizontale_XOR_Zoom(short Pos_X, short Pos_Y, short width)
void Ligne_horizontale_XOR_Zoom(short x_pos, short y_pos, short width)
{
short Pos_X_reelle=Principal_X_Zoom+(Pos_X-Loupe_Decalage_X)*Loupe_Facteur;
short Pos_Y_reelle=(Pos_Y-Loupe_Decalage_Y)*Loupe_Facteur;
short Pos_X_reelle=Principal_X_Zoom+(x_pos-Loupe_Decalage_X)*Loupe_Facteur;
short Pos_Y_reelle=(y_pos-Loupe_Decalage_Y)*Loupe_Facteur;
short Largeur_reelle=width*Loupe_Facteur;
short Pos_Y_Fin=(Pos_Y_reelle+Loupe_Facteur<Menu_Ordonnee)?Pos_Y_reelle+Loupe_Facteur:Menu_Ordonnee;
short Indice;
@ -1442,10 +1442,10 @@ void Ligne_horizontale_XOR_Zoom(short Pos_X, short Pos_Y, short width)
// -- Afficher une barre verticale XOR zoomée
void Ligne_verticale_XOR_Zoom(short Pos_X, short Pos_Y, short height)
void Ligne_verticale_XOR_Zoom(short x_pos, short y_pos, short height)
{
short Pos_X_reelle=Principal_X_Zoom+(Pos_X-Loupe_Decalage_X)*Loupe_Facteur;
short Pos_Y_reelle=(Pos_Y-Loupe_Decalage_Y)*Loupe_Facteur;
short Pos_X_reelle=Principal_X_Zoom+(x_pos-Loupe_Decalage_X)*Loupe_Facteur;
short Pos_Y_reelle=(y_pos-Loupe_Decalage_Y)*Loupe_Facteur;
short Pos_Y_Fin=(Pos_Y_reelle+(height*Loupe_Facteur<Menu_Ordonnee))?Pos_Y_reelle+(height*Loupe_Facteur):Menu_Ordonnee;
short Indice;
@ -1465,8 +1465,8 @@ void Afficher_curseur(void)
short Debut_Y;
short Fin_X;
short Fin_Y;
short Pos_X;
short Pos_Y;
short x_pos;
short y_pos;
short Compteur_X;
short Compteur_Y;
int Temp;
@ -1515,16 +1515,16 @@ void Afficher_curseur(void)
Debut_X=Mouse_X-Curseur_Decalage_X[Temp];
Debut_Y=Mouse_Y-Curseur_Decalage_Y[Temp];
for (Pos_X=Debut_X,Compteur_X=0;Compteur_X<15 && Pos_X < Largeur_ecran;Pos_X++,Compteur_X++)
for (x_pos=Debut_X,Compteur_X=0;Compteur_X<15 && x_pos < Largeur_ecran;x_pos++,Compteur_X++)
{
if( Pos_X < 0 ) continue;
for (Pos_Y=Debut_Y,Compteur_Y=0;Compteur_Y<15 && Pos_Y < Hauteur_ecran;Pos_Y++,Compteur_Y++)
if( x_pos < 0 ) continue;
for (y_pos=Debut_Y,Compteur_Y=0;Compteur_Y<15 && y_pos < Hauteur_ecran;y_pos++,Compteur_Y++)
{
if( Pos_Y < 0 || Pos_Y >= Hauteur_ecran) continue;
if( y_pos < 0 || y_pos >= Hauteur_ecran) continue;
Couleur=SPRITE_CURSEUR[Temp][Compteur_Y][Compteur_X];
FOND_CURSEUR[Compteur_Y][Compteur_X]=Lit_pixel(Pos_X,Pos_Y);
FOND_CURSEUR[Compteur_Y][Compteur_X]=Lit_pixel(x_pos,y_pos);
if (Couleur!=CM_Trans)
Pixel(Pos_X,Pos_Y,Couleur);
Pixel(x_pos,y_pos,Couleur);
}
}
@ -1583,16 +1583,16 @@ void Afficher_curseur(void)
Debut_X=Mouse_X-Curseur_Decalage_X[Temp];
Debut_Y=Mouse_Y-Curseur_Decalage_Y[Temp];
for (Pos_X=Debut_X,Compteur_X=0;Compteur_X<15;Pos_X++,Compteur_X++)
for (Pos_Y=Debut_Y,Compteur_Y=0;Compteur_Y<15;Pos_Y++,Compteur_Y++)
for (x_pos=Debut_X,Compteur_X=0;Compteur_X<15;x_pos++,Compteur_X++)
for (y_pos=Debut_Y,Compteur_Y=0;Compteur_Y<15;y_pos++,Compteur_Y++)
{
Couleur=SPRITE_CURSEUR[Temp][Compteur_Y][Compteur_X];
if ( (Pos_X>=0) && (Pos_X<Largeur_ecran)
&& (Pos_Y>=0) && (Pos_Y<Hauteur_ecran) )
if ( (x_pos>=0) && (x_pos<Largeur_ecran)
&& (y_pos>=0) && (y_pos<Hauteur_ecran) )
{
FOND_CURSEUR[Compteur_Y][Compteur_X]=Lit_pixel(Pos_X,Pos_Y);
FOND_CURSEUR[Compteur_Y][Compteur_X]=Lit_pixel(x_pos,y_pos);
if (Couleur!=CM_Trans)
Pixel(Pos_X,Pos_Y,Couleur);
Pixel(x_pos,y_pos,Couleur);
}
}
UpdateRect(Debut_X,Debut_Y,16,16);
@ -1609,36 +1609,36 @@ void Afficher_curseur(void)
case FORME_CURSEUR_SABLIER :
Debut_X=Mouse_X-Curseur_Decalage_X[shape];
Debut_Y=Mouse_Y-Curseur_Decalage_Y[shape];
for (Pos_X=Debut_X,Compteur_X=0;Compteur_X<15;Pos_X++,Compteur_X++)
for (x_pos=Debut_X,Compteur_X=0;Compteur_X<15;x_pos++,Compteur_X++)
{
if(Pos_X<0) continue;
if(Pos_X>=Largeur_ecran) break;
for (Pos_Y=Debut_Y,Compteur_Y=0;Compteur_Y<15;Pos_Y++,Compteur_Y++)
if(x_pos<0) continue;
if(x_pos>=Largeur_ecran) break;
for (y_pos=Debut_Y,Compteur_Y=0;Compteur_Y<15;y_pos++,Compteur_Y++)
{
if(Pos_Y<0) continue;
if(Pos_Y>=Hauteur_ecran) break;
if(y_pos<0) continue;
if(y_pos>=Hauteur_ecran) break;
Couleur=SPRITE_CURSEUR[shape][Compteur_Y][Compteur_X];
// On sauvegarde dans FOND_CURSEUR pour restaurer plus tard
FOND_CURSEUR[Compteur_Y][Compteur_X]=Lit_pixel(Pos_X,Pos_Y);
FOND_CURSEUR[Compteur_Y][Compteur_X]=Lit_pixel(x_pos,y_pos);
if (Couleur!=CM_Trans)
Pixel(Pos_X,Pos_Y,Couleur);
Pixel(x_pos,y_pos,Couleur);
}
}
UpdateRect(Max(Debut_X,0),Max(Debut_Y,0),Compteur_X,Compteur_Y);
break;
case FORME_CURSEUR_CIBLE_XOR :
Pos_X=Pinceau_X-Principal_Decalage_X;
Pos_Y=Pinceau_Y-Principal_Decalage_Y;
x_pos=Pinceau_X-Principal_Decalage_X;
y_pos=Pinceau_Y-Principal_Decalage_Y;
Compteur_X=(Loupe_Mode)?Principal_Split:Largeur_ecran; // width de la barre XOR
if ((Pos_Y<Menu_Ordonnee) && (Pinceau_Y>=Limite_Haut))
if ((y_pos<Menu_Ordonnee) && (Pinceau_Y>=Limite_Haut))
{
Ligne_horizontale_XOR(0,Pinceau_Y-Principal_Decalage_Y,Compteur_X);
UpdateRect(0,Pinceau_Y-Principal_Decalage_Y,Compteur_X,1);
}
if ((Pos_X<Compteur_X) && (Pinceau_X>=Limite_Gauche))
if ((x_pos<Compteur_X) && (Pinceau_X>=Limite_Gauche))
{
Ligne_verticale_XOR(Pinceau_X-Principal_Decalage_X,0,Menu_Ordonnee);
UpdateRect(Pinceau_X-Principal_Decalage_X,0,1,Menu_Ordonnee);
@ -1711,11 +1711,11 @@ void Afficher_curseur(void)
}
else
{
Pos_X=Pinceau_X-Brosse_Centre_rotation_X;
Pos_Y=Pinceau_Y-Brosse_Centre_rotation_Y;
cosA=(float)Pos_X/sqrt((Pos_X*Pos_X)+(Pos_Y*Pos_Y));
x_pos=Pinceau_X-Brosse_Centre_rotation_X;
y_pos=Pinceau_Y-Brosse_Centre_rotation_Y;
cosA=(float)x_pos/sqrt((x_pos*x_pos)+(y_pos*y_pos));
sinA=sin(acos(cosA));
if (Pos_Y>0) sinA=-sinA;
if (y_pos>0) sinA=-sinA;
}
Transformer_point(Debut_X,Debut_Y, cosA,sinA, &X1,&Y1);
@ -1767,8 +1767,8 @@ void Effacer_curseur(void)
int Debut_Y;
short Fin_X;
short Fin_Y;
int Pos_X;
int Pos_Y;
int x_pos;
int y_pos;
short Compteur_X;
short Compteur_Y;
//short Fin_Compteur_X; // Position X ou s'arrête l'affichage de la brosse/pinceau
@ -1817,18 +1817,18 @@ void Effacer_curseur(void)
Debut_X=Mouse_X-Curseur_Decalage_X[Temp];
Debut_Y=Mouse_Y-Curseur_Decalage_Y[Temp];
for (Pos_Y=Debut_Y,Compteur_Y=0;Compteur_Y<15;Pos_Y++,Compteur_Y++)
for (y_pos=Debut_Y,Compteur_Y=0;Compteur_Y<15;y_pos++,Compteur_Y++)
{
if(Pos_Y>=Hauteur_ecran) break;
for (Pos_X=Debut_X,Compteur_X=0;Compteur_X<15;Pos_X++,Compteur_X++)
if(y_pos>=Hauteur_ecran) break;
for (x_pos=Debut_X,Compteur_X=0;Compteur_X<15;x_pos++,Compteur_X++)
{
if ( (Pos_X<0) || (Pos_Y < 0)) continue;
else if (Pos_X>=Largeur_ecran) break;
Pixel(Pos_X,Pos_Y,FOND_CURSEUR[Compteur_Y][Compteur_X]);
if ( (x_pos<0) || (y_pos < 0)) continue;
else if (x_pos>=Largeur_ecran) break;
Pixel(x_pos,y_pos,FOND_CURSEUR[Compteur_Y][Compteur_X]);
}
}
UpdateRect(Max(Debut_X,0),Max(Debut_Y,0),Pos_X-Debut_X,Pos_Y-Debut_Y);
UpdateRect(Max(Debut_X,0),Max(Debut_Y,0),x_pos-Debut_X,y_pos-Debut_Y);
}
}
if (!Cacher_pinceau)
@ -1885,10 +1885,10 @@ void Effacer_curseur(void)
Debut_X=Mouse_X-Curseur_Decalage_X[Temp];
Debut_Y=Mouse_Y-Curseur_Decalage_Y[Temp];
for (Pos_X=Debut_X,Compteur_X=0;Compteur_X<15;Pos_X++,Compteur_X++)
for (Pos_Y=Debut_Y,Compteur_Y=0;Compteur_Y<15;Pos_Y++,Compteur_Y++)
if ( (Pos_X>=0) && (Pos_X<Largeur_ecran) && (Pos_Y>=0) && (Pos_Y<Hauteur_ecran) )
Pixel(Pos_X,Pos_Y,FOND_CURSEUR[Compteur_Y][Compteur_X]);
for (x_pos=Debut_X,Compteur_X=0;Compteur_X<15;x_pos++,Compteur_X++)
for (y_pos=Debut_Y,Compteur_Y=0;Compteur_Y<15;y_pos++,Compteur_Y++)
if ( (x_pos>=0) && (x_pos<Largeur_ecran) && (y_pos>=0) && (y_pos<Hauteur_ecran) )
Pixel(x_pos,y_pos,FOND_CURSEUR[Compteur_Y][Compteur_X]);
UpdateRect(Max(Debut_X,0),Max(Debut_Y,0),16,16);
}
@ -1907,32 +1907,32 @@ void Effacer_curseur(void)
Debut_X=Mouse_X-Curseur_Decalage_X[shape];
Debut_Y=Mouse_Y-Curseur_Decalage_Y[shape];
for (Pos_X=Debut_X,Compteur_X=0;Compteur_X<15;Pos_X++,Compteur_X++)
for (x_pos=Debut_X,Compteur_X=0;Compteur_X<15;x_pos++,Compteur_X++)
{
if(Pos_X<0) continue;
if(Pos_X>=Largeur_ecran) break;
for (Pos_Y=Debut_Y,Compteur_Y=0;Compteur_Y<15;Pos_Y++,Compteur_Y++)
if(x_pos<0) continue;
if(x_pos>=Largeur_ecran) break;
for (y_pos=Debut_Y,Compteur_Y=0;Compteur_Y<15;y_pos++,Compteur_Y++)
{
if(Pos_Y<0) continue;
if(Pos_Y>=Hauteur_ecran) break;
Pixel(Pos_X,Pos_Y,FOND_CURSEUR[Compteur_Y][Compteur_X]);
if(y_pos<0) continue;
if(y_pos>=Hauteur_ecran) break;
Pixel(x_pos,y_pos,FOND_CURSEUR[Compteur_Y][Compteur_X]);
}
}
UpdateRect(Max(Debut_X,0),Max(Debut_Y,0),Compteur_X,Compteur_Y);
break;
case FORME_CURSEUR_CIBLE_XOR :
Pos_X=Pinceau_X-Principal_Decalage_X;
Pos_Y=Pinceau_Y-Principal_Decalage_Y;
x_pos=Pinceau_X-Principal_Decalage_X;
y_pos=Pinceau_Y-Principal_Decalage_Y;
Compteur_X=(Loupe_Mode)?Principal_Split:Largeur_ecran; // width de la barre XOR
if ((Pos_Y<Menu_Ordonnee) && (Pinceau_Y>=Limite_Haut))
if ((y_pos<Menu_Ordonnee) && (Pinceau_Y>=Limite_Haut))
{
Ligne_horizontale_XOR(0,Pinceau_Y-Principal_Decalage_Y,Compteur_X);
UpdateRect(0,Pinceau_Y-Principal_Decalage_Y,Compteur_X,1);
}
if ((Pos_X<Compteur_X) && (Pinceau_X>=Limite_Gauche))
if ((x_pos<Compteur_X) && (Pinceau_X>=Limite_Gauche))
{
Ligne_verticale_XOR(Pinceau_X-Principal_Decalage_X,0,Menu_Ordonnee);
UpdateRect(Pinceau_X-Principal_Decalage_X,0,1,Menu_Ordonnee);
@ -2008,11 +2008,11 @@ void Effacer_curseur(void)
}
else
{
Pos_X=Pinceau_X-Brosse_Centre_rotation_X;
Pos_Y=Pinceau_Y-Brosse_Centre_rotation_Y;
cosA=(float)Pos_X/sqrt((Pos_X*Pos_X)+(Pos_Y*Pos_Y));
x_pos=Pinceau_X-Brosse_Centre_rotation_X;
y_pos=Pinceau_Y-Brosse_Centre_rotation_Y;
cosA=(float)x_pos/sqrt((x_pos*x_pos)+(y_pos*y_pos));
sinA=sin(acos(cosA));
if (Pos_Y>0) sinA=-sinA;
if (y_pos>0) sinA=-sinA;
}
Transformer_point(Debut_X,Debut_Y, cosA,sinA, &X1,&Y1);
@ -2151,7 +2151,7 @@ byte Meilleure_couleur(byte r,byte g,byte b)
if (!Exclude_color[Coul])
{
Delta_R=(int)Principal_Palette[Coul].R-r;
Delta_V=(int)Principal_Palette[Coul].V-g;
Delta_V=(int)Principal_Palette[Coul].G-g;
Delta_B=(int)Principal_Palette[Coul].B-b;
if (!(Dist=(Delta_R*Delta_R*30)+(Delta_V*Delta_V*59)+(Delta_B*Delta_B*11)))
@ -2179,7 +2179,7 @@ byte Meilleure_couleur_sans_exclusion(byte Rouge,byte Vert,byte Bleu)
for (Coul=0; Coul<256; Coul++)
{
Delta_R=(int)Principal_Palette[Coul].R-Rouge;
Delta_V=(int)Principal_Palette[Coul].V-Vert;
Delta_V=(int)Principal_Palette[Coul].G-Vert;
Delta_B=(int)Principal_Palette[Coul].B-Bleu;
if (!(Dist=(Delta_R*Delta_R*30)+(Delta_V*Delta_V*59)+(Delta_B*Delta_B*11)))
@ -2195,7 +2195,7 @@ byte Meilleure_couleur_sans_exclusion(byte Rouge,byte Vert,byte Bleu)
}
void Calculer_les_4_meilleures_couleurs_pour_1_couleur_du_menu
(byte Rouge, byte Vert, byte Bleu, Composantes * Palette, byte * Table)
(byte Rouge, byte Vert, byte Bleu, Composantes * palette, byte * Table)
{
short Coul;
int Delta_R,Delta_V,Delta_B;
@ -2205,9 +2205,9 @@ void Calculer_les_4_meilleures_couleurs_pour_1_couleur_du_menu
for (Coul=0; Coul<256; Coul++)
{
Delta_R=(int)Palette[Coul].R-Rouge;
Delta_V=(int)Palette[Coul].V-Vert;
Delta_B=(int)Palette[Coul].B-Bleu;
Delta_R=(int)palette[Coul].R-Rouge;
Delta_V=(int)palette[Coul].G-Vert;
Delta_B=(int)palette[Coul].B-Bleu;
Dist=(Delta_R*Delta_R*30)+(Delta_V*Delta_V*59)+(Delta_B*Delta_B*11);
@ -2338,7 +2338,7 @@ void Remapper_ecran_apres_changement_couleurs_menu(void)
void Calculer_couleurs_menu_optimales(Composantes * Palette)
void Calculer_couleurs_menu_optimales(Composantes * palette)
{
byte Table[4];
short i,j,k;
@ -2352,12 +2352,12 @@ void Calculer_couleurs_menu_optimales(Composantes * Palette)
// Recherche du noir
Calculer_les_4_meilleures_couleurs_pour_1_couleur_du_menu
(Coul_menu_pref[0].R, Coul_menu_pref[0].V, Coul_menu_pref[0].B,Palette,Table);
(Coul_menu_pref[0].R, Coul_menu_pref[0].G, Coul_menu_pref[0].B,palette,Table);
CM_Noir=Table[0];
// Recherche du blanc
Calculer_les_4_meilleures_couleurs_pour_1_couleur_du_menu
(Coul_menu_pref[3].R, Coul_menu_pref[3].V, Coul_menu_pref[3].B,Palette,Table);
(Coul_menu_pref[3].R, Coul_menu_pref[3].G, Coul_menu_pref[3].B,palette,Table);
if (CM_Noir!=Table[0])
CM_Blanc=Table[0];
else
@ -2365,7 +2365,7 @@ void Calculer_couleurs_menu_optimales(Composantes * Palette)
// Recherche du gris clair
Calculer_les_4_meilleures_couleurs_pour_1_couleur_du_menu
(Coul_menu_pref[2].R, Coul_menu_pref[2].V, Coul_menu_pref[2].B,Palette,Table);
(Coul_menu_pref[2].R, Coul_menu_pref[2].G, Coul_menu_pref[2].B,palette,Table);
if ( (CM_Noir!=Table[0]) && (CM_Blanc!=Table[0]) )
CM_Clair=Table[0];
else
@ -2378,7 +2378,7 @@ void Calculer_couleurs_menu_optimales(Composantes * Palette)
// Recherche du gris foncé
Calculer_les_4_meilleures_couleurs_pour_1_couleur_du_menu
(Coul_menu_pref[1].R, Coul_menu_pref[1].V, Coul_menu_pref[1].B,Palette,Table);
(Coul_menu_pref[1].R, Coul_menu_pref[1].G, Coul_menu_pref[1].B,palette,Table);
if ( (CM_Noir!=Table[0]) && (CM_Blanc!=Table[0]) && (CM_Clair!=Table[0]) )
CM_Fonce=Table[0];
else
@ -2396,8 +2396,8 @@ void Calculer_couleurs_menu_optimales(Composantes * Palette)
// C'est peu probable mais il est possible que CM_Clair soit plus foncée que
// CM_Fonce. Dans ce cas, on les inverse.
if ( ((Palette[CM_Clair].R*30)+(Palette[CM_Clair].V*59)+(Palette[CM_Clair].B*11)) <
((Palette[CM_Fonce].R*30)+(Palette[CM_Fonce].V*59)+(Palette[CM_Fonce].B*11)) )
if ( ((palette[CM_Clair].R*30)+(palette[CM_Clair].G*59)+(palette[CM_Clair].B*11)) <
((palette[CM_Fonce].R*30)+(palette[CM_Fonce].G*59)+(palette[CM_Fonce].B*11)) )
{
i=CM_Clair;
CM_Clair=CM_Fonce;

View File

@ -28,7 +28,7 @@ void Afficher_curseur(void);
void Effacer_curseur(void);
void Remapper_ecran_apres_changement_couleurs_menu(void);
void Calculer_couleurs_menu_optimales(Composantes * Palette);
void Calculer_couleurs_menu_optimales(Composantes * palette);
void Recadrer_ecran_par_rapport_au_zoom(void);
void Calculer_split(void);
@ -50,9 +50,9 @@ word Palette_Cells_Y(void);
void Print_general(short X,short Y,const char * Chaine,byte Couleur_texte,byte Couleur_fond);
void Print_dans_fenetre(short X,short Y,const char * Chaine,byte Couleur_texte,byte Couleur_fond);
void Print_dans_fenetre_limite(short X,short Y,const char * Chaine,byte Taille,byte Couleur_texte,byte Couleur_fond);
void Print_char_dans_fenetre(short Pos_X,short Pos_Y,const unsigned char c,byte Couleur_texte,byte Couleur_fond);
void Print_char_transparent_dans_fenetre(short Pos_X,short Pos_Y,const unsigned char c,byte Couleur);
void Print_dans_menu(const char * Chaine, short Position);
void Print_char_dans_fenetre(short x_pos,short y_pos,const unsigned char c,byte Couleur_texte,byte Couleur_fond);
void Print_char_transparent_dans_fenetre(short x_pos,short y_pos,const unsigned char c,byte Couleur);
void Print_dans_menu(const char * Chaine, short position);
void Print_coordonnees(void);
void Print_nom_fichier(void);
void Print_compteur(short X,short Y,const char * Chaine,byte Couleur_texte,byte Couleur_fond);
@ -62,25 +62,25 @@ 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 width,word height,
void Fenetre_Afficher_cadre_general(word x_pos,word y_pos,word width,word height,
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 width,word height,byte Couleur);
void Fenetre_Afficher_cadre_creux(word Pos_X,word Pos_Y,word width,word height);
void Fenetre_Afficher_cadre_bombe(word Pos_X,word Pos_Y,word width,word height);
void Fenetre_Afficher_cadre(word Pos_X,word Pos_Y,word width,word height);
void Fenetre_Afficher_cadre_mono(word x_pos,word y_pos,word width,word height,byte Couleur);
void Fenetre_Afficher_cadre_creux(word x_pos,word y_pos,word width,word height);
void Fenetre_Afficher_cadre_bombe(word x_pos,word y_pos,word width,word height);
void Fenetre_Afficher_cadre(word x_pos,word y_pos,word width,word height);
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 Afficher_pinceau_dans_fenetre(word X,word Y,int number);
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);
void Bloc_degrade_dans_fenetre(word x_pos,word y_pos,word Debut_block,word Fin_block);
void Fenetre_Afficher_sprite_drive(word x_pos,word y_pos,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 width);
void Ligne_verticale_XOR_Zoom(short Pos_X, short Pos_Y, short height);
void Ligne_horizontale_XOR_Zoom(short x_pos, short y_pos, short width);
void Ligne_verticale_XOR_Zoom(short x_pos, short y_pos, short height);
#endif