3-D bar in c/c++ graphics


3-D bar in c/c++ graphics

bar3d() :

It draws a rectangular 3-d bar,then fills it with current fill pattern and fill color.

Syntax :

bar3d(int left,int top,int right,int bottom,int depth,int topflag);

(left,top) is the upper left corner of the bar and

(right,bottom) is the bottom right corner of the bar.

depth--bar's depth in pixel.

topflag--goverens whether a three dimensional top is put on the bar.

If topflag=1 then 3-d top is created and if

topflag=0 the 3-d top is not created

Example :


#include <graphics.h>
#include <conio.h>

void main()
{
int d,m;
int midx,midy;

d=DETECT;
initgraph(&d,&m,"c:\\tc\\bgi");

midx=getmaxx()/2;
midy=getmaxy()/2;

bar3d(midx-50,midy-50,midx+50,midy+50,50,1);//solid bar
getch();
closegraph();
}

Output :

0 comments:

Post a Comment