计算机图形学函数.ppt
void fillellipse(int x,int y,int rx,int ry); 画出一实心椭圆 void sector(int x,int y,int angs,int ange,int rx,int ry); 画出一实心椭圆扇区 void fillpoly(int nps,int *pxy); 画并填充一多边形。 例3: #include void mydraw(){ line(160,120,480,120); line(480,120,480,360); line(480,360,160,360); line(160,360,160,120); } main(){ int gdriver=DECTECT,gmode; initgraph(&gdriver,gmode,”c:\\tc”); cleardevice(); mydraw(); getch(); closegraph(); } 例4: #include main(){ int gdriver=DETECT,gmode; initgraph(&gdriver,&gmode,""); setbkcolor(15); setcolor(4); ellipse(320,240,0,360,300,200); setfillstyle(1,6); putpixel(320,240,6); floodfill(320,240,4); getch(); closegraph(); } 例5: #include main(){ int gdriver=DETECT,gmode; initgraph(&gdriver,&gmode,""); setbkcolor(15); setcolor(4); setfillstyle(1,6); fillellipse(320,240,300,200); getch(); closegraph(); } P296例B-1 金刚石图案 #include #include void main(){ float t; int x0=320,y0=240; int n,i,j,r,x[50],y[50]; int gdriver=DETECT,gmode;printf(" input n(23-31) and r(100-200)\n");scanf("%d,%d" ,&n,&r);initgraph(&gdriver,&gmode," d:\\tc\\bgi ");cleardevice();setcolor(9);setbkcolor(4) t=6.28314/n; for(i=0;i