You are on page 1of 21

C Graphics

Pixel:
Pixel is otherwise called as picture elements. These are nothing but small dots.
Using these tiny dots or in other words pixels images especially graphics images are
built on screen.
If all pictures are built by concept of pixel then wondering how each picture differ
that is how some picture appear more brighter while some other have a shady
effect. All this is by the concept or technically terminology called as resolution.

Resolution:
Resolution is the number of rows that appear from top to bottom of a screen
and in turn the number of pixels or pixel elements that appear from left to
right on each scan line. Based on this resolution only the effect of picture
appears on screen.

In other words greater the resolution greater will be the clarity of picture.
This is because greater the number of dots greater will be sharpness of
picture. That is resolution value is directly proportional to clarity of picture.

Modes:
There are generally two modes available in C namely text mode and
graphics mode.

Text mode:
Text mode is a kind of computer display mode in which the content of the screen is
internally represented in terms of textual characters rather than individual pixels.
Typically, the screen consists of a uniform grid of character cells, each of which
contains one of the characters of the character set.

Text mode applications communicate with the user with command-line


interfaces and text user interfaces. The advantages of text modes compared
to graphics modes include lower memory consumption and faster screen
manipulation.

Also, text mode applications have relatively low bandwidth requirements in


remote terminal use. An obvious disadvantage of text mode is the restricted
screen content, which makes text mode impractical for many types of
applications.

Graphics mode:
In a graphics mode we have generally the following adapters namely
CGA (Color Graphics Adapter) [640x200, 4 bit 2 colors]
EGA (Enhanced Graphics Adapter) [640x350, 4 bit 16 colors]
VGA(Video Graphics Adapter) [ 640x480, 4 bit 16 colors]

Each adapter differs in the way of generating colors and also in the number
of colors produced by each adapter. Pixel being a picture element when we
consider the graphics mode each pixel has a color associated with it. But the

Prepared By: Jaydev Gajera


C Graphics

way these colors are used depends on adapters because each adapter differs
in the way they handle colors and also in the number of colors supported.
There are numerous graphics functions available in c.

For example:
Function: putpixel(x, y, color)
Purpose: The functionality of this function is it put a pixel or in other words a dot
at position x, y given in inputted argument. Here one must understand that the
whole screen is imagined as a graph. In other words the pixel at the top left hand
corner of the screen represents the value (0, 0).

Here the color is the integer value associated with colors and when specified
the picture element or the dot is placed with the appropriate color associated
with that integer value.

Two Dimensional Coordinate System


1. Rectangle Coordinate System
This system commonly known as Cartesian coordinate system.

A Cartesian coordinate system specifies each point uniquely in a plane by


a pair of numerical coordinates, which are the signed distances from the
point to two fixed perpendicular directed lines, measured in the same unit of
length.

Each reference line is called a coordinate axis or just axis of the system,
and the point where they meet is its origin.

The coordinates can also be defined as the positions of the perpendicular


projections of the point onto the two axes, expressed as a signed distances
from the origin.

Prepared By: Jaydev Gajera


C Graphics

Illustration of a Cartesian coordinate plane. Four points are marked and labeled with
their coordinates: (2,3) in green, (−3,1) in red, (−1.5,−2.5) in blue, and the origin
(0,0) in purple.
Choosing a Cartesian coordinate system for a plane means choosing an ordered pair
of lines (axes) at right angles to each other, a single unit of length for both axes,
and an orientation for each axis. The point where the axes meet is taken as the
origin for both axes, thus turning each axis into a number line. Each coordinate of a
point p is obtained by drawing a line through p perpendicular to the associated axis,
finding the point q where that line meets the axis, and interpreting q as a number of
that number line.

Cartesian coordinates are the foundation of analytic geometry, and provide


enlightening geometric interpretations for many other branches of
mathematics, such as linear algebra, complex analysis, differential
geometry, multivariate calculus, group theory, and more.

A familiar example is the concept of the graph of a function. Cartesian


coordinates are also essential tools for most applied disciplines that deal with
geometry, including astronomy, physics, engineering, and many more. They
are the most common coordinate system used in computer graphics,
computer-aided geometric design, and other geometry-related data
processing.

2. Polar Coordinate System


In mathematics, the polar coordinate system is a two-dimensional coordinate
system in which each point on a plane is determined by a distance from a fixed
point and an angle from a fixed direction.

