c语言画多边形,任意斜率直线,填充

a=(int)(x+0.5),b=y; x-=1/k; }

printf(\} break; } }

void polygon(int n) {

float ang,direction; int i;

ang=(n-2)*180/n; direction=0;

Line(a,b,direction,50,3); for(i=1;i

direction+=(180-ang);

printf(\Line(a,b,direction,50,3); }

}

void BoundaryFill4(int x,int y,int boundarycolor,int newcolor)

{ int color; /*color怎么取值*/

color=getpixel(x,y);

if(color!=newcolor && color!=boundarycolor)

{putpixel(x,y,newcolor);

BoundaryFill4 (x+1,y, boundarycolor,newcolor);

BoundaryFill4 (x,y+1, boundarycolor,newcolor);

BoundaryFill4 (x-1,y, boundarycolor,newcolor);

BoundaryFill4 (x,y-1, boundarycolor,newcolor); } }

void main() {

initgraphics(); /*polygon(5);*/ polygon(5);

BoundaryFill4(225,225,3,4); }

联系客服:779662525#qq.com(#替换为@)