xp_comm_proj/ReadGeoTiff/libtiff/tif_getimage.c
/*
 * Get a strip-organized image that has
 *	PlanarConfiguration contiguous if SamplesPerPixel > 1
 * or
 *	SamplesPerPixel == 1
 */
Get a strip-organized image that has
PlanarConfiguration contiguous if SamplesPerPixel > 1
or
SamplesPerPixel == 1
Get a strip - organized image that has PlanarConfiguration contiguous if SamplesPerPixel > 1 or SamplesPerPixel == 1
static int
gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
{
    TIFF* tif = img->tif;
    tileContigRoutine put = img->put.contig;
    uint16 orientation;
    uint32 row, y, nrow;
    unsigned char* buf;
    uint32 rowsperstrip;
    uint32 imagewidth = img->width;
    tsize_t scanline;
    int32 fromskew, toskew;
    buf = (unsigned char*) _TIFFmalloc(TIFFStripSize(tif));
    if (buf == 0) {
	TIFFError(TIFFFileName(tif), "No space for strip buffer");
	return (0);
    }
    y = setorientation(img, h);
    orientation = img->orientation;
    toskew = -(int32) (orientation == ORIENTATION_TOPLEFT ? w+w : w-w);
    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
    scanline = TIFFScanlineSize(tif);
    fromskew = (w < imagewidth ? imagewidth - w : 0);
    for (row = 0; row < h; row += rowsperstrip) {
	nrow = (row + rowsperstrip > h ? h - row : rowsperstrip);
	if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0),
	    buf, nrow*scanline) < 0 && img->stoponerr)
		break;
	(*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, buf);
	y += (orientation == ORIENTATION_TOPLEFT ?
	    -(int32) nrow : (int32) nrow);
    }
    _TIFFfree(buf);
    return (1);
}
static int gtStripContig ( TIFFRGBAImage * img , uint32 * raster , uint32 w , uint32 h ) { TIFF * tif = img -> tif ; tileContigRoutine put = img -> put . contig ; uint16 orientation ; uint32 row , y , nrow ; unsigned char * buf ; uint32 rowsperstrip ; uint32 imagewidth = img -> width ; tsize_t scanline ; int32 fromskew , toskew ; buf = ( unsigned char * ) _TIFFmalloc ( TIFFStripSize ( tif ) ) ; if ( buf == 0 ) { TIFFError ( TIFFFileName ( tif ) , " " ) ; return ( 0 ) ; } y = setorientation ( img , h ) ; orientation = img -> orientation ; toskew = - ( int32 ) ( orientation == ORIENTATION_TOPLEFT ? w + w : w - w ) ; TIFFGetFieldDefaulted ( tif , TIFFTAG_ROWSPERSTRIP , & rowsperstrip ) ; scanline = TIFFScanlineSize ( tif ) ; fromskew = ( w < imagewidth ? imagewidth - w : 0 ) ; for ( row = 0 ; row < h ; row += rowsperstrip ) { nrow = ( row + rowsperstrip > h ? h - row : rowsperstrip ) ; if ( TIFFReadEncodedStrip ( tif , TIFFComputeStrip ( tif , row , 0 ) , buf , nrow * scanline ) < 0 && img -> stoponerr ) break ; ( * put ) ( img , raster + y * w , 0 , y , w , nrow , fromskew , toskew , buf ) ; y += ( orientation == ORIENTATION_TOPLEFT ? - ( int32 ) nrow : ( int32 ) nrow ) ; } _TIFFfree ( buf ) ; return ( 1 ) ; }
Get a strip-organized image that has
      PlanarConfiguration contiguous if SamplesPerPixel > 1
 or
      SamplesPerPixel == 1
Get a strip - organized image that has PlanarConfiguration contiguous if SamplesPerPixel > 1 or SamplesPerPixel == 1