🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Untitled

posted in DruinkJournal
Published August 10, 2006
Advertisement
The MSDN lies.
Quote: CreateCompatibleDC:

A memory DC exists only in memory. When the memory DC is created, its display surface is exactly one monochrome pixel wide and one monochrome pixel high. Before an application can use a memory DC for drawing operations, it must select a bitmap of the correct width and height into the DC. To select a bitmap into a DC, use the CreateCompatibleBitmap function, specifying the height, width, and color organization required.

Quote: CreateCompatibleBitmap:

HBITMAP CreateCompatibleBitmap(
HDC hdc, // handle to DC
int nWidth, // width of bitmap, in pixels
int nHeight // height of bitmap, in pixels
);
So where do I set the colours exactly?

Anyway, read my post. My font renderer is comming along. Slowly, but it's getting there. I hope to get the glyphs onto D3D textures during my lunch today, and I hope to have the whole font stuff done or nearly done by Monday.
Previous Entry Bugger
Next Entry Untitled
0 likes 4 comments

Comments

Rob Loach
A yes, the wonders of the Win32 API.
August 10, 2006 07:50 AM
mattd
Quote:
The color format of the bitmap created by the CreateCompatibleBitmap function matches the color format of the device identified by the hdc parameter.


That's why it's called a Compatible bitmap.
August 10, 2006 08:14 AM
ApochPiQ
Use GetScreenDC and feed that into CreateCompatibleDC to get a memory device context in the same bit-depth and such as the screen device. Be warned that you should pay attention to resolution/color depth change events (you will get a Windows message IIRC) as these may invalidate your device contexts and require you to recreate them, in certain cases.
August 10, 2006 10:05 AM
Evil Steve
Quote: Original post by mattd
Quote: The color format of the bitmap created by the CreateCompatibleBitmap function matches the color format of the device identified by the hdc parameter.


Quote: Original post by Evil Steve
use the CreateCompatibleBitmap function, specifying the [snip] color organization required[/b].
CreateCompatibleBitmap doesn't lewt you specify any colour anything. That was my point.
August 10, 2006 02:00 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement