You are on page 1of 14

ER DIAGRAM

===============================================================

1.INTRODUCTION TO COMPUTER GRAPHICS

The computer is an information processing machine. It is at tool for storing ,

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

express data in pictorial form.

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

thing, there is a lot of development in hardware and software required to generate

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

and more people.

Computer Graphics is one of the most powerful and interesting facets of

computers. There is a lot that can be done in graphics apart from drawing figures of

various shapes. It is used today in many different areas of industry, business,

government, education and most recently, the home.

===============================================================
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

graphics library file.

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
===============================================================

3.GRAPHICS FUNCTIONS USED IN THE PROJECT:

circle() : Draws a circle with the specified center and radius.

SYNTAX:
void far circle(int x, int y, int radius);

PARAMETERS:

(x, y)-------centre of the circle

radius ----radius of the circle.

Clearviewport 0 : Erases the viewport and moves the current position to home (0,0)
relative to the viewport.
SYNTAX:
void far clearviewport(void);

Closegraph(): Deallocates all the memory allocated by the graphics system.

SYNTAX:
void far closegraph (void);

===============================================================
3
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================

floodfill(): Flood-fills the bounded region.

SYNTAX:

floodfill(int x,int y,int border);

(x,y) is a ‘seed ‘ point within the enclosed area to be filled.

The area bounded by the color border is flooded with the current fill

pattern and fill color

Bar: Draws a two-dimensional bar.

SYNTAX:

void bar(int left, int top, int right, int bottom);

This function draws a filled-in, rectangular, 2D-bar.

Cleardevice: Clears the graphics screen and moves the current position to (0,0).

SYNTAX:

void cleardevice();

Getcolor: Returns the current drawing color.

SYNTAX:

int getcolor();

The drawing color is the value to which pixels are set when lines, rectangles etc are

drawn.

Initgraph: Initializes the graphics system

===============================================================
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.

Outtextxy: Outtextxy displays a string at the specified location (graphics mode)

SYNTAX:

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

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)

setfillstyle: Sets the fill pattern and color

SYNTAX:

void far setfillstyle(int pattern, int color);

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

register with different values and issuing interrupt number 33h.

Interrupt Service Purpose


33h 0 Reset mouse and status
Call with: AX=0

Returns

AX=FFFFh If mouse support is available

AX=0 If mouse support is not available


33h 1 Show mouse pointer
Call with: AX=1

Returns nothing
33h 2 Hide mouse pointer
Call with: AX=2

Returns nothing

33h 3 Get mouse position and button status


Call with: AX=3

Return BX=mouse button status

Bit significance

0 left button is down

1 right button is down

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

Call with: AX=4

CX=x coordinate

DX=y coordinate
33h 7 Set horizontal limits for pointer

Call with: AX=7

CX= minimum x coordinate

DX= minimum x coordinate


33h 8 Set vertical limits for pointer

Call with: AX=8

CX= minimum y coordinate

DX= minimum y coordinate

Mouse can be used in text mode as well as in graphics mode. The functions provided in

the editor for mouse handling are as follows:

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.

2: Showmouseptr() : This is used to display the mouse pointer.

3: Restrictmouseptr() : To restrict the mouse pointer movement.

4: Getmousepos() : This is to get the (x,y) position of the mouse pointer where it is

clicked. The prototype is as follows:

Getmousepos(int *button, int *x, int *y);

===============================================================
7
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================

CHANGING MOUSE CURSOR:

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

graphics mode occupies a 16 by 16 pixel box by

highlighting or De-highlighting some of the pixels in this box the mouse cursor of the

desired shape can be obtained.

===============================================================
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
===============================================================

6. NOTATIONS FOR 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

The aim of the project was exhaustive and exploratory study of

Computer Graphics under C. The programming uses the basic

graphics functions and techniques. Though not as sophisticated as

the same, it nevertheless provides all the basic requirements

expected out of a graphics. It can be further improved upon to

provide better facilities and user interface.

===============================================================
13
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology
ER DIAGRAM
===============================================================

9.BIBLIOGRAPHY

[1] Yashwant Kanitkar, Graphics under C, Third edition, 2003

[2] Foley, Van Dam, Computer Graphics Principles and Practice, Seventh edition, 2004.

[3] Hearn, Baker, Computer Graphics C version, Second edition, 2005.

[4] William Newman, Robert Sproull, Principles of interactive Computer Graphics,


Second edition.

===============================================================
14
Dept. of Computer Science & Engineering
K.L.E.Society’s college of Engineering & Technology

You might also like