Home › Forums › C Programming › Draw Shapes and fill them
- This topic has 1 reply, 2 voices, and was last updated 16 years, 8 months ago by indinfer.
Viewing 1 reply thread
- AuthorPosts
- February 25, 2005 at 9:37 am #1888willParticipant
Here is a small code that demonstrate how to make shapes in c language and fill them with colors and patterns.
1234567891011121314151617181920212223242526272829303132333435363738/*<br />Author: Muhammad Saqib<br />*/<br />#include<graphics.h><br />#include<conio.h><br />#include<stdlib.h><br />main (){<br />int gd =DETECT, gm, maxx,maxy , x=40,y=40,fst;<br />char str[40];<br />char *pattern[]={<br />"EMPTY_FILL", "SOLID_FILL","LTSLASH_FILL","SLASH_FILL","BKSLASH_FILL","LTB KSLASH_FILL",<br />"HATCH_FILL", "XHATCH_FILL","INTERLEAVE_FILL","WIDE_DOR_FILL",<br />"CLOSE_DOT_FILL","USER_FILL"<br />};<br />initgraph(&gd,&gm,"F:\tc\bgi");//Path to the BGI folder<br />maxx=getmaxx();<br />maxy=getmaxy();<br />rectangle(0,10,maxx,maxy);<br />setcolor(WHITE);<br />outtextxy(175,0,"Pre-Defined Fill styles");<br />for (fst=0;fst<12;fst++){<br />setfillstyle(fst, MAGENTA);<br />bar (x,y,x+80,y+80);<br />itoa (fst,str,10);<br />outtextxy(x,y+100,str);<br />outtextxy(x,y+100,pattern[fst]);<br />x=x+150;<br />if (x>490)<br />{<br />y=y+150;<br />x=40;<br />}<br />}<br />getch();<br />closegraph();<br />restorecrtmode();<br />return 0;<br />} - April 18, 2008 at 8:21 pm #3140indinferParticipant
i m asking for any irregular polygon fill
- AuthorPosts
Viewing 1 reply thread
- The forum ‘C Programming’ is closed to new topics and replies.