Prepared By: Jaydev Gajera


C Graphics

The fixed point is called the pole, and the ray from the pole with the fixed
direction is the polar axis.

The distance from the pole is called the radial coordinate or radius, and the
angle is the angular coordinate, polar angle.

Points in the polar coordinate system with pole O and polar axis L. In green, the
point with radial coordinate 3 and angular coordinate 60 degrees, or (3,60°). In
blue, the point (4,210°).

The radial coordinate is often denoted by r, and the angular coordinate by θ


or t.

Angles in polar notation are generally expressed in either degrees or radians


(2π rad being equal to 360°). Degrees are traditionally used in navigation,
surveying, and many applied disciplines, while radians are more common in
mathematics and mathematical physics.

In many contexts, a positive angular coordinate means that the angle θ is


measured counterclockwise from the axis.

Converting between polar and Cartesian coordinates

Prepared By: Jaydev Gajera


C Graphics

A diagram illustrating the relationship between polar and Cartesian


coordinates.

The two polar coordinates r and θ can be converted to the Cartesian


coordinates x and y by using the trigonometric functions sine and cosine:

while the two Cartesian coordinates x and y can be converted to polar


coordinate r by

(as in the Pythagorean theorem), and

Header Files

stdlib.h

stdlib.h is the header of the general purpose standard library of C programming language which
includes functions involving memory allocation, process control, conversions and others. It is
compatible with C++ and is known as cstdlib in C++. The name "stdlib" stands for "standard
library".

graphics.h

Prepared By: Jaydev Gajera


C Graphics

graphics.h is the header of the graphics library of C programming language.

Functions
Below are the important functions and their description mostly used in
graphics applications in C Language.

Initgraph
This function is used to load the graphics drivers and initialize the graphics
system. For every function, that uses graphics mode. Graphics mode must
be initialized before using that function.

Deceleration : void far initgraph(int far *driver, int far *mode, char far *path)

Where: Path determines that path to the specified graphics driver.


(generally “C:\\tc\\bgi”)
Remarks:
To start the graphics system, you must first call initgraph.
initgraph initializes the graphics system by loading a graphics driver from disk then
putting the system into graphics mode.
initgraph also resets all graphics settings (color, palette, current position, viewport,
etc.) to their defaults, then resets graphresult to 0.
*graphdriver and *graphmode must be set to valid graphics_drivers and
graphics_mode values or you'll get unpredictable results.

detectgraph

Detectgraph function determines the graphics hardware in the system, if the


function finds a graphics adapter then it returns the highest graphics mode
that the adapter supports.

Deceleration : void far detectgraph(int far *driver, int far *mode)

Cleardevice This function clears the graphics screen contents and return
the control to the location (0,0).

Deceleration : void far cleardevice(void)


closegraph
This function shutdown the graphics mode and returns to the position it was
before the initgraph function was called. Closegraph function releases all the
resources occupied by the graphics system like memry, fonts, drivers etc…

Declaration : void far closegraph(void);

Remarks:
closegraph deallocates all memory allocated by the graphics system.
Prepared By: Jaydev Gajera
C Graphics

It then restores the screen to the mode it was in before you called initgraph.
(The graphics system deallocates memory, such as the drivers, fonts, and an
internal buffer, through a call to _graphfreemem.)

Setgraphmode
setgraphmode sets the system to graphics mode, clears the screen

Declaration: void far setgraphmode(int mode);

Remarks:

setgraphmode selects a graphics mode different than the default one set by
initgraph. It clears the screen and resets all graphics settings to their
defaults.

mode must be a valid mode for the current device driver.


Return Value:
setgraphmode does not return.

graphresult :
Returns an error code for the last unsuccessful graphics operation.

Declaration: int far graphresult(void);

Remarks:
graphresult returns the error code for the last graphics operation that reported an
error, then resets the error level to grOk.

The variable maintained by graphresult is reset to 0 after graphresult has


been called. Therefore, you should store the value of graphresult into a
temporary variable and then test it.

Return Value: Returns the current graphics error number, (an integer in the
range -15 to 0).

graphdefaults
Resets all graphics settings to their defaults

Declaration: void far graphdefaults(void);

Remarks:

graphdefaults resets all graphics settings to their defaults:

