C and C++ Programming Resources

Share/Bookmark
Custom Search

C Language Graphics Library Reference (part 1)

Posted on February 3rd, 2008

Graphics programming in C Language is discussed rarely. Today I will discuss some important functions of graphics.h in C programming Language and in the next coming article I will make a simple program to demonstrate the use of graphics functions. This is the part one of the article which discuses the important graphics function to create and destroy the graphics environment. In part two I will show you different graphics functions to draw shapes. And in last part I will add a sample program to demonstrate the use of graphics.h library. So let's start with the description of important functions and their use.

Below are the important functions and their description mostly used in graphics applications in C Language.

Function initgraph

This function is used to load the graphics drivers and initialize the graphics system. For every function, that uses graphics mode, graphics mode must be initialized before using that function.

void far initgraph(int far *driver, int far *mode, char far *path)

Path determines that path to the specified graphics driver.

Function detectgraph

Detectgraph function determines the graphics hardware in the system, if the function finds a graphics adapter then it returns the highest graphics mode that the adapter supports.

void far detectgraph(int far *driver, int far *mode)

Function cleardevice

This function clears the graphics screen contents and return the control to the location (0,0).

void far cleardevice(void)

Function closegraph

This function shutdown the graphics mode and returns to the position it was before the initgraph function was called. Closegraph function releases all the resources occupied by the graphics system like memry, fonts, drivers etc…

void far closegraph(void)

Like What you See?

Become one of the regulars by subscribing! You'll be the first to know when we add more great posts just like this. Join up by either RSS Feeds or Email Updates today!

There are No Comments to this post. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response or TrackBack from your own site.


Leave a Reply

You must be logged in to post a comment.