Jump to content
  • Advertisement

Archived

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

Merwin van Dijk

RGBQUAD/PALETTEENTRY

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

Hello, I am trying to make my own CBmp class which can load a 8-bit bmp-file, draw it in the screen and give the palette from the bmp-file to a LPDIRETDRAWPALETTE interface. I''ve seen a similar class in which the palette is loaded first to an array (m_rgbPalette) of the structure RGBQUAD. if(OK)OK=ReadFile(hfile,m_rgbPalette,sizeof(m_rgbPalette), &actualRead,NULL); If the palette must be set to a LPDIRETDRAWPALETTE interface, the RGBQUAD structure must be converted to a PALLETTEENTRY structure. BOOL CBmpFileReader::setpalette(LPDIRECTDRAWPALETTE palette){ PALETTEENTRY pe[COLORS]; //intermediate palette //construct pe[] for(int i=0; i.peRed=m_rgbPalette[i].rgbRed; //set red pe[i].peGreen=m_rgbPalette[i].rgbGreen; //set green pe[i].peBlue=m_rgbPalette[i].rgbBlue; //set blue } //load direct draw palette to surface palette->SetEntries(NULL,0,COLORS,pe); return TRUE; } My question is; ''Why don''t they load the palette of the bmp-file directly to a PALETTEENTRY structure?''. PS: The source is from a book called ''Learn computer game programming with direct 7.0''.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
because a RGBQUAD is a struct with 4 values... and in BMP files it''s BGR.... so you read BGR and you fill the RGBQUAD with RGB that all

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!