Prepared By: Jaydev Gajera


C Graphics

sets the viewport to the entire screen. moves the current position to (0,0).
sets the default palette colors, background color, and drawing color.sets the
default fill style and pattern. sets the default text font and justification.

Return Value: None

grapherrormsg:
Returns a pointer to an error message string

Declaration: char *far grapherrormsg(int errorcode);

Remarks:
grapherrormsg returns a pointer to the error message string associated with
errorcode, the value returned by graphresult.
Return Value : Returns a pointer to an error message string.

restorecrtmode
Restores screen mode to pre-initgraph setting

Declaration: void far restorecrtmode(void);

Remarks:
restorecrtmode restores the original video mode detected by initgraph.
This function can be used in conjunction with setgraphmode to switch back
and forth between text and graphics modes.

getmaxx, getmaxy
Returns maximum x or y screen coordinate
Declaration:
int far getmaxx(void);
int far getmaxy(void);
Remarks:
getmaxx returns the maximum x value (screen-relative) for the current
graphics driver and mode.
getmaxy returns the maximum y value (screen-relative) for the current
graphics driver and mode.
For ex: On a CGA in 320 x 200 mode, getmaxx returns 319 and getmaxy
returns 199.

Return Value:
getmaxx: maximum x screen coordinate
getmaxy: maximum y screen coordinate

Prepared By: Jaydev Gajera


C Graphics

getpixel, putpixel
getpixel gets the color of a specified pixel
putpixel plots a pixel at a specified point

Declaration:
unsigned far getpixel(int x, int y);
void far putpixel(int x, int y, int color);

Remarks:
getpixel gets the color of the pixel located at (x,y).
putpixel plots a point in the color defined by color at (x,y).

Return Value:
getpixel returns the color of the given pixel.
putpixel does not return.

getx, gety
getx returns the current position's x coordinate
gety returns the current position's y coordinate

Declaration:
int far getx(void);
int far gety(void);

Remarks:
getx returns the x-coordinate of the current graphics position.
gety returns the y-coordinate of the current graphics position.

Return Value:
getx: x-coordinate of current position , gety: y-coordinate of current position

outtext, outtextxy
outtext displays a string in the viewport (graphics mode)
outtextxy displays a string at the specified location (graphics mode)

Declaration:
void far outtext(char far *textstring);
void far outtextxy(int x, int y, char far *textstring);

Remarks:
outtext and outtextxy display a text string, using the current justification
settings and the current font, direction, and size.
Prepared By: Jaydev Gajera
C Graphics

outtext outputs textstring at the current position (CP)


outtextxy displays textstring in the viewport at the position (x, y)

To maintain code compatibility when using several fonts, use textwidth and
textheight to determine the dimensions of the string.

If a string is printed with the default font using outtext or outtextxy, any
part of the string that extends outside the current viewport is truncated.

With outtext, if the horizontal text justification is LEFT_TEXT and the text
direction is HORIZ_DIR, the CP's x-coordinate is advanced by
textwidth(textstring).

Otherwise, the CP remains unchanged.

outtext and outtextxy are for use in graphics mode; they will not work in
text mode.

Return Value: None

settextjustify
Sets text justification for graphics mode

Declaration: void far settextjustify(int horiz, int vert);

Remarks:
Text output after a call to settextjustify is justified around the current
position (CP) horizontally and vertically, as specified.
The default justification settings are
LEFT_TEXT (for horizontal) and
TOP_TEXT (for vertical)
The enumeration text_just in GRAPHICS.H provides names for the horiz and
vert settings passed to settextjustify.
settextjustify affects text written with outtext and can't be used with
text-mode and stream functions.

Return Value:
If invalid input is passed to settextjustify, graphresult returns -11, and
the current text justification remains unchanged.

settextstyle
Sets the current text characteristics
Prepared By: Jaydev Gajera
C Graphics

Declaration:
void far settextstyle(int font, int direction, int charsize);

Remarks:
settextstyle sets the text font, the direction in which text is displayed,
and the size of the characters.
A call to settextstyle affects all text output by outtext and outtextxy.
font
One 8x8 bit-mapped font and several "stroked" fonts are available. The 8x8
bit-mapped font, the default, is built into the graphics system.
The enumeration font_names, defined in GRAPHICS.H, provides names for
the
different font settings.
direction
Font directions supported are horizontal text (left to right) and vertical
text (rotated 90 degrees counterclockwise).

