Re: BMP Pixel array
- From: Tim Roberts <timr@xxxxxxxxx>
- Date: Sun, 22 May 2005 22:34:14 -0700
"james" <james@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>I don't know if this is the right place to show my question.
>I can't understand why, in the BMP array after the headers, i find some zero
>that aren't in the real BMP image. This zero are at the end of a single pixel
>row. Sometime i find three zeros. I've seen, in a web page, that if a row
>ins't a multiple of 4 it need to add one, two or three zeros to reach this
>multiple of 4.
That's a multiple of 4 bytes. The units are important.
>I've tried to understand it but with no positive result.
>Somebody can explain me how this work? If you know a code about it better.
Here's an example. Say you have a 4-bit DIB in a bitmap, 6 pixels wide by
6 pixels high, filled with solid bright red. Bright red in a 4-bit DIB is
color index C. 6 pixels in a 4-bit DIB takes 3 bytes: CC CC CC. However,
as you have read, lines in a DIB have to be a multiple of four bytes. So,
the bytes in the DIB will look like:
CC CC CC 00
CC CC CC 00
CC CC CC 00
CC CC CC 00
CC CC CC 00
CC CC CC 00
Everyone that uses the DIB will know that they are supposed to ignore that
extra byte, because the rules say so.
--
- Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc
.
- References:
- BMP Pixel array
- From: james
- BMP Pixel array
- Prev by Date: Re: Making DLLs
- Next by Date: Re: suppressing a warning related to size_t
- Previous by thread: Re: BMP Pixel array
- Next by thread: suppressing a warning related to size_t
- Index(es):
Relevant Pages
|
Loading