What is the quickest way to paste a monochrome bitmap to the window client area? I don't know what format the screen is in, so I'm going to use GDI. :) I've tried CreateBitmapIndirect, but SelectObject doesn't work because it is in a different format (I guess?).

The MS documentation just goes in circles and I can't understand how one would paste a monochrome DDB. I need to have control of the bitmap buffer. Do I have to create the bitmap with GDI each time the size changes? Is there anyway I can control the data and just send it to windows for the BitBlt?
Posted on 2003-01-21 13:24:23 by bitRAKE
CreateDIBSection creates a bitmap you can manipulate the bits of directly, select it in a DC created with CreateCompatibleDC(NULL) (or hWnd instead of NULL if that doesn't work). Setup a BITMAPINFO structure (including a 2 entry palette with black and white), and you get a pointer to the bitmap data (btw remember that each line is 4 byte aligned).
Then just bitblt the DC/bitmap onto the window.

Thomas
Posted on 2003-01-21 13:44:49 by Thomas
So, I have to DeleteObject/CreateDIBSection each time changes are made to the size of the bitmap? (ie Windows controls the memory of the bitmap data?) Or, is there a way to tweak the parameters in the BITMAPINFO?
Posted on 2003-01-21 13:53:00 by bitRAKE
Or, is there a way to tweak the parameters in the BITMAPINFO?

I don't think so... Besides, the whole bitmap is one piece of continious memory so changing the size would make the of the bitmap data useless. So windows would have to paste the old bitmap over the new one to get the pixels in the right place and I don't think there's any API that does all this automatically. But you could use a maximum size and blit only part of it. Why do you need to resize it?
Posted on 2003-01-21 13:58:19 by Thomas
Why do you need to resize it?
The width doesn't change often, but is 8k-32k and the height is based on the window height. Might even want to make it wider? Larger the better. I'm thinking on trying 2^20 x 2^11 pixels. :)
Posted on 2003-01-21 14:08:52 by bitRAKE