AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
April 2006

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2006.04.06 19:40 "LibTiffDelphi problem with WriteEncodedStrip Newbee", by Thorsten Hagelstein
2006.04.07 09:56 "Re: LibTiffDelphi problem with WriteEncodedStrip Newbee", by Joris Van Damme
2006.04.11 16:43 "Re: LibTiffDelphi problem with WriteEncodedStrip Newbee", by Thorsten Hagelstein
2006.04.11 22:07 "Re: LibTiffDelphi problem with WriteEncodedStrip Newbee", by Joris Van Damme
2006.04.13 15:02 "Re: LibTiffDelphi problem with WriteEncodedStrip Newbee", by Thorsten Hagelstein
2006.04.13 19:53 "Re: LibTiffDelphi problem with WriteEncodedStrip Newbee", by Bernie Pallek
2006.04.14 17:02 "Re: LibTiffDelphi problem with WriteEncodedStrip Newbee", by Joris Van Damme
2006.04.15 10:46 "Re: LibTiffDelphi problem with WriteEncodedStrip Newbee", by Joris Van Damme
2006.04.18 09:22 "Re: LibTiffDelphi problem with WriteEncodedStrip Newbee", by Thorsten Hagelstein

2006.04.13 19:53 "Re: LibTiffDelphi problem with WriteEncodedStrip Newbee", by Bernie Pallek

> >   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.