From 4349fd71a3c2ca2519ab1eefa8c2be511a8e431c Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sun, 1 Feb 2009 23:15:24 +0000 Subject: [PATCH] Contour fill (issue 90), 4th mode of continuous drawing. However, there is a rendering problem from the original polygon tool: the bottom pixels are not drawn. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@581 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- boutons.c | 4 ++-- const.h | 1 + init.c | 11 +++++++++++ operatio.c | 40 ++++++++++++++++++++++++++++++++++++++++ operatio.h | 1 + 5 files changed, 55 insertions(+), 2 deletions(-) diff --git a/boutons.c b/boutons.c index 379458d6..04292653 100644 --- a/boutons.c +++ b/boutons.c @@ -1687,7 +1687,7 @@ void Bouton_Dessin_Switch_mode(void) { /* ANCIEN CODE SANS POPUPS */ Mode_de_dessin_en_cours++; - if (Mode_de_dessin_en_cours>OPERATION_DESSIN_POINT) + if (Mode_de_dessin_en_cours>OPERATION_FILLED_CONTOUR) Mode_de_dessin_en_cours=OPERATION_DESSIN_CONTINU; Effacer_curseur(); @@ -1711,7 +1711,7 @@ void Bouton_Dessin_Switch_mode(void) { case 1: Mode_de_dessin_en_cours++; - if (Mode_de_dessin_en_cours>OPERATION_DESSIN_POINT) + if (Mode_de_dessin_en_cours>OPERATION_FILLED_CONTOUR) Mode_de_dessin_en_cours=OPERATION_DESSIN_CONTINU; break; } diff --git a/const.h b/const.h index 2d871e67..27b76545 100644 --- a/const.h +++ b/const.h @@ -375,6 +375,7 @@ enum OPERATIONS OPERATION_DESSIN_CONTINU, // Dessin à la main continu OPERATION_DESSIN_DISCONTINU, // Dessin à la main discontinu OPERATION_DESSIN_POINT, // Dessin à la main point par point + OPERATION_FILLED_CONTOUR, // Contour rempli OPERATION_LIGNE, // Lignes OPERATION_K_LIGNE, // Lignes reliées OPERATION_LIGNES_CENTREES, // Lignes concentriques diff --git a/init.c b/init.c index 57770438..67a08266 100644 --- a/init.c +++ b/init.c @@ -1534,6 +1534,17 @@ void Initialisation_des_operations(void) Initialiser_operation(OPERATION_FILLED_POLYFORM,0,8, Filled_polyform_0_8,0); + Initialiser_operation(OPERATION_FILLED_CONTOUR,1,0, + Filled_polyform_12_0,1); + Initialiser_operation(OPERATION_FILLED_CONTOUR,2,0, + Filled_polyform_12_0,1); + Initialiser_operation(OPERATION_FILLED_CONTOUR,1,8, + Filled_polyform_12_8,0); + Initialiser_operation(OPERATION_FILLED_CONTOUR,2,8, + Filled_polyform_12_8,0); + Initialiser_operation(OPERATION_FILLED_CONTOUR,0,8, + Filled_contour_0_8,0); + Initialiser_operation(OPERATION_SCROLL,1,0, Scroll_12_0,1); Initialiser_operation(OPERATION_SCROLL,2,0, diff --git a/operatio.c b/operatio.c index d371df32..96e3986e 100644 --- a/operatio.c +++ b/operatio.c @@ -2740,6 +2740,46 @@ void Filled_polyform_0_8(void) Operation_PUSH(Clic); } +void Filled_contour_0_8(void) +// Opération : OPERATION_FILLED_CONTOUR +// Click Souris: 0 +// Taille_Pile : 8 +// +// Souris effacée: Non +{ + short Clic; + short Fin_Y; + short Fin_X; + short Debut_Y; + short Debut_X; + short Couleur; + short Initial_Y; + short Initial_X; + + Operation_POP(&Clic); + Operation_POP(&Fin_Y); + Operation_POP(&Fin_X); + Operation_POP(&Debut_Y); + Operation_POP(&Debut_X); + Operation_POP(&Couleur); + Operation_POP(&Initial_Y); + Operation_POP(&Initial_X); + + Attendre_fin_de_click(); + Effacer_curseur(); + Print_coordonnees(); + + // Pas besoin d'effacer la ligne (Debut_X,Debut_Y)-(Fin_X,Fin_Y) + // puisque on les effaces toutes d'un coup. + + Afficher_ecran(); + Polyfill(Polyfill_Nombre_de_points,Polyfill_Table_de_points,Couleur); + free(Polyfill_Table_de_points); + + Cacher_pinceau=0; + + Afficher_curseur(); +} ////////////////////////////////////////////////////// OPERATION_PRISE_BROSSE diff --git a/operatio.h b/operatio.h index ac9534a7..b94efc8a 100644 --- a/operatio.h +++ b/operatio.h @@ -159,6 +159,7 @@ void Polyform_0_8(void); void Filled_polyform_12_0(void); void Filled_polyform_12_8(void); void Filled_polyform_0_8(void); +void Filled_contour_0_8(void); //////////////////////////////////////////////////////////// OPERATION_SCROLL