Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    423599

Untitled

Sign in to follow this  
Evil Steve

101 views

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.
Sign in to follow this  


4 Comments


Recommended Comments

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.

Share this comment


Link to comment
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.

Share this comment


Link to comment
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.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!