If you're going to do it with
SetPixel()
, you're going to have a lot of trouble. That will stuck your program. This is
GDI
we are talking about, which is a device independent high level graphical API. GDI has a quite long pipeline when we call a GDI drawing function. No. of calls to a drawing function slows your program than what it actually does.
For Example, both of the following functions will do the same, but will act as differently. Try using both functions and see the difference. (1st function uses a one call to draw a rectangle, but the 2nd uses 1000*1000, which is 1,000,000 function calls to the same function over and over) :
void DrawRect(HDC hdc)
{
Rectangle(hdc, 0, 0, 1000, 1000);
}
void SetPixelRect(HDC hdc)
{
int i,j;
for(i=0; i<1000; i++)
for(j=0; j<1000; j++)
{
SetPixel(hdc, i, j, RGB(0,0,0));
}
}
It's always good to start things from the scratch. But for your purpose, GDI is not the best place. You need to code directly to the VGA to do so. Try google for that.