Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,8 @@
|
|||
void raster_circle(
|
||||
image img,
|
||||
unsigned int x0,
|
||||
unsigned int y0,
|
||||
unsigned int radius,
|
||||
color_component r,
|
||||
color_component g,
|
||||
color_component b );
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#define plot(x, y) put_pixel_clip(img, x, y, r, g, b)
|
||||
|
||||
void raster_circle(
|
||||
image img,
|
||||
unsigned int x0,
|
||||
unsigned int y0,
|
||||
unsigned int radius,
|
||||
color_component r,
|
||||
color_component g,
|
||||
color_component b )
|
||||
{
|
||||
int f = 1 - radius;
|
||||
int ddF_x = 0;
|
||||
int ddF_y = -2 * radius;
|
||||
int x = 0;
|
||||
int y = radius;
|
||||
|
||||
plot(x0, y0 + radius);
|
||||
plot(x0, y0 - radius);
|
||||
plot(x0 + radius, y0);
|
||||
plot(x0 - radius, y0);
|
||||
|
||||
while(x < y)
|
||||
{
|
||||
if(f >= 0)
|
||||
{
|
||||
y--;
|
||||
ddF_y += 2;
|
||||
f += ddF_y;
|
||||
}
|
||||
x++;
|
||||
ddF_x += 2;
|
||||
f += ddF_x + 1;
|
||||
plot(x0 + x, y0 + y);
|
||||
plot(x0 - x, y0 + y);
|
||||
plot(x0 + x, y0 - y);
|
||||
plot(x0 - x, y0 - y);
|
||||
plot(x0 + y, y0 + x);
|
||||
plot(x0 - y, y0 + x);
|
||||
plot(x0 + y, y0 - x);
|
||||
plot(x0 - y, y0 - x);
|
||||
}
|
||||
}
|
||||
#undef plot
|
||||
Loading…
Add table
Add a link
Reference in a new issue