Archived

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

Turtlebread

Bitmap filler byte question

Recommended Posts

Turtlebread    124
From what I understand, windows bitmaps have to start on an even line, so if you have an oddly sized bitmap, say 3x3, you will get a filler byte to make the line start evenly. What information will the Infoheader.biSizeImage have? Will it be the size in bytes of the 3x3 bitmap + the filler bytes? Or will it be just the 3x3 size? If its the 3x3 + filler bytes, how do you recommend allocating the memory for the array w\out the filler byte? Thanks, -Chris

Share this post


Link to post
Share on other sites
lshadow    123
The infoheader.biSize will contain the filler bytes.
So you can allocate the memory by taking the width of the bitmap multiplied by the height, multiplied by the bitCount/8. So...

imageSize = bmpInfo.biWidth*bmpInfo.biHeight*(bmpInfo.biBitCount/8)

If you need any more help w/the bitmap feel free to email me.

Lucas

Edited by - lshadow on July 31, 2001 11:32:46 PM

Share this post


Link to post
Share on other sites
Turtlebread    124
Thanks for your help. However, I''ve been reading some other posts on this subject, and I''m more confused than ever. First of all, are bitmaps DWORD-aligned? So if you had a 5x5 bitmap, there would be 3 filler bytes to make the next line start on the next DWORD? If so, then what about the fact that a 24-bit bitmap has three bytes per pixel, so it would be 5*3 = 15 bytes to a line, so only one byte padding is needed? I''m just confusing myself here, so I''m hoping someone can show me what exactly this whole bitmap business is about. Will you ever need to pad more than one byte? Or would you pad a pixel? Argh, I can''t think about it anymore.

Thanks for your help,
-Chris

Share this post


Link to post
Share on other sites