Hi Pete,
Thanks for your reply, but I don't quite understand the calculation.
I realise that the 8bpp played some part in the calculation, but in your
WIDTHBYES macro, what does the "L" refer to? Would I be able to use that
calculation for both 1bpp and 8bpp?
How does it work out that for a 75 pixel wide bitmap, rowBytes is 10 for
1bpp, and 76 for 8bpp?
Thanks,
Trung



From: GreatOwlS
Date: Tue, 13 Jun 2000 10:35:15 

Each bitmap row is probably aligned to a 32-bit boundary (don't know for
sure 
as I've never looked into it, but its not unreasonable).  Your results are 
consistent with bitmap depths at various bits-per-pixel (in your case, 1bpp 
when < OS3.5 and 8bpp when OS3.5).

The calculation for rowsize that you should be using is something like

//Calculate DWORD-aligned bytecount based on a bitcount.
#define WIDTHBYTES(bits)        (((bits) + 31L) / 32L * 4)

//Calculate DWORD-aligned bytecount based on pixel count and bitcount per 
pixel.
#define ROWBYTES(cx, bpp)   WIDTHBYTES(cx * bpp)


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to