C/Stand Alone Graphics ?
Expert: Prince M. Premnath - 8/15/2007
Question Hi, I'd like to kindly ask you 2 questions:
1) What is the easiest way to draw a point and a line in C language apart from using the graphics.h source file
2) Someone suggested GDI for drawing on the screen. How does that work?
Thaks much. Eric
AnswerHi dear Eric ?
How are you ? nice to see you back with your question!
Placing a pixel without the help of graphics.h and graphics library is of course tedious! a
You can place a pixel in two ways without the help of graphics.h header file.
1.Using BIOS Function ( For VGA)
2.Direct Video memory access.
Both of these methods expects lot of background knowledge about the computer fundamentals in hardware level , so i suggest you to follow the link given below.
http://www.brackeen.com/vga/
You can get all sort of information regarding the standalone graphics routines .
Please feel free to post any of your doubts over this tutorials
What is GDI ?
GDI ( Graphics Device Interface ) is nothing but a graphics package that comes along with the WIN32, GDI functions are really powerful for most of the application , but it fails for the leading edge technologies , DirectX and OpenGL replaces the GDI
Let me show you how to place a pixel using GDI
//declare and set handle
HDC hDC;
hDC=GetDC(hwnd);
//Set the pixel (450,300) to blue
int x = 450;
int y = 300;
SetPixel(hDC, x,y, RGB(0,0,255));
So GDI is a different cup of coffee !
Thanks and Regards!
Prince M. Premnath.