Group c Assignment 7 Man Walking in Rain
Group c Assignment 7 Man Walking in Rain
PROBLEM STATEMENT:
Write C++ program to to draw man walking in the rain with an umbrella. Apply the
concept of polymorphism.
PREREQUISITES:
Basic knowledge of graphics primitives.
COURSE OBJECTIVE:
1. To implement the features of graphics.
2. To interface the applications of graphics to the real world.
3. To give some benefits to the disability.
4. To make the life easier.
5. To become familiarization with Graphics and its logical coding.
COURSE OUTCOME:
To understand the concepts related to polymorphism and graphics primitives.
THEORY:
Computer Graphics has revolutionized almost every computer-based application in
science and technology. Information technology is a trend today.The importance of
computer graphics lies in its applications. In engineering applications (e.g. automotive
and aerospace) the ability to quickly visualize newly designed shapes is indispensible.
Computer graphics has also expanded the boundaries of art and entertainment. Movies
such as “JURASSIC PARK” make extensive use of computer graphics to create images
that test the bounds of imagination. The development of computer graphics has made
possible virtual reality, a synthetic reality that exists only inside a computer. Virtual
reality is fast becoming an indispensable tool in education. Flight simulators are used to
train pilot for extreme conditions. Surgical simulators are used to train novice surgeons
without endangering patients.
Circle function: Circle function is used to draw a circle with center (x, y) and third
parameter specifies the radius of the circle. The code given below draws a circle.
Declaration: - void circle (int x, int y, int radius);
Setcolor function: In Turbo Graphics each color is assigned a number. Total 16 colors
are available. Strictly speaking number of available colors depends on current graphics
mode and driver. For Example :- BLACK is assigned 0, RED is assigned 4 etc. setcolor
function is used to change the current drawing color.e.g. Setcolor (RED) or setcolor(4)
changes the current drawing color to RED. Remember that default drawing color is
WHITE.
Declaration: - void setcolor (int color);
Getmaxx function: getmaxx function returns the maximum X coordinate for current
graphics mode and driver.
Declaration:-int getmaxx ();
Getmaxy function: getmaxy function returns the maximum Y coordinate for current
graphics mode and driver.
Declaration:- intgetmaxy();
Setlinestyle function: Setlinestyle function sets line style, thickness, unsigned upattern
etc.
Declaration: - void setlinestyle (intlinestyle, unsigned upattern, int thickness);
Putpixel function: putpixel function plots a pixel at location (x, y) of specified color.
Declaration: - void putpixel (int x, int y, int color);
For example if we want to draw a GREEN color pixel at (35, 45) then we will
write putpixel (35, 35, GREEN); in our c program, putpixel function can be used
to draw circles, lines and ellipses using various algorithms.
Setfillstyle function: setfillstyle function sets the current fill pattern and fill color.
Declaration: - void setfillstyle (int pattern, int color);