/* Grafx2 - The Ultimate 256-color bitmap paint program Copyright 2007 Adrien Destugues Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) Grafx2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. Grafx2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Grafx2; if not, see or write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include "const.h" #include "struct.h" #include "global.h" #include "graph.h" #include "moteur.h" #include "windows.h" //---------------------- Modifier le pinceau spécial ------------------------- void Modifier_pinceau(int width, int height) { int x_pos,y_pos; int X,Y; float Rayon2; if (width<1) width=1; if (height<1) height=1; if (width>TAILLE_MAXI_PINCEAU) width=TAILLE_MAXI_PINCEAU; if (height>TAILLE_MAXI_PINCEAU) height=TAILLE_MAXI_PINCEAU; Pinceau_Largeur=width; Pinceau_Hauteur=height; Pinceau_Decalage_X=Pinceau_Largeur>>1; Pinceau_Decalage_Y=Pinceau_Hauteur>>1; switch (Pinceau_Forme) { case FORME_PINCEAU_ROND : Rayon2=Pinceau_Decalage_X+0.414213562; // [0.410..0.415[ Rayon2*=Rayon2; for (y_pos=0; y_pos>1; for (y_pos=0; y_pos>1; for (y_pos=0; y_pos>1; for (y_pos=0; y_pos>1; for (y_pos=0; y_pos>1; for (y_pos=0; y_pos1) || (Pinceau_Hauteur>1) ) ) { Effacer_curseur(); switch (Pinceau_Forme) { case FORME_PINCEAU_ROND: case FORME_PINCEAU_ROND_TRAME: case FORME_PINCEAU_X: case FORME_PINCEAU_PLUS: case FORME_PINCEAU_LOSANGE: case FORME_PINCEAU_ALEATOIRE: if (Pinceau_Largeur&1) Modifier_pinceau(Pinceau_Largeur-2,Pinceau_Hauteur-2); else Modifier_pinceau(Pinceau_Largeur-1,Pinceau_Hauteur-1); break; case FORME_PINCEAU_CARRE: case FORME_PINCEAU_SLASH: case FORME_PINCEAU_ANTISLASH: case FORME_PINCEAU_CARRE_TRAME: Modifier_pinceau(Pinceau_Largeur-1,Pinceau_Hauteur-1); break; case FORME_PINCEAU_BARRE_HORIZONTALE: Modifier_pinceau(Pinceau_Largeur-1,1); break; case FORME_PINCEAU_BARRE_VERTICALE: Modifier_pinceau(1,Pinceau_Hauteur-1); } Afficher_pinceau_dans_menu(); Afficher_curseur(); } } void Grossir_pinceau(void) { if ( (Pinceau_FormePrincipal_Largeur_image) Decalage_temporaire_X=Principal_Largeur_image-Largeur_ecran; if (Decalage_temporaire_Y+Menu_Ordonnee>Principal_Hauteur_image) Decalage_temporaire_Y=Principal_Hauteur_image-Menu_Ordonnee; if (Decalage_temporaire_X<0) Decalage_temporaire_X=0; if (Decalage_temporaire_Y<0) Decalage_temporaire_Y=0; if ( (Principal_Decalage_X!=Decalage_temporaire_X) || (Principal_Decalage_Y!=Decalage_temporaire_Y) ) { Effacer_curseur(); Principal_Decalage_X=Decalage_temporaire_X; Principal_Decalage_Y=Decalage_temporaire_Y; Calculer_limites(); Calculer_coordonnees_pinceau(); Afficher_ecran(); // <=> Display_screen + Afficher_limites_de_l_image Afficher_curseur(); } } // ---------------------- Scroller la fenêtre de la loupe -------------------- void Scroller_loupe(short Decalage_en_X,short Decalage_en_Y) { short Decalage_temporaire_X; short Decalage_temporaire_Y; Decalage_temporaire_X=Loupe_Decalage_X+Decalage_en_X; Decalage_temporaire_Y=Loupe_Decalage_Y+Decalage_en_Y; if (Decalage_temporaire_X+Loupe_Largeur>Principal_Largeur_image) Decalage_temporaire_X=Principal_Largeur_image-Loupe_Largeur; if (Decalage_temporaire_Y+Loupe_Hauteur>Principal_Hauteur_image) Decalage_temporaire_Y=Principal_Hauteur_image-Loupe_Hauteur; if (Decalage_temporaire_X<0) Decalage_temporaire_X=0; if (Decalage_temporaire_Y<0) Decalage_temporaire_Y=0; if ( (Loupe_Decalage_X!=Decalage_temporaire_X) || (Loupe_Decalage_Y!=Decalage_temporaire_Y) ) { Effacer_curseur(); Loupe_Decalage_X=Decalage_temporaire_X; Loupe_Decalage_Y=Decalage_temporaire_Y; Recadrer_ecran_par_rapport_au_zoom(); Calculer_limites(); Calculer_coordonnees_pinceau(); Afficher_ecran(); Afficher_curseur(); } } // -------------- Changer le Zoom (grâce aux touches [+] et [-]) ------------- void Zoom(short Sens) { short Indice; for (Indice=0; FACTEUR_ZOOM[Indice]!=Loupe_Facteur; Indice++); Indice+=Sens; if ( (Indice>=0) && (Indice