You are here:

C/Stand Alone Graphics ?

Advertisement


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

Answer
Hi 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.  

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Prince M. Premnath

Expertise


I'm sure that I can solve any doubts in Turbo C ,Graphics Programing ,Mouse, Hardware Programming ,File System ,Interrupts, BIOS handling , TSR Programming , General Concepts in C Language, handling inline Assembly statements

Experience

Research over 6+ Years

Organizations
CG-VAK Softwares and Exports Limited

Education/Credentials
Masters in Computer Applications

©2012 About.com, a part of The New York Times Company. All rights reserved.