You are on page 1of 2

#include

#include
#include
#include

<graphics.h>
<stdlib.h>
<stdio.h>
<conio.h>

int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int xmax, ymax;
int i,ht,y;
struct palettetype pal;
getpalette(&pal);
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
/* an error occurred */
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
setcolor(getmaxcolor());
xmax = getmaxx();
ymax = getmaxy();
/* draw a diagonal line */
// setfillstyle(SOLID_FILL, RED);
for (i=0; i<pal.size; i++)
setrgbpalette(pal.colors[i], 24, 177, 58);
for (i=0; i<pal.size; i++)
{ setfillstyle(SOLID_FILL, i);
bar(0, 0, xmax,100);
}
setfillstyle(SOLID_FILL, WHITE);
bar(0, 100, xmax,200);
// setrgbpalette(pal.colors[0],43,240,52 );
setfillstyle(SOLID_FILL, GREEN);
bar(0, 200, xmax,300);
//line(0, 100, xmax, 100);
setcolor(BLUE);
circle(xmax/2,150,50);
setfillstyle(SOLID_FILL, WHITE);
for(i=1;i<=24;i++)
{
pieslice(xmax/2,150,(i-1)*15,i*15,50);
}
setcolor(WHITE);
line(0,0,0,480);
/* create gray scale */
/* display the gray scale */

/* create gray scale */


//for (i=0; i<pal.size; i++)
// setrgbpalette(pal.colors[i],0, 255,0 );
/*for (i=0; i<pal.size; i++)
{
setfillstyle(SOLID_FILL, i);
bar(0, y, xmax, y+ht);
y += ht;
}*/
/* clean up */
getch();
closegraph();
return 0;
}

You might also like