textheight, textwidth
textheight returns the height of a string in pixels
textwidth returns the width of a string in pixels

Declaration:
int far textheight(char far *textstring);
int far textwidth(char far *textstring);

Remarks:
textheight takes the current font size and multiplication factor, and
determines the height of textstring in pixels.

textwidth takes the string length, current font size, and multiplication factor,
and determines the width of textstring in pixels.

These functions are useful for adjusting the spacing between lines,
computing viewport heights, sizing a title to make it fit on a graph or in a
box, etc..

For example, with the 8x8 bit-mapped font and a multiplication factor of 2
(set by settextstyle), the string "Turbo C++" is 16 pixels high.
Instead of doing the computations manually, use textheight to compute the
height of strings, and use textwidth to compute their width.
When you use these functions, no source code modifications are required
when
you select different fonts.
Prepared By: Jaydev Gajera
C Graphics

Return Value:
textheight returns the text height in pixels. textwidth returns the text width
in pixels.

getcolor, setcolor
getcolor returns the current drawing color
setcolor sets the current drawing color

Declaration:
int far getcolor(void);
void far setcolor(int color);

Remarks:
getcolor returns the current drawing color.

setcolor sets the current drawing color to color, which can range from 0 to
getmaxcolor.

To select a drawing color with setcolor, you can pass either the color
number or the equivalent color name.

The drawing color is the value that pixels are set to when the program draws
lines, etc.

For example, in CGAC0 mode (palette number 0), the palette contains four
colors (background, light green, light red, and yellow):
If getcolor returns 1, the current drawing color is light green.
Either setcolor(3) or setcolor(CGA_YELLOW) selects yellow as the drawing
color.

In CGAC3 mode, if getcolor returns 1, the current drawing color is cyan.

Return Value:
getcolor returns the current drawing color.
setcolor does not return

getmaxcolor
Returns maximum color value

Declaration: int far getmaxcolor(void);

Prepared By: Jaydev Gajera


C Graphics

Remarks:
getmaxcolor returns the highest valid color value that can be passed to
setcolor for the current graphics driver and mode.
For example, on a 256K EGA, getmaxcolor always returns 15. This means
that any call to setcolor with a value from 0 to 15 is valid.
On a CGA in high-resolution mode getmaxcolor returns 1.

Return Value: Returns the highest available color value.

getbkcolor, setbkcolor
getbkcolor returns the current background color
setbkcolor sets the current background color using the palette

Declaration:
int far getbkcolor(void);
void far setbkcolor(int color);

Remarks:
getbkcolor returns the current background color.
setbkcolor sets the background to the color specified by color.

color is either a number or symbolic name specifying the color to set.

For example, if you want to set the background color to blue, you can call
setbkcolor(BLUE) /* or */ setbkcolor(1)
On CGA and EGA systems, setbkcolor changes the background color by
changing
the first entry in the palette.
On an EGA or a VGA, if you call setpalette or setallpalette to change the
palette colors, the defined symbolic constants might not give the correct
color.
This is because the color parameter to setbkcolor indicates the entry number
in the current palette, rather than a specific color. (Except 0, which
always sets the background color to black).

Return Value:
getbkcolor returns the current background color.
setbkcolor does not return.

setfillpattern
setfillpattern selects a user-defined fill pattern

Prepared By: Jaydev Gajera


C Graphics

Declaration: void far setfillpattern(char far *upattern, int color);

Remarks:
setfillpattern sets the current fill pattern to a user-defined 8x8 pattern.
Whenever a bit in a pattern's byte is set to 1, the corresponding pixel is
plotted.

Return Value: None

Setfillstyle :
Sets the fill pattern and color

Declaration: void far setfillstyle(int pattern, int color);

Remarks:
setfillstyle sets the current fill pattern and fill color.
To set a user-defined fill pattern, do not give a pattern of 12 (USER_FILL) to
setfillstyle; instead, call setfillpattern.
The enumeration fill_patterns, defined in GRAPHICS.H, gives names for the
predefined fill patterns, plus an indicator for a user-defined pattern.

Return Value: None


If invalid input is passed to setfillstyle, graphresult returns -11 (grError), and
the current fill pattern and fill color remain unchanged.

