circle drawing

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@62 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2008-07-24 19:02:41 +00:00
parent bf4c695deb
commit 0797a72c70
2 changed files with 28 additions and 7 deletions

View File

@ -389,40 +389,42 @@ void Pixel_dans_ecran_courant (word X,word Y,byte Couleur)
void Remplacer_une_couleur(byte Ancienne_couleur, byte Nouvelle_couleur)
{
puts("Remplacer_une_couleur non implémenté!");
UNIMPLEMENTED
}
void Ellipse_Calculer_limites(short Rayon_horizontal,short Rayon_vertical)
{
puts("Ellipse_Calculer_limites non implémenté!");
UNIMPLEMENTED
}
byte Pixel_dans_ellipse(void)
{
puts("Pixel_dans_ellipse non implémenté!");
UNIMPLEMENTED
return 0;
}
byte Pixel_dans_cercle(void)
{
puts("Pixel_dans_cercle non implémenté!");
if((Table_des_carres[abs(Cercle_Curseur_X)] +
Table_des_carres[abs(Cercle_Curseur_Y)] ) <= Cercle_Limite)
return 255;
return 0;
}
void Copier_une_partie_d_image_dans_une_autre(byte * Source,word S_Pos_X,word S_Pos_Y,word Largeur,word Hauteur,word Largeur_source,byte * Destination,word D_Pos_X,word D_Pos_Y,word Largeur_destination)
{
puts("Copier_une_partie_d_image_dans_une_autre non implémenté!");
UNIMPLEMENTED
}
byte Lit_pixel_dans_ecran_brouillon(word X,word Y)
{
puts("Lit_pixel_dans_ecran_brouillon non implémenté!");
UNIMPLEMENTED
return 0;
}
void Rotate_90_deg_LOWLEVEL(byte * Source,byte * Destination)
{
puts("Rotate_90_deg_LOWLEVEL non implémenté!");
UNIMPLEMENTED
}
void Remap_general_LOWLEVEL(byte * Table_conv,byte * Buffer,short Largeur,short Hauteur,short Largeur_buffer)

19
graph.c
View File

@ -2171,6 +2171,8 @@ void Ligne_horizontale_XOR_Zoom(short Pos_X, short Pos_Y, short Largeur)
for (Indice=Pos_Y_reelle; Indice<Pos_Y_Fin; Indice++)
Ligne_horizontale_XOR(Pos_X_reelle,Indice,Largeur_reelle);
SDL_UpdateRect(Ecran_SDL,Pos_X_reelle,Pos_Y_reelle,Largeur_reelle,Pos_Y_Fin-Pos_Y_reelle);
}
@ -2185,6 +2187,8 @@ void Ligne_verticale_XOR_Zoom(short Pos_X, short Pos_Y, short Hauteur)
for (Indice=Pos_Y_reelle; Indice<Pos_Y_Fin; Indice++)
Ligne_horizontale_XOR(Pos_X_reelle,Indice,Loupe_Facteur);
SDL_UpdateRect(Ecran_SDL,Pos_X_reelle,Pos_Y_reelle,Loupe_Facteur,Pos_Y_Fin-Pos_Y_reelle);
}
@ -4018,6 +4022,9 @@ void Tracer_cercle_vide_General(short Centre_X,short Centre_Y,short Rayon,byte C
Pixel_figure(Centre_X-Rayon,Centre_Y,Couleur); // Gauche
Pixel_figure(Centre_X+Rayon,Centre_Y,Couleur); // Droite
Pixel_figure(Centre_X,Centre_Y+Rayon,Couleur); // Bas
SDL_UpdateRect(Ecran_SDL,Centre_X-Rayon-Principal_Decalage_X,
Centre_Y-Rayon-Principal_Decalage_Y,2*Rayon+1,2*Rayon+1);
}
// -- Tracé définitif d'un cercle vide --
@ -4075,6 +4082,9 @@ void Tracer_cercle_plein(short Centre_X,short Centre_Y,short Rayon,byte Couleur)
for (Pos_X=Debut_X,Cercle_Curseur_X=(long)Debut_X-Centre_X;Pos_X<=Fin_X;Pos_X++,Cercle_Curseur_X++)
if (Pixel_dans_cercle())
Afficher_pixel(Pos_X,Pos_Y,Couleur);
SDL_UpdateRect(Ecran_SDL,Debut_X+Principal_Decalage_X,
Debut_Y+Principal_Decalage_Y,Fin_X+1-Debut_X,Fin_Y+1-Debut_Y);
}
@ -4389,7 +4399,16 @@ void Tracer_rectangle_plein(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y,
// On trace le rectangle:
for (Pos_Y=Debut_Y;Pos_Y<=Fin_Y;Pos_Y++)
for (Pos_X=Debut_X;Pos_X<=Fin_X;Pos_X++)
// Afficher_pixel traite chaque pixel avec tous les effets ! (smear, ...)
// Donc on ne peut pas otimiser en traçant ligne par ligne avec memset :(
Afficher_pixel(Pos_X,Pos_Y,Couleur);
SDL_UpdateRect(Ecran_SDL,
Debut_X-Principal_Decalage_X,
Debut_Y-Principal_Decalage_Y,
Fin_X-Debut_X,
Fin_Y-Debut_Y);
if(Loupe_Mode) UpdateZoom(Debut_X,Debut_Y,Fin_X-Debut_X,Fin_Y-Debut_Y);
}