Jump to content
  • Advertisement

Archived

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

Yarharhar

Direct Draw/Display question

This topic is 6381 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

Advertisement
I didn''t use DDraw in a long time but I think there was a GetPixelFormat method (call it from a surface, like lpDDS->GetPixelFormat(...).

If I remember well, you''ve got to pass it a pointer to a DDPIXELFORMAT struct (LPDDPIXELFORMAT?). Just check MSDN or the DX sdk help on these .

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

DDPIXELFORMAT ddpf;
ddpf.dwSize = sizeof(ddpf);
m_pBackSurface->GetPixelFormat(&ddpf);
switch(ddpf.dwRGBBitCount)
{
case 8:
m_dwPixelFormat = BPP8_PALETTE;
break;

case 16:
if(ddpf.dwRBitMask == 0x7C00/* && ddpf.dwGBitMask == 0x03E0 && ddpf.dwBBitMask == 0x001F*/)
{
m_dwPixelFormat = BPP16_555;
}
else /*if(ddpf.dwRBitMask == 0xF800 && ddpf.dwGBitMask == 0x07E0 && ddpf.dwBBitMask == 0x001F)*/
{
m_dwPixelFormat = BPP16_565;
}
break;

case 24:
if(ddpf.dwRBitMask == 0x00FF0000/* && ddpf.dwGBitMask == 0x0000FF00 && ddpf.dwBBitMask == 0x000000FF*/)
{
m_dwPixelFormat = BPP24_RGB;
}
else /*if(ddpf.dwRBitMask == 0x000000FF && ddpf.dwGBitMask == 0x0000FF00 && ddpf.dwBBitMask == 0x00FF0000)*/
{
m_dwPixelFormat = BPP24_BGR;
}
break;

case 32:
if(ddpf.dwRBitMask == 0x00FF0000/* && ddpf.dwGBitMask == 0x0000FF00 && ddpf.dwBBitMask == 0x000000FF*/)
{
m_dwPixelFormat = BPP32_RGB;
}
else /*if(ddpf.dwRBitMask == 0x000000FF && ddpf.dwGBitMask == 0x0000FF00 && ddpf.dwBBitMask == 0x00FF0000)*/
{
m_dwPixelFormat = BPP32_BGR;
}
break;
}


see DX sdk help: Surface Pixel Format

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!