I need some help to fill any polygon (concave or convex).
The function must receive one point (x,y) inside the shape.
I've tried the recurse solution:
Code: Select all
void fillpoly(int x, int y, int color)
{
putpixel(x,y,color);
if (getpixel(x-1,y) == BLACK)
fillpoly(x-1,y,color);
if (getpixel(x+1,y) == BLACK)
fillpoly(x+1,y,color);
if (getpixel(x,y-1) == BLACK)
fillpoly(x,y-1,color);
if (getpixel(x,y+1) == BLACK)
fillpoly(x,y+1,color);
}
So if you know any solution for that...