void far bar3d(int x1, int y1, int x2, int y2,int depth,int topflag);当
topflag为非0时, 画出一个三维的长方体。当topflag为0时,三维图形不封顶,
实际上很少这样使用。
void far setfillstyle(int pattern, int color); color的值是当前屏幕图形
模式时颜色的有效值,SOLID_FILL 1 以实填充
void far floodfill(int x, int y, int border);
其中:x, y为封闭图形内的任意一border为边界的颜色,也就是封闭图形轮廓的
颜色。调用了该函数后,将用规定的颜色和图模填满整个封闭图形。
#include
#include
main()
{
int gdriver, gmode;
struct fillsettingstype save;
gdriver=DETECT;
initgraph(&gdriver, &gmode, "");
setbkcolor(BLUE);
cleardevice();
setcolor(LIGHTRED);
setlinestyle(0,0,3);
setfillstyle(1,14); /*设置填充方式*/
bar3d(100,200,400,350,200,1); /*画长方体并填充*/
floodfill(450,300,LIGHTRED);
/*填充长方体另外两个面*/
floodfill(250,150, LIGHTRED);
getch();
closegraph();
}
#include "stdio.h"
#include "graphics.h"
main()
{
int gb=VGA,gm=VGAHI,errorcode;
initgraph(&gb,&gm,"");
bar3d(100,100,200,200,100,1);
getch();
}
楼上的已经给出详细的了,我就给一个简单点的吧。