2006.04.13 19:53 "RE: [Tiff] LibTiffDelphi problem with WriteEncodedStrip Newbee", by
> -----Original Message-----
> From: email@example.com
> [mailto:firstname.lastname@example.org]On Behalf Of Thorsten
Thank you for your code, but it didn't work, and I can't figure out, what wents wrong. I tried to understand your code, but there are still some questions... Maybe you can help me
RowSize:=((Bitmap.Width+7) div 8);
Why did you add 7 here? To get a multiple of 8?
Yes, this (IMO) is a classic "deep" programming technique (the actual language is unimportant) -- when dividing by integers, fractional parts are generally dropped (instead of being rounded like fractionals). In order to promote any fractional part to the next integer, you add one-less-than-the-divisor before dividing.
This trick is typically used to make sure that a target buffer has *at least* enough space, instead of 1 unit too few. Extra "unused" bits are usually set to zero (to keep things "cleaner").
Sorry if I'm over-explaining something that's already clear, but I prefer to avoid the possibility of holes being filled by guesses.