Jump to content
  • Advertisement

Archived

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

Truecolor in GDI (c'mon, there's gotta be a way)

This topic is 5834 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've always worked with 256 color bitmaps in GDI, but at the moment I'm trying to get truecolor to work with GDI and it's throwing an absolute fit (things are turning purple that should very much not be purple, and so on). Does anyone know how to get things to display in Truecolor (24-bit) using MFC/GDI? -fel [edited by - felisandria on May 30, 2002 10:22:27 AM]

Share this post


Link to post
Share on other sites
Advertisement
Hmm. Found it.

In case anyone is curious, you have to load via DIB like so:

m_bitmap1.Attach(::LoadImage(0, "C:\\GDI Demo\\sample3.bmp", IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_CREATEDIBSECTION | LR_LOADFROMFILE));

to avoid an auto-convert to default, then stretch blitting was causing artifacts which is kind of unavoidable unless I want to write my own stretchblit, which I might do later.

-fel

Share this post


Link to post
Share on other sites
EDIT: snip! There's not much point in a method that doesn't work if you've already found the answer...

[edited by - Alimonster on May 30, 2002 10:48:23 AM]

Share this post


Link to post
Share on other sites
For future reference:
You can create a 32bit bitmap with CreateBitmap(); and this has an option to specify the data, which is nice if you decide to load graphics in another format other than bmp, and then you can keep your hi color image too.

Share this post


Link to post
Share on other sites
A little problem, felisandria...
quote:

From Microsoft Win32 SDK
LoadImage
(...)
Windows NT: LR_LOADFROMFILE is not supported.
(...)




theNestruo

Syntax error in 2410
Ok

Share this post


Link to post
Share on other sites
quote:
Original post by felisandria
to avoid an auto-convert to default, then stretch blitting was causing artifacts which is kind of unavoidable unless I want to write my own stretchblit, which I might do later.



hey fel, does this help with the artifacts?

::SetStretchBltMode(hDC,STRETCH_DELETESCANS);

it worked for me. too me a while to dig it up from msdn.


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!