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
November 2003

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

2003.11.06 04:30 "TIFFRawStripSize function", by Chris Hanson
2003.11.07 11:30 "TIFFRawStripSize function", by Andrey Kiselev

2003.11.06 04:30 "TIFFRawStripSize function", by Chris Hanson

As part of what I'm working on, I needed a function to get the size in 
bytes of a raw strip.  I figure that others would find this useful too, 
so I'm contributing it.  I've appended a couple context diffs from the 
latest CVS, of the libtiff/tiffio.h and libtiff/tif_strip.c files.

   -- Chris

-- 
Chris Hanson, bDistributed.com, Inc.  |  Email: cmh@bDistributed.com
Outsourcing Vendor Evaluation         |  Phone: +1-847-372-3955
Custom Mac OS X Development           |  Fax:   +1-847-589-3738
http://bdistributed.com/              |  Personal Email: cmh@mac.com


Index: libtiff/tiffio.h
===================================================================
RCS file: /cvsroot/osrs/libtiff/libtiff/tiffio.h,v
retrieving revision 1.17
diff -c -r1.17 tiffio.h
*** libtiff/tiffio.h    7 Oct 2003 06:19:21 -0000       1.17
--- libtiff/tiffio.h    6 Nov 2003 04:28:43 -0000
***************
*** 244,249 ****
--- 244,250 ----
   extern        tsize_t TIFFScanlineSize(TIFF*);
   extern        tsize_t TIFFRasterScanlineSize(TIFF*);
   extern        tsize_t TIFFStripSize(TIFF*);
+ extern        tsize_t TIFFRawStripSize(TIFF* tif, tstrip_t strip);
   extern        tsize_t TIFFVStripSize(TIFF*, uint32);
   extern        tsize_t TIFFTileRowSize(TIFF*);
   extern        tsize_t TIFFTileSize(TIFF*);
Index: libtiff/tif_strip.c
===================================================================
RCS file: /cvsroot/osrs/libtiff/libtiff/tif_strip.c,v
retrieving revision 1.2
diff -c -r1.2 tif_strip.c
*** libtiff/tif_strip.c 31 Jul 2002 21:05:57 -0000      1.2
--- libtiff/tif_strip.c 6 Nov 2003 04:28:43 -0000
***************
*** 112,117 ****
--- 112,136 ----
   }

   /*
+  * Compute the # bytes in a raw strip.
+  */
+ tsize_t
+ TIFFRawStripSize(TIFF* tif, tstrip_t strip)
+ {
+     TIFFDirectory* td = &tif->tif_dir;
+     tsize_t bytecount = td->td_stripbytecount[strip];
+
+     if (bytecount <= 0) {
+         TIFFError(tif->tif_name,
+                   "%lu: Invalid strip byte count, strip %lu",
+                   (u_long) bytecount, (u_long) strip);
+         bytecount = (tsize_t) -1;
+     }
+
+     return bytecount;
+ }
+
+ /*
    * Compute the # bytes in a (row-aligned) strip.
    *
    * Note that if RowsPerStrip is larger than the