Small C Language Program to show the drawing and filling of some basic shapes like rectangle, circle etc… with colors and different shades. First of all I have created a characters array of patterns that will fill the drawing, then initialize the graphics mode and the draw the shapes.

//Please change BGI directory according to your Turbo C Directory

#include <stdio.h>
#include <conio.h>
#include <graphics.h>
main ()
{
int gd =DETECT, gm, maxx,maxy , x=40,y=40,fst;
char str[40];
char *pattern[]={
	"EMPTY_FILL", "SOLID_FILL","LTSLASH_FILL","SLASH_FILL","BKSLASH_FILL","LTBKSLASH_FILL",
	"HATCH_FILL", "XHATCH_FILL","INTERLEAVE_FILL","WIDE_DOR_FILL",
	"CLOSE_DOT_FILL","USER_FILL"
		 };
initgraph(&gd,&gm,"e:\\tc\\bgi");
	maxx=getmaxx();
	maxy=getmaxy();
	rectangle(0,10,maxx,maxy);

	setcolor(WHITE);
	outtextxy(175,0,"Pre-Defined Fill styles");

		for (fst=0;fst<12;fst++)
		{
		  setfillstyle(fst, MAGENTA);
		  bar (x,y,x+80,y+80);
		  itoa (fst,str,10);
		  outtextxy(x,y+100,str);
		  outtextxy(x,y+100,pattern[fst]);

		  x=x+150;
		  if (x>490)
		  {
		    y=y+150;
		    x=40;
		  }
		}
	getch();
	closegraph();
	restorecrtmode();
return 0;

}