Introduction To Computer Graphics

Posted: September 30, 2011 in Computer Graphics
Tags: , ,

The Borland Graphics Interface (BGI) is a collection of functions and procedures that are often called as graphical toolkit which an application program may use to solve specific graphics problem. Turbo C++ graph unit (graphics.h) provides a complete set of library consisting of over 80 graphics routines that range from bit oriented routines high level calls. In addition to the graphics libraries, those are many graphical constants and types. In order to use the Turbo C++ graphics routines, the following hardware components should be installed in the personal computer (pc) system:-

  • A graphics display controller
  • A color monitor or any other display device that can be plugged into the controller board.
  • Some of the standard graphics display boards available for  IBM Pcs are:-

1)    Color graphics adapter (CGA)

2)    Enhanced graphics adapter (EGA)

3)    Video graphics array adapter (VGA)

4)    Multi color graphics array adapter (MCGA)

The Turbo C++ package includes a collection of special drivers which provide low level software compatibility with the above and other hardware configuration. Graphics drivers are stored in the disk in the form of files and have (.BGI) extensions.



1)    Get driver name:-  The get drivername() is a method that is used to return a string containing the name of the current driver. The syntax of get drivername() is:-

Char * for getdrivername (void);

After a call to unitgraph, get drivername returns the name of the driver that is currently headed.

2)    Get graphmode:- The get graphmode() is method that is used to return the current graphics mode. The general syntax of get graphmode is:-

Int for getgraphmode(void);

The get graphmode() method returns the current graphics mode set by init graph() or by set graph mode (). The mode value is an integer between 0 to 5 depending on the current graphics driver.

3)    Close graph:-  The close graph() is a method that is used to shut down the graphics system. When the call of the close graph procedure is successful, then computer system will be brought to the normal text screen. The call of the closegraph() method is a must for each program to terminate the graphical devices. The general syntax of the close graph() is:-

void for closegraph(void)

it deallocates all memory aloocated by the graphics system.


4)    Init graph :- The method is used to initialize the graphics; system & to put the hardware into graphics mode. To start the graphics system, user must first call initgraph(). The general syntax of initgraph is:-

Void for initgraph (int for * graphics driver int for * graphmode, char for * path to driver);

5)    Graph driver :- Integer that specifies the graphics drivers o be used. User can also give graph driver, a value usig a constant of the graphics drivers enumeration type. If graphic driver is equal to detect, a call is made to any user defined auto detect routines & then the detect graph. If graphics hardware is detected, then the appropriate graphics driver is initialized and graphics mode selected


6)    Circle:- It is the method that is used to draw a circle in the current color set by setcolor using(x,y) as the center point. The general syntax of circle() is:-

Void for circle(int x, inty, int radius) where x,y are user defined integer variables which define the center point of the circle. The radius can be defined as integer.


7)    Set color:- It is used to set the current drawing color, using the palette. The general syntax of setcolor() is:-

Void for setcolor (int color);

The call to setcolor(5) makes the fifth color in the palette, the current drawing color. Drawing color might range from 0 to 15, depending on the current graphics driver and graphics mode.

8)    Flood Fill:- This method is used to fill a bounde region with the current fill pattern and color. The area bounded by the color border is flooded with the current fill pattern and fill color. The general syntax of the floodfill() is:-

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

If the peed point is within an enclosed area, then the inside will be filled. If the seed is outside the enclosed area, then the exterior will be filled.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s