Jump to content
  • Advertisement
Sign in to follow this  
tadobie

BITMAPINFOHEADER

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

Can someone explain how to retrieve the biWidth and biHeight from the BITMAPINFOHEADER? I wont to check the width and height of a Bitmap before I load it into a surface. Does the BITMAPINFOHEADER allow me to do this? If so, how can I get this info armed only with a string that represents the pathname of the bitmap in question?

Share this post


Link to post
Share on other sites
Advertisement
load in the bmp file, what you need also is this structure 'BITMAPFILEHEADER', this comes first in bmp files then you have the information header. So open the file and read the 2 structures from it, then just look up the values in them.

something like

BITMAPFILEHEADER fileheader;
BITMAPINFOHEADER infoHeader;

fp = fopen("myBitmapFileHere.bmp", "rb");

if (fp == NULL) return; // file not opened

fread(&fileheader, sizeof(BITMAPFILEHEADER), 1, fp);
fread(&infoHeader, sizeof(BITMAPINFOHEADER), 1, fp);


after that just lookup the structures values

Hope that helped

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!