#### Archived

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

# more bitmap stuff

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

## Recommended Posts

Hi. In a book, it give an example on loading bitmaps in. Theres a part where it finds out the size of the image data (if no size is specified). Here''s basicly what its doing: (biWidth * biBitCount + 7) / 8 * abs(biHeight) I need to know two things here: What is this doing? I mean, where did the 7 and the 8 come from? and What the function abs(int) (in stdlib.h) does? thx, -J

##### Share on other sites
Well i don''t know what the 7 and 8 are but the abs() is absolute value I believe.

What was it when I was in is now no longer that so I am out...

##### Share on other sites
um.. what does it do/mean?

##### Share on other sites
Absolute value makes the number positive. Since the height of a bitmap can be negative (specifying a different format for the bitmap) this code is making sure that it is not returning a negative size.

My guess for what it is doing is this:

biWidth * biBitCount : bits per line
+ 7 : add 7 more bits for alignment
/ 8 : number of bytes per line
* abs(biHeight) : times number of lines

So, if you had a 1x1 monochrome bitmap it would look like this:

(1 * 1 + 7) / 8 * abs(1) = (8 / 8) * 1 = 1, or 1 byte of memory used.

I will not make a list of links... I will not make a list of links... I will not make a list of links...

1. 1
Rutin
54
2. 2
3. 3
4. 4
5. 5

• 10
• 28
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633412
• Total Posts
3011736
• ### Who's Online (See full list)

There are no registered users currently online

×