floodfill
Flood-fills a bounded region

Declaration: void far floodfill(int x, int y, int border);

Remarks:
floodfill fills an enclosed area on bitmap devices.
The area bounded by the color border is flooded with the current fill pattern
and fill color.
(x,y) is a "seed point".
If the seed is within an enclosed area, the inside will be filled.
If the seed is outside the enclosed area, the exterior will be filled.

Prepared By: Jaydev Gajera


C Graphics

Return Value:
If an error occurs while flooding a region, graphresult returns -7.

setlinestyle
Sets the current line style and width or pattern

Declaration: void far setlinestyle(int linestyle, unsigned upattern, int


thickness);

Remarks:
setlinestyle sets the style for all lines drawn by line, lineto, rectangle,
drawpoly, etc.

Return Value:
If invalid input is passed to setlinestyle, graphresult returns -11, and the
current line style remains unchanged.

imagesize
Returns the number of bytes required to store a bit image

Declaration:
unsigned far imagesize(int left, int top, int right, int bottom);

Remarks:
imagesize determines the size of the memory area required to store a bit
image.

Return Value:
On success, returns the size of the required memory area in bytes.
On error (if the size required for the selected image is >= (64K - 1) bytes),
returns 0xFFFF (-1)

getimage, putimage
getimage saves a bit image of the specified region into memory
putimage outputs a bit image onto the screen

Declaration:
void far getimage(int left, int top, int right, int bottom,void far *bitmap);
void far putimage(int left, int top, void far *bitmap, int op);

Remarks:
getimage copies an image from the screen to memory.

Prepared By: Jaydev Gajera


C Graphics

putimage puts the bit image previously saved with getimage back onto the
screen, with the upper left corner of the image placed at (left,top)
Argument What It Is/Does
bitmap -Points to the area in memory where the bit image is
stored.
-The first two words of this area are used for the width
and
height of the rectangle.
-The remainder holds the image itself.

Bottom left right -(left, top) and (right, bottom) define the rectangular
top screen area from which getimage copies the bit image.
-(left, top) is where putimage places the upper left
corner of the stored image.

op Specifies a combination operator that controls how the


color for each destination pixel onscreen is computed,
based on the pixel already onscreen and the
corresponding source pixel in memory.

Return Value: None

setviewport
Sets the current viewport for graphics output
Declaration:
void far setviewport(int left, int top, int right, int bottom, int clip);

Remarks:
setviewport establishes a new viewport for graphics output.
The viewport's corners are given in absolute screen coordinates by (left,top)
and (right,bottom).
The current position (CP) is moved to (0,0) in the new window.

The clip argument determines whether drawings are clipped (truncated) at


the current viewport boundaries. If clip is non-zero, all drawings will be
clipped to the current viewport.

Return Value:
setviewport does not return.
If invalid input is passed to setviewport, graphresult returns -11, and the
current view settings remain unchanged.

Prepared By: Jaydev Gajera


C Graphics

clearviewport
Clears the current viewport
Declaration: void far clearviewport(void);

Remarks:
clearviewport erases the viewport and moves the CP (current position) to
home (0,0), relative to the viewport.

Return Value: None


line, linerel, lineto
line draws a line between two specified points
linerel draws a line a relative distance from the current position (CP)
lineto draws a line from the current position (CP) to (x,y)

Declaration:
void far line(int x1, int y1, int x2, int y2);
void far linerel(int dx, int dy);
void far lineto(int x, int y);

Remarks:
line draws a line from (x1, y1) to (x2, y2) using the current color, line style,
and thickness. It does not update the current position (CP).

linerel draws a line from the CP to a point that is a relative distance (dx, dy)
from the CP, then advances the CP by (dx, dy).

lineto draws a line from the CP to (x, y), then moves the CP to (x, y).

Return Value: None

moverel, moveto
moverel moves the current position (CP) a relative distance moveto moves
the CP to (x, y)

Declaration:
void far moverel(int dx, int dy);
void far moveto(int x, int y);

Remarks:
moverel moves the current position (CP) dx pixels in the x direction and dy
pixels in the y direction.
moveto moves the current position (CP) to viewport position (x, y).

Prepared By: Jaydev Gajera


C Graphics

Return Value: None

bar: Draws a bar

