<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2289259654117574211</id><updated>2010-08-30T22:15:08.159-07:00</updated><title type='text'>Computer Graphics Lab</title><subtitle type='html'>Computer graphics is a b-tech programming lab. Here i have tried to make it easy for b-tech students by including the mostly done programs. I have included some animation programs also. All the programs are written in c. They are tested and executed for perfection. - Dipin</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default?orderby=updated'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-5321892267461777964</id><published>2009-08-05T13:40:00.000-07:00</published><updated>2009-08-05T14:01:46.450-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WWW'/><category scheme='http://www.blogger.com/atom/ns#' term='ELinks'/><category scheme='http://www.blogger.com/atom/ns#' term='Text'/><category scheme='http://www.blogger.com/atom/ns#' term='Browse'/><title type='text'>ELinks - Full-Featured Text WWW Browser</title><content type='html'>&lt;div style="text-align: justify;"&gt;ELinks is an advanced and well-established feature-rich text mode web (HTTP/FTP/..) browser. ELinks can render both frames and tables, is highly customizable and can be extended via Lua or Guile scripts. It is quite portable and runs on a variety of platforms.&lt;br /&gt;&lt;br /&gt;ELinks is an Open Source project covered by the GNU General Public License.&lt;br /&gt;&lt;br /&gt;If you want to see ELinks in action check out the &lt;a href="http://www.elinks.or.cz/screenshots/index.html"&gt;screenshots&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;ELinks is a program for browsing the web in text mode. The goal of the project has from the beginning been to provide a feature-rich text mode browser with an open patches/features inclusion policy and active development. One of these features is that ELinks includes Links-Lua which adds scripting capabilities to ELinks.&lt;br /&gt;&lt;/div&gt;&lt;h2 style="text-align: justify;"&gt;Why text mode ?&lt;/h2&gt;&lt;div style="text-align: justify;"&gt;  It may seem strange that anyone would develop a text mode browser in a world where the power of computers keep improving and most people favor graphical applications. Most graphical browsers are slow (especially to start up) and eat a lot of memory. For some people, this is unacceptable, so avoiding these browsers to harvest your critical system resources when doing basic tasks on the net is one thing. Text browsers are also invaluable on servers without a graphical environment and over SSH (or similiar) text-only sessions.  Besides, text mode browsing is fun and highly addictive when you get the hang of it. ;-) &lt;/div&gt;&lt;div style="text-align: justify;" class="sectionbody"&gt; &lt;p&gt;ELinks is written in near-ANSI C and is quite portable.  It has been reported to run at least on the following platforms:&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;AIX     &lt;/li&gt;&lt;li&gt;BeOS     &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cygwin.com/"&gt;CygWin&lt;/a&gt;&lt;/li&gt;&lt;li&gt; For more see the &lt;a href="http://www.blogger.com/Why%20text%20mode%20?%20It%20may%20seem%20strange%20that%20anyone%20would%20develop%20a%20text%20mode%20browser%20in%20a%20world%20where%20the%20power%20of%20computers%20keep%20improving%20and%20most%20people%20favor%20graphical%20applications.%20Most%20graphical%20browsers%20are%20slow%20%28especially%20to%20start%20up%29%20and%20eat%20a%20lot%20of%20memory.%20For%20some%20people,%20this%20is%20unacceptable,%20so%20avoiding%20these%20browsers%20to%20harvest%20your%20critical%20system%20resources%20when%20doing%20basic%20tasks%20on%20the%20net%20is%20one%20thing.%20Text%20browsers%20are%20also%20invaluable%20on%20servers%20without%20a%20graphical%20environment%20and%20over%20SSH%20%28or%20similiar%29%20text-only%20sessions.%20Besides,%20text%20mode%20browsing%20is%20fun%20and%20highly%20addictive%20when%20you%20get%20the%20hang%20of%20it.%20;-%29%20%20And%20if%20you%20think%20that%20the%20current%20web%20is%20unbrowsable%20without%20images,%20you%20are%20wrong.%2075%%20of%20the%20actual%20sites%20you%20visit%20are%20perfectly%20browsable%20%28especially%20with%20the%20tables%20support%29%20and%20another%2015%%20are%20not%20exactly%20pleasant%20but%20still%20well-viewable.%20And%20even%20in%20text%20browser%20you%20can%20easily%20view%20individual%20images%20through%20some%20external%20viewer%20%28like%20zgv%20on%20Linux%20console%29.%20Some%20people%20are%20actually%20using%20ELinks%20as%20their%20exclusive%20browser.%20However,%20you%20obviously%20do%20not%20need%20to%20be%20so%20extreme%20to%20still%20have%20many%20good%20practical%20uses%20for%20a%20text%20browser."&gt;official site&lt;/a&gt;&lt;/li&gt;&lt;li&gt;....&lt;/li&gt;&lt;/ul&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;Read full story here &lt;a href="http://blog.dipinkrishna.info/2009/08/elinks-full-featured-text-www-browser.html"&gt;http://blog.dipinkrishna.info/2009/08/elinks-full-featured-text-www-browser.html&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-5321892267461777964?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/5321892267461777964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=5321892267461777964' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/5321892267461777964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/5321892267461777964'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2009/08/elinks-full-featured-text-www-browser.html' title='ELinks - Full-Featured Text WWW Browser'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-348957682380823006</id><published>2008-10-21T07:09:00.000-07:00</published><updated>2008-10-21T07:12:04.613-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='6th sem cg lab'/><category scheme='http://www.blogger.com/atom/ns#' term='cglabprogramsinc'/><category scheme='http://www.blogger.com/atom/ns#' term='lab exam question'/><category scheme='http://www.blogger.com/atom/ns#' term='cglab'/><category scheme='http://www.blogger.com/atom/ns#' term='pendulam'/><category scheme='http://www.blogger.com/atom/ns#' term='computergraphics lab'/><category scheme='http://www.blogger.com/atom/ns#' term='cg lab programs'/><category scheme='http://www.blogger.com/atom/ns#' term='cg lab'/><category scheme='http://www.blogger.com/atom/ns#' term='cglabprograms'/><category scheme='http://www.blogger.com/atom/ns#' term='Computer Graphics programs'/><category scheme='http://www.blogger.com/atom/ns#' term='cg lab programs in c'/><title type='text'>Pendulam</title><content type='html'>#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;dos.h&amp;gt;&lt;br /&gt;#include&amp;lt;process.h&amp;gt;&lt;br /&gt;&lt;br /&gt;int cx=300,cy=100,r=300;&lt;br /&gt;int x=0,y,p;&lt;br /&gt;&lt;br /&gt;int path(int dtn)&lt;br /&gt;{&lt;br /&gt; int x1,y1;&lt;br /&gt; setcolor(15);&lt;br /&gt; if(x&amp;gt;=y)&lt;br /&gt; {&lt;br /&gt;  return 0;&lt;br /&gt; }&lt;br /&gt;  cleardevice();&lt;br /&gt;&lt;br /&gt;  if(dtn==1)&lt;br /&gt;  {&lt;br /&gt;   circle(cx+x,cy+y,20);&lt;br /&gt;   line(cx,cy,cx+x,cy+y);&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   circle(cx-x,cy+y,20);&lt;br /&gt;   line(cx,cy,cx-x,cy+y);&lt;br /&gt;  }&lt;br /&gt;  delay(10);&lt;br /&gt;  if(kbhit())&lt;br /&gt;   exit(0);&lt;br /&gt;  x++;&lt;br /&gt;  if(p&amp;lt;0)&lt;br /&gt;   p+=2*x+1;&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   y--;&lt;br /&gt;   p+=2*(x-y)+1;&lt;br /&gt;  }&lt;br /&gt;  x1=x;&lt;br /&gt;  y1=y;&lt;br /&gt;  path(dtn);&lt;br /&gt;&lt;br /&gt;  cleardevice();&lt;br /&gt;  if(dtn==1)&lt;br /&gt;  {&lt;br /&gt;   circle(cx+x1,cy+y1,20);&lt;br /&gt;   line(cx,cy,cx+x1,cy+y1);&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   circle(cx-x1,cy+y1,20);&lt;br /&gt;   line(cx,cy,cx-x1,cy+y1);&lt;br /&gt;  }&lt;br /&gt;  delay(10);&lt;br /&gt;  if(kbhit())&lt;br /&gt;   exit(0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt; int gd=DETECT,gm=DETECT;&lt;br /&gt; initgraph(&amp;amp;gd,&amp;amp;gm,"");&lt;br /&gt; cleardevice();&lt;br /&gt; putpixel(300,100,4);&lt;br /&gt; while(1)&lt;br /&gt; {&lt;br /&gt;  x=0;&lt;br /&gt;  y=r;&lt;br /&gt;  p=1-r;&lt;br /&gt;  path(1);&lt;br /&gt;  x=0;&lt;br /&gt;  y=r;&lt;br /&gt;  p=1-r;&lt;br /&gt;  path(0);&lt;br /&gt;       }&lt;br /&gt; getch();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-348957682380823006?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/348957682380823006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=348957682380823006' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/348957682380823006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/348957682380823006'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/pendulam.html' title='Pendulam'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-1999829020475038937</id><published>2008-10-11T05:06:00.000-07:00</published><updated>2008-10-18T21:37:45.416-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='6th sem cg lab'/><category scheme='http://www.blogger.com/atom/ns#' term='cglabprogramsinc'/><category scheme='http://www.blogger.com/atom/ns#' term='cglab'/><category scheme='http://www.blogger.com/atom/ns#' term='to start with graphics programming in c'/><category scheme='http://www.blogger.com/atom/ns#' term='6thsem cslab'/><category scheme='http://www.blogger.com/atom/ns#' term='cglabprograms'/><category scheme='http://www.blogger.com/atom/ns#' term='cg lab programs in c'/><category scheme='http://www.blogger.com/atom/ns#' term='6th semester cg lab'/><category scheme='http://www.blogger.com/atom/ns#' term='cusat6thsemlab'/><title type='text'>To start with graphics programming</title><content type='html'>&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;Turbo C has a good collection of graphics libraries. If you know the basics of C, you can easily learn graphics programming. To start programming, let us write a small program that displays a circle on the screen. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div align="center"&gt;  &lt;table class="MsoNormalTable" style="border: medium none ; background: rgb(255, 225, 225) none repeat scroll 0% 0%; width: 429pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; border-collapse: collapse;" width="572" border="1" cellpadding="0" cellspacing="0"&gt;  &lt;tbody&gt;&lt;tr style="height: 96pt;"&gt;   &lt;td style="border: 1pt inset red; padding: 0in; width: 429pt; height: 96pt;" width="572"&gt;   &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="color: rgb(0, 0, 0);font-family:&amp;quot;;font-size:12;"&gt;/*  simple.c&lt;br /&gt;example 1.0&lt;br /&gt;*/&lt;br /&gt;#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int gd=DETECT, gm;&lt;br /&gt;&lt;br /&gt;initgraph(&amp;amp;gd, &amp;amp;gm, "c:\\tc\\bgi   " );&lt;br /&gt;circle(200,100,150);&lt;br /&gt;&lt;br /&gt;getch();&lt;br /&gt;closegraph();&lt;br /&gt;}&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;    &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;To run this program, you need graphics.h header file, graphics.lib library file and Graphics driver (BGI file) in the program folder. These files are part of Turbo C package. In all our programs we used 640x480 VGA monitor. So all the programs are according to that specification. You need to make necessary changes to your programs according to your screen resolution. For VGA monitor, graphics driver used is EGAVGA.BGI. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;    Here, initgraph() function initializes the graphics mode and clears the screen. We will study the difference between text mode and graphics mode in detail latter. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="border: medium none ; background: black none repeat scroll 0% 0%; width: 100%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; border-collapse: collapse;" width="100%" border="1" cellpadding="0" cellspacing="0"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="border: 1pt inset red; padding: 1.5pt;"&gt;   &lt;p class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;InitGraph:&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Initializes the   graphics system.&lt;br /&gt;&lt;br /&gt;Declaration:&lt;br /&gt;void far initgraph(int far *graphdriver, int far *graphmode, char far   *pathtodriver);&lt;br /&gt;&lt;br /&gt;Remarks: To start the graphics system, you must first call initgraph.&lt;br /&gt;&lt;br /&gt;initgraph initializes the graphics system by loading a graphics driver from   disk (or validating a registered driver) then putting the system into   graphics mode.&lt;br /&gt;&lt;br /&gt;initgraph also resets all graphics settings (color, palette, current   position, viewport, etc.) to their defaults, then resets graphresult to 0.&lt;br /&gt;Arguments:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;*graphdriver: &lt;/span&gt;&lt;/u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Integer that specifies the graphics driver to   be used. You can give graphdriver a value using a constant of the graphics   drivers enumeration type.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;*graphmode :&lt;/span&gt;&lt;/u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; Integer that specifies the initial graphics   mode (unless *graphdriver = DETECT). If *graphdriver = DETECT, initgraph sets   *graphmode to the highest resolution available for the detected driver. You   can give *graphmode a value using a constant of the graphics_modes enumeration   type.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;u style="color: rgb(255, 255, 255);"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;pathtodriver :&lt;/span&gt;&lt;/u&gt;&lt;span style="color: rgb(255, 255, 255);font-family:&amp;quot;;font-size:12;color:white;"&gt; Specifies the directory path where initgraph   looks for graphics drivers (*.BGI) first.  If they're not there,   initgraph looks in the current directory.  If pathtodriver is null, the   driver files must be in the current directory.  This is also the path   settextstyle searches for the stroked character font files (*.CHR). &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;    &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;closegraph() function switches back the screen from graphcs mode to text mode. It clears the screen also. A graphics program should have a closegraph function at the end of graphics. Otherwise DOS screen will not go to text mode after running the program. Here, closegraph() is called after getch() since screen should not clear until user hits a key.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;    If you have the BGI file in the same folder of your program, you can just leave it as "" only. you need not mention *graphmode if you give *graphdriver as DETECT. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;    In graphics mode, all the screen co-ordinates are mentioned in terms of pixels. Number of pixels in the screen decides resolution of the screen. In the example 1.0,  circle is drawn with x-coordinate of the center 200, y-coordinate 100 and radius 150 pixels. All the coordinates are mentioned with respect to top-left corner of the screen. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;u&gt;&lt;span style=";font-family:&amp;quot;;font-size:18;"&gt;Basic Shapes and Colors:&lt;/span&gt;&lt;/u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;    &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;Now let us write a program to draw some basic shapes. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div align="center"&gt;  &lt;table class="MsoNormalTable" style="border: medium none ; background: rgb(255, 225, 225) none repeat scroll 0% 0%; width: 79%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; border-collapse: collapse;" width="79%" border="1" cellpadding="0" cellspacing="0"&gt;  &lt;tbody&gt;&lt;tr style="height: 435.75pt;"&gt;   &lt;td style="border: 1pt inset red; padding: 0in; width: 100%; height: 435.75pt;" width="100%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="color: rgb(0, 0, 0);font-family:&amp;quot;;font-size:12;"&gt;/*&lt;br /&gt;shapes.c&lt;br /&gt;example 1.1&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int gd=DETECT, gm;&lt;br /&gt;int poly[12]={350,450, 350,410, 430,400, 350,350, 300,430,   350,450 };&lt;br /&gt;initgraph(&amp;amp;gd, &amp;amp;gm, "");&lt;br /&gt;&lt;br /&gt;circle(100,100,50);&lt;br /&gt;outtextxy(75,170, "Circle");&lt;br /&gt;rectangle(200,50,350,150);&lt;br /&gt;outtextxy(240, 170, "Rectangle");&lt;br /&gt;ellipse(500, 100,0,360, 100,50);&lt;br /&gt;outtextxy(480, 170, "Ellipse");&lt;br /&gt;line(100,250,540,250);&lt;br /&gt;outtextxy(300,260,"Line");&lt;br /&gt;&lt;br /&gt;sector(150, 400, 30, 300, 100,50);&lt;br /&gt;outtextxy(120, 460, "Sector");&lt;br /&gt;drawpoly(6, poly);&lt;br /&gt;outtextxy(340, 460, "Polygon");&lt;br /&gt;getch();&lt;br /&gt;closegraph();&lt;br /&gt;}&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;Here is the screenshot of output:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: center; line-height: normal;" align="center"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_4_yp7K0HvoE/SPCXuTzrCEI/AAAAAAAAAAU/55PjxJRw6lA/s1600-h/c_grap1.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 396px; height: 295px;" src="http://3.bp.blogspot.com/_4_yp7K0HvoE/SPCXuTzrCEI/AAAAAAAAAAU/55PjxJRw6lA/s320/c_grap1.gif" alt="" id="BLOGGER_PHOTO_ID_5255867586988148802" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: center; line-height: normal;" align="center"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: center; line-height: normal;" align="center"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: center; line-height: normal;" align="center"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: center; line-height: normal;" align="center"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: center; line-height: normal;" align="center"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: center; line-height: normal;" align="center"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: center; line-height: normal;" align="center"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: center; line-height: normal;" align="center"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: center; line-height: normal;" align="center"&gt;&lt;br /&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;    &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;Here, circle() function takes x, y coordinates of the circle with respect to left top of the screen and radius of the circle in terms of pixels as arguments. Not that, in graphics, almost all the screen parameters are measured in terms of pixels.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;    Function outtextxy() displays a string in graphical mode. You can use different fonts, text sizes, alignments, colors and directions of the text that we will study later. Parameters passed are x and y coordinates of the position on the screen where text is to be displayed. There is another function outtext() that displayes a text in the current position. Current position is the place where last drawing is ended. These functions are declared as follows:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;void far outtextxy(int x, int y, char *text);&lt;br /&gt;void far outtext(char *text);&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;Circle, arc, pieslice are declared as follows:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div align="center"&gt;  &lt;table class="MsoNormalTable" style="border: medium none ; background: black none repeat scroll 0% 0%; width: 545.25pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; border-collapse: collapse;" width="727" border="1" cellpadding="0" cellspacing="0"&gt;  &lt;tbody&gt;&lt;tr style="height: 80.25pt;"&gt;   &lt;td style="border: 1pt inset red; padding: 3pt; width: 545.25pt; height: 80.25pt;" width="727"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;b&gt;&lt;u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Declaration:&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul style="color: rgb(255, 255, 255);" type="disc"&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; void far        arc(int x, int y, int stangle, int endangle, int radius); &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; void far        circle(int x, int y, int radius); &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; void far        pieslice(int x, int y, int stangle, int endangle, int radius); &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;p class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;b&gt;&lt;u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Remarks:&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul style="color: rgb(255, 255, 255);" type="disc"&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;arc draws a        circular arc in the current drawing color. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;circle draws a        circle in the current drawing color. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;pieslice draws a        pie slice in the current drawing color, then fills it using&lt;br /&gt; the current fill pattern and fill color. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;p class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;b&gt;&lt;u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Arguments:&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;(x,y): Center        point of arc, circlew, or pie slice &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;stangle: Start        angle in degrees &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;endangle: End        angle in degrees &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="color: rgb(255, 255, 255);font-family:&amp;quot;;font-size:12;color:white;"&gt;radius: Radius of        arc, circle, and pieslice &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;   &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt; Here, stangle and endangle are in degrees starting from the +ve x-axis in the polar coordinate system in the anti-clockwise direction. if stangle is 0, endangle is 360, it will draw a full circle. Refer this figure for clear idea: For the details of current color, fill color and fill patterns, refer the sections Lines and Colors. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: center; line-height: normal;" align="center"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_4_yp7K0HvoE/SPCXuuRfGzI/AAAAAAAAAAc/o89C7ObA93s/s1600-h/angles.GIF"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 398px; height: 337px;" src="http://4.bp.blogspot.com/_4_yp7K0HvoE/SPCXuuRfGzI/AAAAAAAAAAc/o89C7ObA93s/s320/angles.GIF" alt="" id="BLOGGER_PHOTO_ID_5255867594092518194" border="0" /&gt;&lt;/a&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;    &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;Another basic shape that we come across is a rectangle. To draw a border, use rectangle with the coordinates of outline, to draw a square use rectangle with same height and width. drawpoly() and fillpoly() are two functions useful to draw any polygons. To use these functions, store coordinates of the shape in an array and pass the address of array as an argument to the function. By looking at the output of the previous program, you can understand what drawpoly is. fillpoly is similar except that it fills in the shape with current fill color.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div align="center"&gt;  &lt;table class="MsoNormalTable" style="border: medium none ; background: black none repeat scroll 0% 0%; width: 389.25pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; border-collapse: collapse;" width="519" border="1" cellpadding="0" cellspacing="0"&gt;  &lt;tbody&gt;&lt;tr style="height: 30pt;"&gt;   &lt;td style="border: 1pt inset red; padding: 0in; width: 389.25pt; height: 30pt;" width="519"&gt;   &lt;p class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;b&gt;&lt;u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Declaration:&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul style="margin-top: 0in; color: rgb(255, 255, 255);" type="disc"&gt;&lt;li class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;void far        rectangle(int left, int top, int right, int bottom);&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;void far        drawpoly(int numpoints, int far *polypoints);&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;void far fillpoly(int        numpoints, int far *polypoints);&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;        &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;p class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;b&gt;&lt;u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Remarks:&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul style="color: rgb(255, 255, 255);" type="disc"&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;rectangle draws a        rectangle in the current line style, thickness, and drawing color.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;drawpoly draws a        polygon using the current line style and color.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;fillpoly draws        the outline of a polygon using the current line style and color, then        fills the polygon using the current fill pattern and fill color.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;p class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;b&gt;&lt;u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Arguments:  &lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;(left,top) is the        upper left corner of the rectangle, and (right,bottom) is its lower        right corner.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal; color: rgb(255, 255, 255);"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; numpoints:         Specifies number of points&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;        &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="color: rgb(255, 255, 255);font-family:&amp;quot;;font-size:12;color:white;"&gt;*polypoints:        Points to a sequence of (numpoints x 2) integers. Each pair of integers        gives the x and y coordinates of a point on the polygon.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;        &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;To draw a closed polygon with N points, numpoints should be N+1 and the array polypoints[] should contain 2(N+1) integers with first 2 integers equal to last 2 integers. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;        Let us study more about shapes latter. Here is some idea about colors. There are 16 colors declared in graphics.h as listed bellow.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div align="center"&gt;  &lt;table class="MsoNormalTable" style="border: medium none ; background: rgb(204, 204, 204) none repeat scroll 0% 0%; width: 157.5pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; border-collapse: collapse;" width="210" border="1" cellpadding="0" cellspacing="0"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="border: 1pt inset rgb(17, 17, 17); padding: 7.5pt; width: 156pt;" width="208"&gt;   &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="color: rgb(0, 0, 0);font-family:&amp;quot;;font-size:13;"&gt;BLACK:                    0&lt;br /&gt;BLUE:                       1&lt;br /&gt;GREEN:                    2&lt;br /&gt;CYAN:                      3&lt;br /&gt;RED:                         4&lt;br /&gt;MAGENTA:            5&lt;br /&gt;BROWN:                   6&lt;br /&gt;LIGHTGRAY:         7&lt;br /&gt;DARKGRAY:          8&lt;br /&gt;LIGHTBLUE:           9&lt;br /&gt;LIGHTGREEN:       10&lt;br /&gt;LIGHTCYAN:         11&lt;br /&gt;LIGHTRED:              12&lt;br /&gt;LIGHTMAGENTA: 13&lt;br /&gt;YELLOW:                 14&lt;br /&gt;WHITE:                     15&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;        To use these colors, use functions setcolor(), setbkcolor() and setfillstyle(). setcolor() function sets the current drawing color. If we use setcolor(RED); and draw any shape, line or text after that, the drawing will be in red color. You can either use color as defined above or number like setcolor(4);. setbkcolor() sets background color for drawing. Setfillstyle sets fill pattern and fill colors. After calling setfillstyle, if we use functions like floodfill, fillpoly, bar etc, shpes will be filled with fill color and pattern set using setfillstyle. These function declarations are as follows.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="border: medium none ; background: black none repeat scroll 0% 0%; width: 100%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; border-collapse: collapse; color: rgb(255, 255, 255);" width="100%" border="1" cellpadding="0" cellspacing="0"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="border: 1pt inset rgb(17, 17, 17); padding: 0.75pt; width: 100%;" width="100%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Declaration:&lt;/span&gt;&lt;/u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; void far        setfillstyle(int pattern, int color); &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;void far        setcolor(int color); &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;void far        setbkcolor(int color); &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Remarks:&lt;/span&gt;&lt;/u&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;setfillstyle sets        the current fill pattern and fill color. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;setcolor sets the        current drawing color to color, which can range from 0 to getmaxcolor. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;setbkcolor sets        the background to the color specified by color. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;        The parameter pattern in setfillstyle is as follows:&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div align="center"&gt;  &lt;table class="MsoNormalTable" style="border: medium none ; background: rgb(255, 225, 225) none repeat scroll 0% 0%; width: 75%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; border-collapse: collapse;" width="75%" border="1" cellpadding="0" cellspacing="0"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="border: 1pt inset red; padding: 0.75pt; width: 33%; color: rgb(0, 0, 0);" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; Names&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: inset inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: inset inset inset none; padding: 0.75pt; width: 56%;" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Means  Fill With...&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="border-style: none inset inset; padding: 0.75pt; width: 33%; color: rgb(0, 0, 0);" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;EMPTY_FILL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 56%; color: rgb(0, 0, 0);" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Background color&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="border-style: none inset inset; padding: 0.75pt; width: 33%; color: rgb(0, 0, 0);" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;SOLID_FILL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 56%; color: rgb(0, 0, 0);" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Solid fill&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="border-style: none inset inset; padding: 0.75pt; width: 33%; color: rgb(0, 0, 0);" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;LINE_FILL &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 56%; color: rgb(0, 0, 0);" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;---&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="border-style: none inset inset; padding: 0.75pt; width: 33%; color: rgb(0, 0, 0);" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;LTSLASH_FILL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 56%; color: rgb(0, 0, 0);" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;///&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="border-style: none inset inset; padding: 0.75pt; width: 33%; color: rgb(0, 0, 0);" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;SLASH_FILL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;4&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 56%;" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;///, thick lines&lt;o:p style="color: rgb(0, 0, 0);"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="border-style: none inset inset; padding: 0.75pt; width: 33%; color: rgb(0, 0, 0);" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;BKSLASH_FILL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;5&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 56%;" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;\\\, thick lines&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="border-style: none inset inset; padding: 0.75pt; width: 33%; color: rgb(0, 0, 0);" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;LTBKSLASH_FILL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;6&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 56%; color: rgb(0, 0, 0);" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt; \\\&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="border-style: none inset inset; padding: 0.75pt; width: 33%; color: rgb(0, 0, 0);" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;HATCH_FILL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;7&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 56%; color: rgb(0, 0, 0);" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Light hatch&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="border-style: none inset inset; padding: 0.75pt; width: 33%; color: rgb(0, 0, 0);" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;XHATCH_FILL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;8&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 56%; color: rgb(0, 0, 0);" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Heavy crosshatch&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="border-style: none inset inset; padding: 0.75pt; width: 33%;" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;INTERLEAVE_FILL&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;9&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 56%; color: rgb(0, 0, 0);" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Interleaving lines&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="border-style: none inset inset; padding: 0.75pt; width: 33%; color: rgb(0, 0, 0);" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;WIDE_DOT_FILL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;10&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 56%; color: rgb(0, 0, 0);" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Widely spaced dots&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="border-style: none inset inset; padding: 0.75pt; width: 33%; color: rgb(0, 0, 0);" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;CLOSE_DOT_FILL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;11&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 56%; color: rgb(0, 0, 0);" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;Closely spaced dots&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="border-style: none inset inset; padding: 0.75pt; width: 33%; color: rgb(0, 0, 0);" width="33%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;USER_FILL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 11%; color: rgb(0, 0, 0);" width="11%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;12&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border-style: none inset inset none; padding: 0.75pt; width: 56%; color: rgb(0, 0, 0);" width="56%"&gt;   &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;User-defined fill pattern&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:13;"&gt;        Here is an example program with colors, pixels, bar, cleardevice etc. stdlib.h is used for random number generation. We have a function random(no), it returns a random number between 0 an no. The effect is by drawing random radius, random color circles with same center and random pixels. kbhit() function(defined in conio.h) returns a nonzero value when a key is pressed in the keyboard. So, the loop will continue until a key is pressed. &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div align="center"&gt;  &lt;table class="MsoNormalTable" style="border: medium none ; background: rgb(255, 225, 225) none repeat scroll 0% 0%; width: 387.75pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; border-collapse: collapse;" width="517" border="1" cellpadding="0" cellspacing="0"&gt;  &lt;tbody&gt;&lt;tr style="height: 0.5in;"&gt;   &lt;td style="border: 1pt inset red; padding: 0in; width: 386.25pt; height: 0.5in;" width="515"&gt;   &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="color: rgb(0, 0, 0);font-family:&amp;quot;;font-size:12;"&gt;/*&lt;br /&gt;random.c&lt;br /&gt;some graphics effects using random numbers.&lt;br /&gt;example 1.2&lt;br /&gt;by HarshaPerla, http://eharsha.tk&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;#include "graphics.h"&lt;br /&gt;#include "conio.h"&lt;br /&gt;#include "stdlib.h"&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int gd,gm;&lt;br /&gt;gd=DETECT;&lt;br /&gt;&lt;br /&gt;initgraph(&amp;amp;gd, &amp;amp;gm, "");&lt;br /&gt;setcolor(3);&lt;br /&gt;setfillstyle(SOLID_FILL,RED);&lt;br /&gt;bar(50, 50, 590, 430);&lt;br /&gt;&lt;br /&gt;setfillstyle(1, 14);&lt;br /&gt;bar(100, 100, 540, 380);&lt;br /&gt;&lt;br /&gt;while(!kbhit())&lt;br /&gt;{&lt;br /&gt;    putpixel(random(439)+101,    random(279)+101,random(16));&lt;br /&gt;    setcolor(random(16));&lt;br /&gt;    circle(320,240,random(100));&lt;br /&gt;}&lt;br /&gt;getch();&lt;br /&gt;closegraph();&lt;br /&gt;}&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:12;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-1999829020475038937?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/1999829020475038937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=1999829020475038937' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/1999829020475038937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/1999829020475038937'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/to-start-with-graphics-programming.html' title='To start with graphics programming'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_4_yp7K0HvoE/SPCXuTzrCEI/AAAAAAAAAAU/55PjxJRw6lA/s72-c/c_grap1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-1615683295832362485</id><published>2008-10-18T20:33:00.000-07:00</published><updated>2008-10-18T20:39:21.149-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='moving wheel'/><category scheme='http://www.blogger.com/atom/ns#' term='cglabprogramsinc'/><category scheme='http://www.blogger.com/atom/ns#' term='cglab'/><category scheme='http://www.blogger.com/atom/ns#' term='wheel'/><category scheme='http://www.blogger.com/atom/ns#' term='6thsem cslab'/><category scheme='http://www.blogger.com/atom/ns#' term='computergraphics lab'/><category scheme='http://www.blogger.com/atom/ns#' term='cg lab programs'/><category scheme='http://www.blogger.com/atom/ns#' term='cg lab'/><category scheme='http://www.blogger.com/atom/ns#' term='cglabprograms'/><category scheme='http://www.blogger.com/atom/ns#' term='Computer Graphics programs'/><category scheme='http://www.blogger.com/atom/ns#' term='cusat6thsemlab'/><title type='text'>Moving Wheel</title><content type='html'>#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;#include&amp;lt;math.h&amp;gt;&lt;br /&gt;#include&amp;lt;dos.h&amp;gt;&lt;br /&gt;&lt;br /&gt;int l=1;&lt;br /&gt;&lt;br /&gt;void ddaline(int x1,int y1,int x2,int y2)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;int s,dx,dy,m;&lt;br /&gt;float xi,yi,x,y;&lt;br /&gt;&lt;br /&gt;dx=x2-x1;&lt;br /&gt;dy=y2-y1;&lt;br /&gt;&lt;br /&gt;if(abs(dx)&amp;gt;abs(dy))&lt;br /&gt;   s=abs(dx);&lt;br /&gt;else&lt;br /&gt;   s=abs(dy);&lt;br /&gt;&lt;br /&gt;xi=dx/(float)s;&lt;br /&gt;yi=dy/(float)s;&lt;br /&gt;&lt;br /&gt;x=x1;&lt;br /&gt;y=y1;&lt;br /&gt;&lt;br /&gt;putpixel(x1+0.5,y1+0.5,15);&lt;br /&gt;&lt;br /&gt;for(m=0;m&amp;lt;s;m++)&lt;br /&gt;{&lt;br /&gt; x+=xi;&lt;br /&gt; y+=yi;&lt;br /&gt; putpixel(x+0.5,y+0.5,15);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void plotpoints1(int x,int y,int cx,int cy)&lt;br /&gt;{&lt;br /&gt; putpixel(cx+x,cy+y,15);&lt;br /&gt; putpixel(cx-x,cy-y,15);&lt;br /&gt; putpixel(cx-y,cy+x,15);&lt;br /&gt; putpixel(cx+y,cy-x,15);&lt;br /&gt; if(l%20==0)&lt;br /&gt; {&lt;br /&gt;  ddaline(cx-x,cy-y,cx+x,cy+y);&lt;br /&gt;  ddaline(cx-y,cy+x,cx+y,cy-x);&lt;br /&gt; }&lt;br /&gt; l++;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void plotpoints2(int x,int y,int cx,int cy)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt; putpixel(cx-x,cy+y,15);&lt;br /&gt; putpixel(cx+x,cy-y,15);&lt;br /&gt; putpixel(cx+y,cy+x,15);&lt;br /&gt; putpixel(cx-y,cy-x,15);&lt;br /&gt; if(l%20==0)&lt;br /&gt; {&lt;br /&gt;  ddaline(cx+x,cy-y,cx-x,cy+y);&lt;br /&gt;  ddaline(cx-y,cy-x,cx+y,cy+x);&lt;br /&gt; }&lt;br /&gt; l++;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void mcircle(int cx,int cy,int r)&lt;br /&gt;{&lt;br /&gt; int x=0,y,p;&lt;br /&gt;&lt;br /&gt; y=r;&lt;br /&gt; p=1-r;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; while(x&amp;lt;y)&lt;br /&gt; {&lt;br /&gt;  plotpoints1(x,y,cx,cy);&lt;br /&gt;  x++;&lt;br /&gt;  if(p&amp;lt;0)&lt;br /&gt;   p+=2*x+1;&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   y--;&lt;br /&gt;   p+=2*(x-y)+1;&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; x=y+1;&lt;br /&gt; while(abs(x)&amp;gt;0)&lt;br /&gt; {&lt;br /&gt;  plotpoints2(x,y,cx,cy);&lt;br /&gt;  x--;&lt;br /&gt;  if(p&amp;gt;=0)&lt;br /&gt;   p =p-2*x-1;&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   y++;&lt;br /&gt;   p=p-2*(x-y)-1;&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int gd=DETECT,gm=DETECT;&lt;br /&gt;initgraph(&amp;amp;gd,&amp;amp;gm,"");&lt;br /&gt;&lt;br /&gt;int i=0;&lt;br /&gt;&lt;br /&gt;while(i&amp;lt;300)&lt;br /&gt;{&lt;br /&gt;cleardevice();&lt;br /&gt;mcircle(100+(i++),200,100);&lt;br /&gt;delay(90);&lt;br /&gt;i++;&lt;br /&gt;}&lt;br /&gt;getch();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-1615683295832362485?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/1615683295832362485/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=1615683295832362485' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/1615683295832362485'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/1615683295832362485'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/moving-wheel.html' title='Moving Wheel'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-6055683438254517524</id><published>2008-10-18T10:20:00.000-07:00</published><updated>2008-10-18T10:30:47.903-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cglabprogramsinc'/><category scheme='http://www.blogger.com/atom/ns#' term='cglab'/><category scheme='http://www.blogger.com/atom/ns#' term='6thsem cslab'/><category scheme='http://www.blogger.com/atom/ns#' term='computergraphics lab'/><category scheme='http://www.blogger.com/atom/ns#' term='cg lab programs'/><category scheme='http://www.blogger.com/atom/ns#' term='cg lab'/><category scheme='http://www.blogger.com/atom/ns#' term='cglabprograms'/><category scheme='http://www.blogger.com/atom/ns#' term='Computer Graphics programs'/><category scheme='http://www.blogger.com/atom/ns#' term='cusat6thsemlab'/><title type='text'>Fill a bucket with water from a pipe.</title><content type='html'>#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;dos.h&amp;gt;&lt;br /&gt;#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int gd=DETECT,gm=DETECT,i,j;&lt;br /&gt;initgraph(&amp;amp;gd,&amp;amp;gm,"");&lt;br /&gt;ellipse(300,200,0,360,50,25);&lt;br /&gt;ellipse(300,300,0,360,50,25);&lt;br /&gt;line(250,200,250,300);&lt;br /&gt;line(350,200,350,300);&lt;br /&gt;ellipse(300,100,180,360,5,2);&lt;br /&gt;line(295,100,295,80);&lt;br /&gt;line(305,100,305,86);&lt;br /&gt;arc(300,80,90,180,5);&lt;br /&gt;putpixel(306,85,15);&lt;br /&gt;putpixel(307,84,15);&lt;br /&gt;line(308,84,630,84);&lt;br /&gt;line(300,75,303,75);&lt;br /&gt;line(314,75,630,75);&lt;br /&gt;putpixel(304,74,15);&lt;br /&gt;putpixel(305,73,15);&lt;br /&gt;line(306,72,306,65);&lt;br /&gt;line(311,72,311,65);&lt;br /&gt;putpixel(312,73,15);&lt;br /&gt;putpixel(313,74,15);&lt;br /&gt;pieslice(309,62,0,360,5);&lt;br /&gt;setfillstyle(SOLID_FILL,BLUE);&lt;br /&gt;setcolor(BLUE);&lt;br /&gt;for(i=0;i&amp;lt;7;i++)&lt;br /&gt;{&lt;br /&gt; line(297+i,103,297+i,300);&lt;br /&gt;}&lt;br /&gt;for(i=1;i&amp;lt;100;i++)&lt;br /&gt;{&lt;br /&gt; setcolor(LIGHTBLUE);&lt;br /&gt; ellipse(300,300-i,180,360,4,2);&lt;br /&gt; delay(30);&lt;br /&gt; fillellipse(300,300-i,49,25);&lt;br /&gt; setcolor(1);&lt;br /&gt; line(297,275-i,303,275-i);&lt;br /&gt; setcolor(15);&lt;br /&gt; ellipse(300,200,180,360,50,25);&lt;br /&gt; delay(50);&lt;br /&gt;}&lt;br /&gt;ellipse(300,200,0,360,50,25);&lt;br /&gt;setcolor(0);&lt;br /&gt;for(i=0;i&amp;lt;7;i++)&lt;br /&gt; line(297+i,103,297+i,174);&lt;br /&gt;getch();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-6055683438254517524?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/6055683438254517524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=6055683438254517524' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/6055683438254517524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/6055683438254517524'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/fill-bucket-with-water-from-pipe.html' title='Fill a bucket with water from a pipe.'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-1425707254812979532</id><published>2008-10-06T23:58:00.000-07:00</published><updated>2008-10-07T02:52:47.818-07:00</updated><title type='text'>DDA Line Drawing Algorithm</title><content type='html'>&lt;span style="font-weight: bold;"&gt;#include &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;graphics.h&gt;&lt;/graphics.h&gt;&lt;/span&gt;&amp;lt; graphics.h &gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; #include &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;graphics.h&gt;&lt;/graphics.h&gt;&lt;/span&gt;&amp;lt;&lt;span style="font-weight: bold;"&gt; stdio.h &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; #include &lt;/span&gt;&amp;lt;&lt;span style="font-weight: bold;"&gt; conio.h &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; #include &lt;/span&gt;&amp;lt;&lt;span style="font-weight: bold;"&gt; math.h &gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; void main()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; int gd=DETECT,gm=DETECT,s,dx,dy,m,x1,y1,x2,y2;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; float xi,yi,x,y;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; clrscr();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; printf("Enter the sarting point x1 &amp;amp; y1n");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; scanf("%d%d",&amp;amp;x1,&amp;amp;y1);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; printf("Enter the end point x2 &amp;amp; y2n");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; scanf("%d%d",&amp;amp;x2,&amp;amp;y2);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; initgraph(&amp;amp;gd,&amp;amp;gm,"");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; cleardevice();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; dx=x2-x1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; dy=y2-y1;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; if(abs(dx)&gt;abs(dy))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    s=abs(dx);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    s=abs(dy);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; xi=dx/(float)s;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; yi=dy/(float)s;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; x=x1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; y=y1;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; putpixel(x1+0.5,y1+0.5,4);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; for(m=0; m &lt;&amp;lt; s; m++)&lt;br /&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    x+=xi;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    y+=yi;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    putpixel(x+0.5,y+0.5,4);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; getch();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table cellpadding="0" cellspacing="1" style="border-color:#000000;border-width:1px;border-style:solid;height:12px;width:100px;font-size: 9px; font-family:Arial;"&gt;&lt;tr&gt;&lt;td style="width:80px; background-color:#003399; padding-left:6px; text-align:center;"&gt;&lt;a href="http://pagerank.rankstat.com" title="search phrase report" style="text-decoration: none; color: #ffffff;"&gt;RankStat.com&lt;img style="border-style: none;" src="http://pagerank.rankstat.com/PageRank.aspx?t=4"&gt;&lt;/a&gt;&lt;/td&gt;&lt;td style="width:23px;"&gt;&lt;a href="http://pagerank.rankstat.com" title="search phrase report"&gt;&lt;img style="border-style: none;" src="http://pagerank.rankstat.com/PageRank.aspx?t=3" alt="search phrase report" title="search phrase report"/&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-1425707254812979532?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/1425707254812979532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=1425707254812979532' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/1425707254812979532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/1425707254812979532'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/dda-line-drawing-algorithm.html' title='DDA Line Drawing Algorithm'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-817372874189576245</id><published>2008-10-07T01:32:00.000-07:00</published><updated>2008-10-07T02:03:14.574-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cglab'/><category scheme='http://www.blogger.com/atom/ns#' term='6thsem cslab'/><category scheme='http://www.blogger.com/atom/ns#' term='computergraphics lab'/><category scheme='http://www.blogger.com/atom/ns#' term='cg lab'/><category scheme='http://www.blogger.com/atom/ns#' term='Computer Graphics programs'/><category scheme='http://www.blogger.com/atom/ns#' term='cusat6thsemlab'/><title type='text'>A man walking in the rain.</title><content type='html'>#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include&amp;lt;dos.h&amp;gt;&lt;br /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;#include&amp;lt;stdlib.h&amp;gt;&lt;br /&gt;&lt;br /&gt;void rain(int x1,int y1,int x2,int y2)&lt;br /&gt;{&lt;br /&gt;int s,dx,dy,m,c=0,t=1;&lt;br /&gt;float xi,yi,x,y;&lt;br /&gt;&lt;br /&gt;dx=x2-x1;&lt;br /&gt;dy=y2-y1;&lt;br /&gt;&lt;br /&gt;if(abs(dx)&amp;gt;abs(dy))&lt;br /&gt;   s=abs(dx);&lt;br /&gt;else&lt;br /&gt;   s=abs(dy);&lt;br /&gt;&lt;br /&gt;xi=dx/(float)s;&lt;br /&gt;yi=dy/(float)s;&lt;br /&gt;&lt;br /&gt;x=x1;&lt;br /&gt;y=y1;&lt;br /&gt;&lt;br /&gt;putpixel(x1+0.5,y1+0.5,9);&lt;br /&gt;&lt;br /&gt;for(m=0;m&amp;lt;s;m++)&lt;br /&gt;{&lt;br /&gt; c++;&lt;br /&gt; x+=xi;&lt;br /&gt; y+=yi;&lt;br /&gt; if(getpixel(x,y)==4)&lt;br /&gt; break;&lt;br /&gt; if(c%10==0)&lt;br /&gt; t++;&lt;br /&gt; putpixel(x+0.5,y+0.5,0);&lt;br /&gt; if(t%2==0)&lt;br /&gt; putpixel(x+0.5,y+0.5,9);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int gd=DETECT,gm=DETECT,c=-200,i=0,x=40,l=15,h=15,ht=0;&lt;br /&gt;initgraph(&amp;gd,&amp;gm,"");&lt;br /&gt;cleardevice();&lt;br /&gt;setcolor(BROWN);&lt;br /&gt;line(0,201,600,201);&lt;br /&gt;&lt;br /&gt;cont:&lt;br /&gt;&lt;br /&gt;while(!kbhit())&lt;br /&gt;{&lt;br /&gt; setcolor(4);&lt;br /&gt; ellipse(x,100,0,180,50,30);&lt;br /&gt; line(x-50,100,x+50,100);&lt;br /&gt; line(x,100,x,150);&lt;br /&gt; circle(x-20,115,15);&lt;br /&gt; line(x-20,130,x-20,175);&lt;br /&gt; line(x-20,175,x-20-l,200);&lt;br /&gt; line(x-20,175,x-20+l,200);&lt;br /&gt; line(x-20,140,x,150);&lt;br /&gt; line(x-20,140,x-20-h,160);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; for(i=0;i&amp;lt;620;i+=20)&lt;br /&gt; {&lt;br /&gt;  rain(i,c,i,200);&lt;br /&gt; }&lt;br /&gt; c++;&lt;br /&gt; if(c==0)&lt;br /&gt;  c=-100;&lt;br /&gt; setcolor(0);&lt;br /&gt; delay(50);&lt;br /&gt; ellipse(x,100,0,180,50,30);&lt;br /&gt; line(x-50,100,x+50,100);&lt;br /&gt; line(x,100,x,150);&lt;br /&gt; circle(x-20,115,15);&lt;br /&gt; line(x-20,130,x-20,175);&lt;br /&gt; line(x-20,175,x-20-l,200);&lt;br /&gt; line(x-20,175,x-20+l,200);&lt;br /&gt; line(x-20,140,x,150);&lt;br /&gt; line(x-20,140,x-20-h,160);&lt;br /&gt;&lt;br /&gt; line(x+50,100,x+50,200);&lt;br /&gt; x++;&lt;br /&gt; l--;&lt;br /&gt; if(l==-15)&lt;br /&gt;  l=15;&lt;br /&gt; if(ht==1)&lt;br /&gt;  h++;&lt;br /&gt; else  h--;&lt;br /&gt;&lt;br /&gt; if(h==15)&lt;br /&gt;  ht=0;&lt;br /&gt; else if(h==-15)&lt;br /&gt;  ht=1;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;if(getch()==' ')&lt;br /&gt; {&lt;br /&gt; while(!kbhit());&lt;br /&gt; getch();&lt;br /&gt; goto cont;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-817372874189576245?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/817372874189576245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=817372874189576245' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/817372874189576245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/817372874189576245'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/man-walking-in-rain.html' title='A man walking in the rain.'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-3719120316680803720</id><published>2008-10-07T00:45:00.001-07:00</published><updated>2008-10-07T00:45:43.069-07:00</updated><title type='text'>Car Movement</title><content type='html'>#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;#include&amp;lt;dos.h&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; int scan,ascii;&lt;br /&gt;&lt;br /&gt; void getkey()&lt;br /&gt;   {&lt;br /&gt;      union REGS ii,oo;&lt;br /&gt;      ii.h.ah=0;&lt;br /&gt;      int86(22,&amp;ii,&amp;oo);&lt;br /&gt;      scan=oo.h.ah;&lt;br /&gt;      ascii=oo.h.al;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;void car(int x,int c)&lt;br /&gt;{&lt;br /&gt; setcolor(c);&lt;br /&gt; line(x+150,100,x+242,100);&lt;br /&gt; ellipse(x+242,105,0,90,10,5);&lt;br /&gt; line(x+150,100,x+120,150);&lt;br /&gt; line(x+252,105,x+280,150);&lt;br /&gt; line(x+100,150,x+320,150);&lt;br /&gt; line(x+100,150,x+100,200);&lt;br /&gt; line(x+320,150,x+320,200);&lt;br /&gt; line(x+100,200,x+110,200);&lt;br /&gt; line(x+320,200,x+310,200);&lt;br /&gt; arc(x+130,200,0,180,20);&lt;br /&gt; arc(x+290,200,0,180,20);&lt;br /&gt; line(x+270,200,x+150,200);&lt;br /&gt; circle(x+130,200,17);&lt;br /&gt; circle(x+290,200,17);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt; int gd=DETECT,gm=DETECT,i=0,c=1,prev=80;&lt;br /&gt; initgraph(&amp;gd,&amp;gm,"");&lt;br /&gt;&lt;br /&gt; cleardevice();&lt;br /&gt;&lt;br /&gt; car(0,15);&lt;br /&gt;&lt;br /&gt; while(!kbhit());&lt;br /&gt;&lt;br /&gt; while(1)&lt;br /&gt; {&lt;br /&gt;  getkey();&lt;br /&gt;  if(scan==72)&lt;br /&gt;      { c++; scan=prev; }&lt;br /&gt;&lt;br /&gt;  if(scan==80)&lt;br /&gt;      { if(c!=1)c--; scan=prev; }&lt;br /&gt;&lt;br /&gt;  if(ascii==13)&lt;br /&gt;   break;&lt;br /&gt;  if(scan == 77)&lt;br /&gt;  {&lt;br /&gt;   prev=77;&lt;br /&gt;   while(!kbhit())&lt;br /&gt;   {&lt;br /&gt;    car(i,0);&lt;br /&gt;    i+=c;&lt;br /&gt;    car(i,15);&lt;br /&gt;    delay(20);&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  if(scan == 75)&lt;br /&gt;  {&lt;br /&gt;   prev=75;&lt;br /&gt;   while(!kbhit())&lt;br /&gt;   {&lt;br /&gt;    car(i,0);&lt;br /&gt;    i-=c;&lt;br /&gt;    car(i,15);&lt;br /&gt;    delay(20);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;  if(ascii == 32 )&lt;br /&gt;  {&lt;br /&gt;   prev=80;&lt;br /&gt;   car(i,15);&lt;br /&gt;   while(!kbhit());&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; getch();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-3719120316680803720?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/3719120316680803720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=3719120316680803720' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/3719120316680803720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/3719120316680803720'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/car-movement.html' title='Car Movement'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-747732376316992928</id><published>2008-10-07T00:39:00.000-07:00</published><updated>2008-10-07T00:44:56.371-07:00</updated><title type='text'>Car movement during Traffic Signal</title><content type='html'>#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;dos.h&amp;gt;&lt;br /&gt;#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;&lt;br /&gt;void car(int x,int c)&lt;br /&gt;{&lt;br /&gt; setcolor(c);&lt;br /&gt; line(x+150,100,x+242,100);&lt;br /&gt; ellipse(x+242,105,0,90,10,5);&lt;br /&gt; line(x+150,100,x+120,150);&lt;br /&gt; line(x+252,105,x+280,150);&lt;br /&gt; line(x+100,150,x+320,150);&lt;br /&gt; line(x+100,150,x+100,200);&lt;br /&gt; line(x+320,150,x+320,200);&lt;br /&gt; line(x+100,200,x+110,200);&lt;br /&gt; line(x+320,200,x+310,200);&lt;br /&gt; arc(x+130,200,0,180,20);&lt;br /&gt; arc(x+290,200,0,180,20);&lt;br /&gt; line(x+270,200,x+150,200);&lt;br /&gt; circle(x+130,200,17);&lt;br /&gt; circle(x+290,200,17);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt; int gd=DETECT,gm=DETECT,i=-200;&lt;br /&gt; int ch='g';&lt;br /&gt; initgraph(&amp;gd,&amp;gm,"");&lt;br /&gt;&lt;br /&gt; line(0,70,300,70);&lt;br /&gt; line(450,70,630,70);&lt;br /&gt; line(300,70,300,0);&lt;br /&gt; line(450,70,450,0);&lt;br /&gt; line(0,230,300,230);&lt;br /&gt; line(450,230,630,230);&lt;br /&gt; line(300,230,300,500);&lt;br /&gt; line(450,230,450,500);&lt;br /&gt; circle(280,50,10);&lt;br /&gt; setfillstyle(SOLID_FILL,GREEN);&lt;br /&gt; floodfill(280,50,15);&lt;br /&gt; car(i,15);&lt;br /&gt; while(1)&lt;br /&gt; {&lt;br /&gt;   while(!kbhit())&lt;br /&gt;   {&lt;br /&gt;  if(ch=='r')&lt;br /&gt;  {&lt;br /&gt;        setfillstyle(SOLID_FILL,RED);&lt;br /&gt;        floodfill(280,50,15);&lt;br /&gt;        do{&lt;br /&gt;    while(!kbhit())&lt;br /&gt;    {&lt;br /&gt;     if(i&amp;lt;-20 || i&amp;gt;-10)&lt;br /&gt;     {&lt;br /&gt;      car(i++,0);&lt;br /&gt;      car(i,15);&lt;br /&gt;      delay(50);&lt;br /&gt;     }&lt;br /&gt;    }&lt;br /&gt;    ch=getch();&lt;br /&gt;    if(ch=='y')&lt;br /&gt;    {&lt;br /&gt;     setfillstyle(SOLID_FILL,YELLOW);&lt;br /&gt;     floodfill(280,50,15);&lt;br /&gt;    }&lt;br /&gt;    if(ch=='g')&lt;br /&gt;    {&lt;br /&gt;     setfillstyle(SOLID_FILL,GREEN);&lt;br /&gt;     floodfill(280,50,15);&lt;br /&gt;    }&lt;br /&gt;   }while(ch!='g'&amp;&amp;ch!=13);&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;   car(i++,0);&lt;br /&gt;   car(i,15);&lt;br /&gt;   delay(50);&lt;br /&gt;  }&lt;br /&gt;   }&lt;br /&gt;   ch=getch();&lt;br /&gt;   if(ch==13)&lt;br /&gt;  break;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; getch();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-747732376316992928?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/747732376316992928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=747732376316992928' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/747732376316992928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/747732376316992928'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/car-movement-during-traffic-signal.html' title='Car movement during Traffic Signal'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-7580713095650384228</id><published>2008-10-07T00:33:00.001-07:00</published><updated>2008-10-07T00:37:52.658-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Computer Graphics programs'/><title type='text'>Boundary Fill</title><content type='html'>The boundary fill algorithm fills a region with the given fill color until the given boundary color is found. Here i have used the 8-point technique to color a region. The program is using a recurssive function. The function return when the pixel to be colored is the boundary color or is already the fill color.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;&lt;br /&gt;void boundary_fill(int x,int y, int fcolor,int bcolor)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    if((getpixel(x,y) != fcolor) &amp;&amp; (getpixel(x,y) != bcolor))&lt;br /&gt;    {&lt;br /&gt;        putpixel(x,y,fcolor);&lt;br /&gt;        boundary_fill(x+1,y,fcolor,bcolor);&lt;br /&gt;        boundary_fill(x-1,y,fcolor,bcolor);&lt;br /&gt;        boundary_fill(x,y-1,fcolor,bcolor);&lt;br /&gt;        boundary_fill(x,y+1,fcolor,bcolor);&lt;br /&gt;        boundary_fill(x+1,y-1,fcolor,bcolor);&lt;br /&gt;        boundary_fill(x+1,y+1,fcolor,bcolor);&lt;br /&gt;        boundary_fill(x-1,y-1,fcolor,bcolor);&lt;br /&gt;        boundary_fill(x-1,y+1,fcolor,bcolor);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;    int x,y,fcolor,bcolor;&lt;br /&gt;&lt;br /&gt;    clrscr();&lt;br /&gt;    printf("Enter the seed pointn");&lt;br /&gt;    scanf("%d%d",&amp;x,&amp;y);&lt;br /&gt;    printf("Enter boundary color : ");&lt;br /&gt;    scanf("%d",&amp;bcolor);&lt;br /&gt;    printf("Enter new color : ");&lt;br /&gt;    scanf("%d",&amp;fcolor);&lt;br /&gt;&lt;br /&gt;    int gd=DETECT,gm=DETECT;&lt;br /&gt;    initgraph(&amp;gd,&amp;gm,"");&lt;br /&gt;    cleardevice();&lt;br /&gt;&lt;br /&gt;    /*&lt;br /&gt;    plase ceate your own shapes &lt;br /&gt;    to make a closed area.&lt;br /&gt;   */&lt;br /&gt;&lt;br /&gt;    boundary_fill(x,y,fcolor,bcolor);&lt;br /&gt;&lt;br /&gt;    getch();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-7580713095650384228?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/7580713095650384228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=7580713095650384228' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/7580713095650384228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/7580713095650384228'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/boundary-fill-algorithm-fills-region.html' title='Boundary Fill'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-8151090890384409667</id><published>2008-10-07T00:35:00.000-07:00</published><updated>2008-10-07T00:36:48.869-07:00</updated><title type='text'>Bouncing Ball</title><content type='html'>#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;#include&amp;lt;dos.h&amp;gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;    int gd=DETECT,gm=DETECT;&lt;br /&gt;    int x,y=0,j,t=400,c=1;&lt;br /&gt;    initgraph(&amp;gd,&amp;gm,"");&lt;br /&gt;    setcolor(RED);&lt;br /&gt;    setfillstyle(SOLID_FILL,RED);&lt;br /&gt;    for(x=40;x&amp;lt;602;x++)&lt;br /&gt;    {&lt;br /&gt;        cleardevice();&lt;br /&gt;        circle(x,y,30);&lt;br /&gt;        floodfill(x,y,RED);&lt;br /&gt;        delay(40);&lt;br /&gt;&lt;br /&gt;        if(y&amp;gt;=400)&lt;br /&gt;        {&lt;br /&gt;            c=0;&lt;br /&gt;            t-=20;&lt;br /&gt;        }&lt;br /&gt;        if(y&amp;lt;=(400-t))&lt;br /&gt;            c=1;&lt;br /&gt;        y=y+(c?15:-15);&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;getch();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-8151090890384409667?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/8151090890384409667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=8151090890384409667' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/8151090890384409667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/8151090890384409667'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/bouncing-ball.html' title='Bouncing Ball'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-1042541018242853175</id><published>2008-10-07T00:31:00.000-07:00</published><updated>2008-10-07T00:32:13.903-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Computer Graphics programs'/><title type='text'>Flood Fill</title><content type='html'>The flood fill algorithm replaces a current color with a new color.Here i have used the 8-point technique to color a region. The program is using a recurssive function. The function return when the pixel to be replaced is not the given old color.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;&lt;br /&gt;void flood_fill(int x,int y, int ncolor,int ocolor)&lt;br /&gt;{&lt;br /&gt;    if(getpixel(x,y) == ocolor)&lt;br /&gt;    {&lt;br /&gt;        putpixel(x,y,ncolor);&lt;br /&gt;        flood_fill(x+1,y,ncolor,ocolor);&lt;br /&gt;        flood_fill(x+1,y-1,ncolor,ocolor);&lt;br /&gt;        flood_fill(x+1,y+1,ncolor,ocolor);&lt;br /&gt;        flood_fill(x,y-1,ncolor,ocolor);&lt;br /&gt;        flood_fill(x,y+1,ncolor,ocolor);&lt;br /&gt;        flood_fill(x-1,y,ncolor,ocolor);&lt;br /&gt;        flood_fill(x-1,y-1,ncolor,ocolor);&lt;br /&gt;        flood_fill(x-1,y+1,ncolor,ocolor);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;    int x,y,ncolor,ocolor;&lt;br /&gt;&lt;br /&gt;    clrscr();&lt;br /&gt;    printf("Enter the seed pointn");&lt;br /&gt;    scanf("%d%d",&amp;x,&amp;y);&lt;br /&gt;    printf("Enter old color : ");&lt;br /&gt;    scanf("%d",&amp;ocolor);&lt;br /&gt;    printf("Enter new color : ");&lt;br /&gt;    scanf("%d",&amp;ncolor);&lt;br /&gt;&lt;br /&gt;    int gd=DETECT,gm=DETECT;&lt;br /&gt;    initgraph(&amp;gd,&amp;gm,"");&lt;br /&gt;    cleardevice();&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;&lt;br /&gt;    Draw some figures&lt;br /&gt;    to create  closed shapes&lt;br /&gt;    you can use any biut-in functions.  &lt;br /&gt;    Please everyone make their own figures.&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    flood_fill(x,y,ncolor,ocolor);&lt;br /&gt;&lt;br /&gt;    getch();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-1042541018242853175?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/1042541018242853175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=1042541018242853175' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/1042541018242853175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/1042541018242853175'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/flood-fill.html' title='Flood Fill'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-5731348457481634606</id><published>2008-10-07T00:29:00.000-07:00</published><updated>2008-10-07T00:30:01.869-07:00</updated><title type='text'>Ellipse</title><content type='html'>#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;&lt;br /&gt;void plotpoints(int cx,int cy, int x,int y)&lt;br /&gt;{&lt;br /&gt;  putpixel(cx + x, cy + y,4);&lt;br /&gt;  putpixel(cx - x, cy + y,4);&lt;br /&gt;  putpixel(cx + x, cy - y,4);&lt;br /&gt;  putpixel(cx - x, cy - y,4);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;  int cx,cy,rx,ry;&lt;br /&gt;&lt;br /&gt;  printf("Enter the center ");&lt;br /&gt;  scanf("%d%d",&amp;cx,&amp;cy);&lt;br /&gt;  printf("x radius : ");&lt;br /&gt;  scanf("%d",&amp;rx);&lt;br /&gt;  printf("y radius : ");&lt;br /&gt;  scanf("%d",&amp;ry);&lt;br /&gt;&lt;br /&gt;  long rx2 = (long)rx*rx;&lt;br /&gt;  long ry2 = (long)ry*ry;&lt;br /&gt;  long trx2 = 2*rx2;&lt;br /&gt;  long try2 = 2*ry2;&lt;br /&gt;  long p,x=0, y=ry;&lt;br /&gt;  long px=0;&lt;br /&gt;  long py = trx2 * y;&lt;br /&gt;&lt;br /&gt;  p = (long) ( ( ry2 - (rx2 * ry) + (0.25 * rx2) ) + 0.5 );&lt;br /&gt;&lt;br /&gt;  int gd=DETECT,gm=DETECT;&lt;br /&gt;  initgraph(&amp;gd,&amp;gm,"");&lt;br /&gt;  cleardevice();&lt;br /&gt;&lt;br /&gt;  putpixel(cx,cy,15);&lt;br /&gt;&lt;br /&gt;  while(px&amp;lt;py)&lt;br /&gt;  {&lt;br /&gt;    plotpoints(cx,cy,x,y);&lt;br /&gt;    x++;&lt;br /&gt;    px += try2;&lt;br /&gt;    if(p &amp;lt; 0)&lt;br /&gt;    p += ry2 + px;&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;    y--;&lt;br /&gt;    py -= trx2;&lt;br /&gt;    p += ry2 + px -py;&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;  py=trx2*y;&lt;br /&gt;  px=try2*x;&lt;br /&gt;  p = (long) (  (ry2*(x+0.5)*(x+0.5) + rx2*(y-1)*(y-1) - rx2*ry2) + 0.5  );&lt;br /&gt;  while(y&amp;gt;=0)&lt;br /&gt;  {&lt;br /&gt;    plotpoints(cx,cy,x,y);&lt;br /&gt;    y--;&lt;br /&gt;    py -= trx2;&lt;br /&gt;    if(p &amp;gt; 0)&lt;br /&gt;        p += rx2 - py;&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;        x++;&lt;br /&gt;        px += try2;&lt;br /&gt;        p += rx2 - py + px;&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  getch();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-5731348457481634606?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/5731348457481634606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=5731348457481634606' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/5731348457481634606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/5731348457481634606'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/ellipse.html' title='Ellipse'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-4326152889530102822</id><published>2008-10-07T00:28:00.000-07:00</published><updated>2008-10-07T00:29:03.750-07:00</updated><title type='text'>Wheel</title><content type='html'>#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;#include&amp;lt;math.h&amp;gt;&lt;br /&gt;&lt;br /&gt;int L=0;&lt;br /&gt;&lt;br /&gt;void ddaline(int x1,int y1,int x2,int y2)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;int s,dx,dy,m,c=0;&lt;br /&gt;float xi,yi,x,y;&lt;br /&gt;&lt;br /&gt;dx=x2-x1;&lt;br /&gt;dy=y2-y1;&lt;br /&gt;&lt;br /&gt;if(abs(dx)&amp;gt;abs(dy))&lt;br /&gt;   s=abs(dx);&lt;br /&gt;else&lt;br /&gt;   s=abs(dy);&lt;br /&gt;&lt;br /&gt;xi=dx/(float)s;&lt;br /&gt;yi=dy/(float)s;&lt;br /&gt;&lt;br /&gt;x=x1;&lt;br /&gt;y=y1;&lt;br /&gt;&lt;br /&gt;putpixel(x1+0.5,y1+0.5,15);&lt;br /&gt;for(m=0;m&amp;lt;s;m++)&lt;br /&gt;{&lt;br /&gt; x+=xi;&lt;br /&gt; y+=yi;&lt;br /&gt; if(getpixel(x+0.5,y+0.5)==4)&lt;br /&gt;     {&lt;br /&gt;       c++;&lt;br /&gt;       continue;&lt;br /&gt;     }&lt;br /&gt;  if(c%2==0)&lt;br /&gt;     {&lt;br /&gt;        putpixel(x+0.5,y+0.5,15);&lt;br /&gt;     }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void plotpoints(int x,int y,int cx,int cy,int s)&lt;br /&gt;{&lt;br /&gt;    if(s==0)&lt;br /&gt;    {&lt;br /&gt;        if(L%20==0)&lt;br /&gt;        {&lt;br /&gt;         ddaline(cx-x,cy-y,cx+x,cy+y);&lt;br /&gt;         ddaline(cx-y,cy+x,cx+y,cy-x);&lt;br /&gt;         ddaline(cx-y,cy-x,cx+y,cy+x);&lt;br /&gt;         ddaline(cx-x,cy+y,cx+x,cy-y);&lt;br /&gt;        }&lt;br /&gt;        L++;&lt;br /&gt;    }&lt;br /&gt;    putpixel(cx+x,cy+y,4);&lt;br /&gt;    putpixel(cx-x,cy+y,4);&lt;br /&gt;    putpixel(cx+x,cy-y,4);&lt;br /&gt;    putpixel(cx-x,cy-y,4);&lt;br /&gt;    putpixel(cx+y,cy+x,4);&lt;br /&gt;    putpixel(cx-y,cy+x,4);&lt;br /&gt;    putpixel(cx+y,cy-x,4);&lt;br /&gt;    putpixel(cx-y,cy-x,4);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void mcircle(int cx,int cy,int r,int s)&lt;br /&gt;{&lt;br /&gt;    int x=0,y,p;&lt;br /&gt;&lt;br /&gt;    y=r;&lt;br /&gt;    p=1-r;&lt;br /&gt;&lt;br /&gt;    while(x&amp;lt;=y)&lt;br /&gt;    {&lt;br /&gt;        plotpoints(x,y,cx,cy,s);&lt;br /&gt;        x++;&lt;br /&gt;        if(p&amp;lt;0)&lt;br /&gt;            p+=2*x+1;&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;            y--;&lt;br /&gt;            p+=2*(x-y)+1;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int gd=DETECT,gm=DETECT;&lt;br /&gt;initgraph(&amp;gd,&amp;gm,"");&lt;br /&gt;&lt;br /&gt;mcircle(300,250,20,1);&lt;br /&gt;mcircle(300,250,100,0);&lt;br /&gt;&lt;br /&gt;getch();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-4326152889530102822?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/4326152889530102822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=4326152889530102822' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/4326152889530102822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/4326152889530102822'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/wheel.html' title='Wheel'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-7183547271468387518</id><published>2008-10-07T00:22:00.000-07:00</published><updated>2008-10-07T00:27:26.530-07:00</updated><title type='text'>Circle using Mid-Point Algorithm</title><content type='html'>#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;&lt;br /&gt;void plotpoints(int x,int y,int cx,int cy)&lt;br /&gt;{&lt;br /&gt;    putpixel(cx+x,cy+y,4);&lt;br /&gt;    putpixel(cx-x,cy+y,4);&lt;br /&gt;    putpixel(cx+x,cy-y,4);&lt;br /&gt;    putpixel(cx-x,cy-y,4);&lt;br /&gt;    putpixel(cx+y,cy+x,4);&lt;br /&gt;    putpixel(cx-y,cy+x,4);&lt;br /&gt;    putpixel(cx+y,cy-x,4);&lt;br /&gt;    putpixel(cx-y,cy-x,4);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;    int cx,cy,x=0,y,r,p;&lt;br /&gt;    int gd=DETECT,gm=DETECT;&lt;br /&gt;&lt;br /&gt;    clrscr();&lt;br /&gt;&lt;br /&gt;    printf("Enter the center n");&lt;br /&gt;    scanf("%d%d",&amp;cx,&amp;cy);&lt;br /&gt;    printf("Enter the radius : ");&lt;br /&gt;    scanf("%d",&amp;r);&lt;br /&gt;&lt;br /&gt;    y=r;&lt;br /&gt;    p=1-r;&lt;br /&gt;&lt;br /&gt;    initgraph(&amp;gd,&amp;gm,"");&lt;br /&gt;    cleardevice();&lt;br /&gt;&lt;br /&gt;    while(x&amp;lt;y)&lt;br /&gt;    {&lt;br /&gt;        plotpoints(x,y,cx,cy);&lt;br /&gt;        x++;&lt;br /&gt;        if(p&amp;lt;0)&lt;br /&gt;            p+=2*x+1;&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;            y--;&lt;br /&gt;            p+=2*(x-y)+1;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;getch();&lt;br /&gt;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-7183547271468387518?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/7183547271468387518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=7183547271468387518' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/7183547271468387518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/7183547271468387518'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/circle-using-mid-point-algorithm.html' title='Circle using Mid-Point Algorithm'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-3273084503185610318</id><published>2008-10-07T00:20:00.000-07:00</published><updated>2008-10-07T00:21:44.157-07:00</updated><title type='text'>Chess Board using DDA line drawing algorithm</title><content type='html'>#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;#include&amp;lt;math.h&amp;gt;&lt;br /&gt;&lt;br /&gt;void ddaline(int  x1,int  y1,int x2,int y2)&lt;br /&gt;{&lt;br /&gt;    int  s,m,dx,dy;&lt;br /&gt;    float xi,yi,x,y;&lt;br /&gt;&lt;br /&gt;    dx=x2-x1;&lt;br /&gt;    dy=y2-y1;&lt;br /&gt;&lt;br /&gt;    if(abs(dx)&amp;gt;abs(dy))&lt;br /&gt;       s=abs(dx);&lt;br /&gt;    else&lt;br /&gt;       s=abs(dy);&lt;br /&gt;&lt;br /&gt;    xi=dx/(float)s;&lt;br /&gt;    yi=dy/(float)s;&lt;br /&gt;&lt;br /&gt;    x=x1;&lt;br /&gt;    y=y1;&lt;br /&gt;&lt;br /&gt;    putpixel(x1+0.5,y1+0.5,15);&lt;br /&gt;&lt;br /&gt;    for(m=0;m&amp;lt;s;m++)&lt;br /&gt;    {&lt;br /&gt;     x+=xi;&lt;br /&gt;     y+=yi;&lt;br /&gt;     putpixel(x+0.5,y+0.5,15);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void fill(int x,int y)&lt;br /&gt;{&lt;br /&gt;    int i,j;&lt;br /&gt;    for(i=x;i&amp;lt;(x+50);i++)&lt;br /&gt;        ddaline(i,y,i,y+50);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;    int i,j,c=0;&lt;br /&gt;    int gd=DETECT,gm=DETECT;&lt;br /&gt;&lt;br /&gt;    initgraph(&amp;gd,&amp;gm,"");&lt;br /&gt;    cleardevice();&lt;br /&gt;&lt;br /&gt;    ddaline(100,50,100,450);&lt;br /&gt;    ddaline(100,50,500,50);&lt;br /&gt;    ddaline(500,50,500,450);&lt;br /&gt;    ddaline(100,450,500,450);&lt;br /&gt;&lt;br /&gt;    for(i=100;i&amp;lt;500;i+=50)&lt;br /&gt;    {&lt;br /&gt;        for(j=50;j&amp;lt;450;j+=50)&lt;br /&gt;        {&lt;br /&gt;            if(c%2==0)&lt;br /&gt;                fill(i,j);&lt;br /&gt;            c++;&lt;br /&gt;        }&lt;br /&gt;        c++;&lt;br /&gt;    }&lt;br /&gt;    getch();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-3273084503185610318?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/3273084503185610318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=3273084503185610318' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/3273084503185610318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/3273084503185610318'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/chess-board-using-dda-line-drawing.html' title='Chess Board using DDA line drawing algorithm'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2289259654117574211.post-4658476508761887452</id><published>2008-10-07T00:16:00.000-07:00</published><updated>2008-10-07T00:19:53.745-07:00</updated><title type='text'>Bressenham's Line Drawing Algorithm</title><content type='html'>&lt;p&gt;&lt;b&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include&amp;lt;conio.h&amp;gt;&lt;br /&gt;#include&amp;lt;graphics.h&amp;gt;&lt;br /&gt;#include&amp;lt;math.h&amp;gt;&lt;br /&gt;&lt;br /&gt;void swap(int &amp;amp;x,int &amp;amp;y)&lt;br /&gt;{&lt;br /&gt; int k=x;&lt;br /&gt; x=y;&lt;br /&gt; y=k;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int gd=DETECT,gm=DETECT,x1,x2,y1,y2,dx,dy,p,k;&lt;br /&gt;float m=0;&lt;br /&gt;&lt;br /&gt;clrscr();&lt;br /&gt;&lt;br /&gt;printf("Enter the sarting point x1 &amp;amp; y1n");&lt;br /&gt;scanf("%d%d",&amp;amp;x1,&amp;amp;y1);&lt;br /&gt;&lt;br /&gt;printf("Enter the end point x2 &amp;amp; y2n");&lt;br /&gt;scanf("%d%d",&amp;amp;x2,&amp;amp;y2);&lt;br /&gt;&lt;br /&gt;dx=abs(x2-x1);&lt;br /&gt;dy=abs(y2-y1);&lt;br /&gt;m=(float)(y2-y1)/(x2-x1);&lt;br /&gt;&lt;br /&gt;initgraph(&amp;amp;gd,&amp;amp;gm,"");&lt;br /&gt;cleardevice();&lt;br /&gt;&lt;br /&gt;if(fabs(m)&amp;gt;1)&lt;br /&gt; {&lt;br /&gt;   swap(x1,y1);&lt;br /&gt;   swap(x2,y2);&lt;br /&gt;   swap(dx,dy);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;   if((x1&amp;gt;x2))&lt;br /&gt;   {&lt;br /&gt;     x1=x2;&lt;br /&gt;     y1=y2;&lt;br /&gt;   }&lt;br /&gt;   p=2*dy-dx;&lt;br /&gt;   for(k=0;k&amp;lt;abs(dx);k++)&lt;br /&gt;    {&lt;br /&gt;      if(p&amp;lt;0)&lt;br /&gt;       {&lt;br /&gt;     p=p+2*dy;&lt;br /&gt;       }&lt;br /&gt;      else&lt;br /&gt;       {&lt;br /&gt;     if(m&amp;lt;0) y1--;&lt;br /&gt;     else y1++;&lt;br /&gt;     p=p+(2*dy)-(2*dx);&lt;br /&gt;       }&lt;br /&gt;      if(fabs(m)&amp;lt;=1)putpixel(x1++,y1,15);&lt;br /&gt;      else putpixel(y1,x1++,15);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt; getch();&lt;br /&gt;}&lt;/b&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2289259654117574211-4658476508761887452?l=computergraphics.dipinkrishna.info' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://computergraphics.dipinkrishna.info/feeds/4658476508761887452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=2289259654117574211&amp;postID=4658476508761887452' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/4658476508761887452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2289259654117574211/posts/default/4658476508761887452'/><link rel='alternate' type='text/html' href='http://computergraphics.dipinkrishna.info/2008/10/bressenhams-line-drawing-algorithm.html' title='Bressenham&apos;s Line Drawing Algorithm'/><author><name>Dipin Krishna</name><uri>http://www.blogger.com/profile/08940524052547849343</uri><email>dipinkrishna@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='14024449101475011638'/></author><thr:total>0</thr:total></entry></feed>