Professional Documents
Culture Documents
===============================================================
manipulating and correlating data. There are many ways to communicate the processed
information to the user. The Computer Graphics is one of the most effective and
commonly used way to communicate the processed data to the user. It displays the
information in the form of graphics objects such as pictures, charts and diagrams
instead of simple text. Thus we can say that computer graphics makes it possible to
Computer Graphics is one of the most exciting and rapidly growing computer
fields. It is also an extremely effective medium for communication between man and
computer; the human can understand the information content of a displayed diagram or
perspective view much faster than it can understand a table of numbers. Knowing this
images, and now a days the cost of such hardware and software is also dropping
rapidly. Due to this the interactive computer graphics is becoming available to more
computers. There is a lot that can be done in graphics apart from drawing figures of
===============================================================
1
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================
2.GRAPHICS UNDER C
For drawing any graphics on the screen header file GRAPHICS.H and library
file GRAPHICS.LIB are needed. The header file contains definitions and explanation of
all the graphics functions and constants, whereas the graphics and functions are kept in
Before carrying out any drawing activity the first thing required is to switch over
to graphics mode. This is done depending on the adapter and monitor installed on the
computer.
===============================================================
2
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================
SYNTAX:
void far circle(int x, int y, int radius);
PARAMETERS:
Clearviewport 0 : Erases the viewport and moves the current position to home (0,0)
relative to the viewport.
SYNTAX:
void far clearviewport(void);
SYNTAX:
void far closegraph (void);
===============================================================
3
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================
SYNTAX:
The area bounded by the color border is flooded with the current fill
SYNTAX:
Cleardevice: Clears the graphics screen and moves the current position to (0,0).
SYNTAX:
void cleardevice();
SYNTAX:
int getcolor();
The drawing color is the value to which pixels are set when lines, rectangles etc are
drawn.
===============================================================
4
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================
SYNTAX:
void far initgraph(int far *graphdriver, int far *graphmode, char far *pathtodriver);
Initgraph initializes the graphics system by loading a graphics driver from disk (or
validating a registered driver) then putting the system into graphics mode.
SYNTAX:
outtextxy display a text string, using the current justification settings and
the current font, direction, and size. outtextxy displays textstring in the viewport at the
position (x, y)
SYNTAX:
setfillstyle sets the current fill pattern and fill color. Sets the current line style and width
or pattern
4. MOUSE HANDLING
===============================================================
5
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================
Graphical user interfaces and mouse go hand in hand. A mouse is used to point at the icon
that forms the menu in GUI. To make use of mouse the device driver program that senses
the signals from the port to which the mouse is attached must be loaded. Once the mouse
driver is loaded the various mouse functions can be accessed by setting up the AX
Returns
Returns nothing
33h 2 Hide mouse pointer
Call with: AX=2
Returns nothing
Bit significance
CX=x coordinate
DX=y coordinate
===============================================================
6
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================
33h 4 Set mouse pointer position
CX=x coordinate
DX=y coordinate
33h 7 Set horizontal limits for pointer
Mouse can be used in text mode as well as in graphics mode. The functions provided in
1: Initmouse() : To initialize mouse. Checks if the driver has been loaded or not and then
report the status. If mouse is not initialized successfully then the closegraph() function
unloads the graphics driver and restore the crtmode() and take the screen back to the pre-
initgraph() mode.
4: Getmousepos() : This is to get the (x,y) position of the mouse pointer where it is
===============================================================
7
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================
The mouse has a separate cursor which functions in the same way as normal
cursor. The speed and the shape of the mouse cursor can be changed.The mouse cursor in
highlighting or De-highlighting some of the pixels in this box the mouse cursor of the
===============================================================
8
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================
5.FILE HANDLING
The following are the operation’s that can be performed with the files.
• New : Confirm whether to save the previously opened file to save by giving a
message box and opens a new blank document using the function file items
and load.
• Open : This opens an existing file in the read mode. This makes two functions,
file item and open1 (). The file item is invoked by mouse click event,on th file
function button.The function opens a dialog box, to specify the file that is
open . When the file name is entered the second function is invoked. This
function actually performs the file opening operation. Basically this operation
deals with reading individual pixels from the file content and then diaplaying
on the screen.
• Save : This operation saves the file specified by the user. This makes use of
two functions diagram() is invoked by mouse click event, on the file function
button. This function opens the dialog box to specify the file name for the file
to be saved for the first time otherwise the changes that are made to the file
are saved.
===============================================================
9
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================
SYMBOLS MEANING
ENTITY
ATTRIBUTE
RELATIONSHIP
WEAK ENTITY
MULTIVALUED ATTRIBUTE
TOTAL PARTICIPATION
===============================================================
10
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================
7.SCREEN SHOTS
===============================================================
11
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================
===============================================================
12
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================
8. CONCLUSION
===============================================================
13
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================
9.BIBLIOGRAPHY
[2] Foley, Van Dam, Computer Graphics Principles and Practice, Seventh edition, 2004.
===============================================================
14
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology