当前位置:首页 > 计算机图形学-区域填充的扫描线算法
}
}
x++ ;
}
if (SpanNeedFill) {
pt.x= x - 1; pt.y = y; stackpush (S,pt); SpanNeedFill=false;
}
while ((getpixel (x, y)!=oldcolor) && (x < xr))
x++;
}
//主函数检测 void main() {
int radius,color; int x,y;//种子点
int oldcolor,newcolor;//原色与填充色 //输入参数值
printf(\画圆参数
scanf(\ printf(\读入内点 scanf(\
printf(\读入原色与填充色 scanf(\
int gdriver = DETECT,gmode;
initgraph(&gdriver, &gmode, \ // 用背景色清空屏幕 cleardevice(); // 设置绘图色为红色 setcolor(RED);
MidpointCircle(radius,color);//用中点画圆算法画圆 rectangle(150, 150, 350, 350);//再画一个矩形区域 ScanLineFill4 (x,y,oldcolor,newcolor);//扫描线区域填充
getch(); }
五.运行结果与讨论: 测试结果1: closegraph();
测试结果2:
六.实验分析与讨论:
共分享92篇相关文档