Click to See Complete Forum and Search --> : Scanlines in a bitmap


leechat2001
May 31st, 2004, 03:04 AM
Does anybody have the concept of scanlines in a bitmap.
Sometimes GDI can split the bitmap into scanlines and give each
scanline seperately...! Is it possible...?
In what situations does GDI really behaves that way...!
Why doesnot it directly give a Bitmap instead of giving scanlines one by one...!


thanks a lot
leechat2001

Electroman
June 2nd, 2004, 06:52 PM
Basically the scan line in a Bitmap must be to a whole number of 4byte blocks.
So say you have a bitmap that is 10pixels wide, and at a bit depth of 24bit: this gives us 30 bytes for each line, however 30 / 4 is 7.5 so we must round this up to 32 bytes. The extra 2bytes should just hold zero.

So you can use this to find out the scanline: ScanLine = RoundUp((Width*BytesPerPixel) / 4) * 4;