Graphics in C

Graphics in c language

In C Language by Baqir AliLeave a Comment

What is graphics?

The ability to draw pictures in color, in a fraction of a second is one of the most fascinating capabilities of modern computers. Graphics can help the user make sense of the number produced in a spreadsheet in form GRAPH, most games rely heavily on graphics, simulators, model designing software, web sites and nowadays even entire operating systems such as Windows and OS/2 are using Graphics-Oriented User Interface.

Graphics Fundamentals

Pixel: Graphics images on a computer screen are composed of tiny dots called pixels for “picture element”

Resolution: Pixels are arranged on the screen in horizontal rows there fixed number of rows, and each row contains a certain number of pixels. The number of pixel used on the screen is called the resolution.

Pages: It is possible to keep several screens of data in memory at the same time. By switching from one page to another, very rapid changes can be made to the image on the screen.


Before any of the graphics mode function, the graphics system must be initialized by function initgraph(). This function loads a graphics driver (like egavga.bgi) from the disk and changes the display to the appropriate graphics mode.

The syntax is as below

initgraph(&driver, &mode, BGIpath)

Driver: Here we have to mention which one monitor we are using, Multisync monitors can be used with all standards.

Modes: Jus as an artist can choose from a variety of media when creating a picture ( oil, watercolor, etching, collage, etc.), so a PC graphics programmer can choose from a variety of different modes or formats. Each mode provides a different combination of graphics characteristics. These characteristics include the resolutions, the number of possible colors, whether text or graphics are to be displayed.

BGI files: This argument causes to load graphics driver. This driver is file like cga.bgi or ega vga.

Graphics in C
Graphics in C

Leave a Comment