Archived

This topic is now archived and is closed to further replies.

maprichards

problems with blitting a bitmap to the screen on a laptop

Recommended Posts

I''m writing a program using directdraw which for some reason is behaving differently on my desktop computer and on my laptop. The essence of the problem is that I have an array of unsigned chars (let''s call it *image) which form a bitmap which I want to blit to the screen. so the approach I''m taking is as follows. After I generate the image and place it into *image, I then create a bitmap from the array of unsigned chars. hBitmap=CreateBitmap(screenSizeX,screenSizeY,1,32,image); SelectObject (memdc, hBitmap); and then in my WM_PAINT call I do the following: hdc = BeginPaint(hWnd,&ps); BitBlt(hdc,0, 0, screenSizeX, screenSizeY, memdc, 0, 0, SRCCOPY); SwapBuffers(hdc); EndPaint(hWnd, &ps); I make sure I do a call to InvalidateRectangle so that my WM_PAINT is called. It seems like pretty typical stuff. This works properly on my desktop, but does not work on my Sony Vaio laptop computer for some reason (I get a black screen when I run it on my laptop). When I change the creation of the bitmap to: for (x=0; x

Share this post


Link to post
Share on other sites
For some reason part of my code didn''t show up. the
code I tried that worked was:


for (x=0; x for (y=0; y SetPixel(memdc,x,y,RGB((int)image[coord(x,y,RED)],(int)image[coord(x,y,GREEN)],(int)image[coord(x,y,BLUE)]));
}
}


where "coord" is a macro that returns the RED, GREEN, or BLUE
component of the (x,y) pixel

Share this post


Link to post
Share on other sites
trying again:

for (x=0; x less than screenSizeX; x++) {
for (y=0; y less than screenSizeY; y++) {
SetPixel(memdc,x,y,RGB((int)image[coord(x,y,RED)],(int)image[coord(x,y,GREEN)],(int)image[coord(x,y,BLUE)]));
}
}

Share this post


Link to post
Share on other sites