Declaration: void far bar(int left, int top, int right, int bottom);

Remarks:
bar draws a filled-in, rectangular, two-dimensional bar.
The bar is filled using the current fill pattern and fill color. bar does not
outline the bar.
To draw an outlined two-dimensional bar, use bar3d with depth = 0.
Parameters What they are
(left, top) the rectangle's upper left corner
(right, bottom) the rectangle's lower right corner
The coordinates are in pixels.

Return Value: None

bar3d: Draws a 3-D bar

Declaration: void far bar3d(int left, int top, int right, int bottom, int depth, int
topflag);

Remarks:
bar3d draws a three-dimensional rectangular bar, then fills it using the current fill
pattern and fill color.
The three-dimensional outline of the bar is drawn in the current line style and color.
Parameters What they are
depth Bar's depth in pixels

(left, top) the rectangle's upper left corner


(right, bottom) the rectangle's lower right corner
topflag Governs whether a three-dimensional
top is put on the bar

If topflag is non-zero, a top is put on the bar. If topflag is 0, no top is put on the bar:
This makes it possible to stack several bars on top of one another.

To calculate a typical depth for bar3d, take 25% of the width of the bar,like this:
bar3d(left, top, right, bottom, (right-left)/4, 1);

Return Value: None

Rectangle : Draws a rectangle (graphics mode)

Prepared By: Jaydev Gajera


C Graphics

Declaration: void far rectangle(int left, int top, int right, int bottom);

Remarks:
rectangle draws a rectangle in the current line style, thickness, and drawing color.
(left,top) is the upper left corner of the rectangle, and (right,bottom) is its lower
right corner.

Return Value: None

arc, circle, pieslice


arc draws a circular arc
circle draws a circle
pieslice draws and fills a circular pie slice

Declaration:
void far arc(int x, int y, int stangle, int endangle, int radius);
void far circle(int x, int y, int radius);
void far pieslice(int x, int y, int stangle, int endangle, int radius);

Remarks:
arc draws a circular arc in the current drawing color.

circle draws a circle in the current drawing color.

pieslice draws a pie slice in the current drawing color, then fills it using
the current fill pattern and fill color.
Argument What It Is/Does
(x,y) Center point of arc, circle, or pie slice
stangle Start angle in degrees
endangle End angle in degrees
radius Radius of arc, circle, and pieslice

The arc or slice travels from stangle to endangle.


If stangle = 0 and endangle = 360, the call to arc draws a complete circle.

Angle for arc, circle, and pieslice (counter-clockwise)


90 degrees
|
|
180 --------------------0 degrees,
degrees | 360 degrees
|
270 degrees

Prepared By: Jaydev Gajera


C Graphics

Return Value: None

Ellipse, fillellipse, sector

ellipse draws an elliptical arc


fillellipse draws and fills an ellipse
sector draws and fills an elliptical pie slice

Declaration:
void far ellipse(int x, int y, int stangle, int endangle, int xradius, int yradius);
void far fillellipse(int x, int y, int xradius, int yradius);
void far sector(int x, int y, int stangle, int endangle, int xradius, int yradius);

Remarks:
ellipse draws an elliptical arc in the current drawing color.

fillellipse draws an ellipse, then fills the ellipse with the current fill color and fill
pattern.

sector draws and fills an elliptical pie slice in the current drawing color, then fills it
using the pattern and color defined by setfillstyle or setfillpattern.

Argument What It Is
(x,y) Center of ellipse
Xradius Horizontal axis
Yradius Vertical axis
Stangle Starting angle
Endangle Ending angle

The ellipse or sector travels from stangle to endangle.


If stangle = 0 and endangle = 360, the call to ellipse draws a complete ellipse.

Return Value: None

drawpoly, fillpoly
drawpoly draws the outline of a polygon
fillpoly draws and fills a polygon

Declaration:
void far drawpoly(int numpoints, int far *polypoints);
void far fillpoly(int numpoints, int far *polypoints);

Remarks:

Prepared By: Jaydev Gajera


C Graphics

drawpoly draws a polygon using the current line style and color.

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.

Argument What It Is
numpoints Specifies number of points
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.
To draw a closed figure with N vertices, you must pass N+1 coordinates to
drawpoly, where the Nth coordinate == the 0th coordinate.

Return Value: None

Prepared By: Jaydev Gajera