Text mode graphics functions


We have seen many C distro, Turbo C and Borland C include an extensive collection of graphics oriented library functions. These fall into two categories ,namely the text mode and the graphics mode. The textmode functions are concerned with placing text in certain areas of the screen. They work with monitor adapter, so you can use them even if you have only a monochrome system. The graphics mode functions require a graphics monitor and adapter card, such as CGA,EGA,or VGA. When you first boot your computer, it is usually in the text mode. In textmode, you are restricted to display text based graphic characters. In a graphics mode, you can display points and shapes or arbitrary complexity. In this mode, the screen is divided into character position, typically 80 columns by 25 rows, you have only 2000 locations , i mean 80x25 display. In graphic mode, you address individual pixels or dots on the screen. This gives you a much finer resolution. In a 640x480 standard VGA mode, you can address 307,200 pixels. 



GRAPHIC FUNCTIONS USED IN TEXT MODE. 



C has graphics oriented library functions which can be used in text mode. Some of the functions commonly used are listed below. 



Window 
This function takes four integer arguments that determine the left,top,right, and bottom co-ordinates. These co-ordinates essentially refer to rows and columns,which should be absolute values. The sytax: 



window(30,5,5,10); 
Next function is cputs() 
This function can be used to write a string in a window defined using window function. 
Syntax is 
cputs(string); 



Next function is gotoxy() 
This function positions the cursor within the a text window . This function takes two integer parameters x and y co ordinates where the cursor should move. Syntax is: 
gotoxy(column,row) 
graphics mode programs use a completely different set of functions from textmode programs to put images on the screen.