|
BITMAP pitch? |
A J
Member #3,025
December 2002
|
how can i check if the pitch is the same as the width. so there is no padding bytes.. here is what i found on the topic: any code snippet would be nice ___________________________ |
23yrold3yrold
Member #1,134
March 2001
|
... "pitch"? If this is the file format you're talking about, padding just forces the pixel rows to be a multiple of 4. So if the width isn't a multiple of 4 in 8-bit, if it's odd in 16-bit, or the width * 3 isn't a multiple of 4 in 24-bit, then there's padding. 32-bit suffers no problems. -- |
A J
Member #3,025
December 2002
|
can i test this somehow ? maybe a code snippet. here is my effort, which gives incorrect results uint32_t* p1 = &((uint32_t*)map->line[1])[0]; uint32_t* p2 = (uint32_t*)map->dat; p2 += (map->w * 4); if ( p1 != p2 ) padded !
___________________________ |
Krzysztof Kluczek
Member #4,191
January 2004
|
p2 += map->w; EDIT: Made above statement more understandable. ________ |
A J
Member #3,025
December 2002
|
tried that, still doesn't work. ___________________________ |
Krzysztof Kluczek
Member #4,191
January 2004
|
Then maybe: char *p1 = (char *)map->line[0]; char *p2 = (char *)map->line[1]; p1 += 4*map->w; if(p1==p2) do_something(); or if this still doesn't work, you could try casting pointer to int. ________ |
A J
Member #3,025
December 2002
|
uint32_t* p1 = &((uint32_t*)map->line[1])[0]; uint32_t* p2 = &((uint32_t*)map->line[0])[map->w]; when i tested them, they were 32 bytes apart. ___________________________ |
Krzysztof Kluczek
Member #4,191
January 2004
|
Are you sure, that: ________ |
A J
Member #3,025
December 2002
|
i have decided to do it differently. thank you anyway. ___________________________ |
|