xp_comm_proj/ReadGeoTiff/libtiff/tif_getimage.c
/*
 * Get an tile-organized image that has
 *	PlanarConfiguration contiguous if SamplesPerPixel > 1
 * or
 *	SamplesPerPixel == 1
 */
Get an tile-organized image that has
PlanarConfiguration contiguous if SamplesPerPixel > 1
or
SamplesPerPixel == 1
Get an tile - organized image that has PlanarConfiguration contiguous if SamplesPerPixel > 1 or SamplesPerPixel == 1
static int
gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
{
    TIFF* tif = img->tif;
    tileContigRoutine put = img->put.contig;
    uint16 orientation;
    uint32 col, row, y;
    uint32 tw, th;
    unsigned char* buf;
    int32 fromskew, toskew;
    uint32 nrow;
    buf = (unsigned char*) _TIFFmalloc(TIFFTileSize(tif));
    if (buf == 0) {
	TIFFError(TIFFFileName(tif), "No space for tile buffer");
	return (0);
    }
    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
    y = setorientation(img, h);
    orientation = img->orientation;
    toskew = -(int32) (orientation == ORIENTATION_TOPLEFT ? tw+w : tw-w);
    for (row = 0; row < h; row += th) {
	nrow = (row + th > h ? h - row : th);
	for (col = 0; col < w; col += tw) {
	    if (TIFFReadTile(tif, buf, col, row, 0, 0) < 0 && img->stoponerr)
		break;
	    if (col + tw > w) {
		uint32 npix = w - col;
		fromskew = tw - npix;
		(*put)(img, raster+y*w+col, col, y,
		    npix, nrow, fromskew, toskew + fromskew, buf);
	    } else {
		(*put)(img, raster+y*w+col, col, y, tw, nrow, 0, toskew, buf);
	    }
	}
	y += (orientation == ORIENTATION_TOPLEFT ?
	    -(int32) nrow : (int32) nrow);
    }
    _TIFFfree(buf);
    return (1);
}
static int gtTileContig ( TIFFRGBAImage * img , uint32 * raster , uint32 w , uint32 h ) { TIFF * tif = img -> tif ; tileContigRoutine put = img -> put . contig ; uint16 orientation ; uint32 col , row , y ; uint32 tw , th ; unsigned char * buf ; int32 fromskew , toskew ; uint32 nrow ; buf = ( unsigned char * ) _TIFFmalloc ( TIFFTileSize ( tif ) ) ; if ( buf == 0 ) { TIFFError ( TIFFFileName ( tif ) , " " ) ; return ( 0 ) ; } TIFFGetField ( tif , TIFFTAG_TILEWIDTH , & tw ) ; TIFFGetField ( tif , TIFFTAG_TILELENGTH , & th ) ; y = setorientation ( img , h ) ; orientation = img -> orientation ; toskew = - ( int32 ) ( orientation == ORIENTATION_TOPLEFT ? tw + w : tw - w ) ; for ( row = 0 ; row < h ; row += th ) { nrow = ( row + th > h ? h - row : th ) ; for ( col = 0 ; col < w ; col += tw ) { if ( TIFFReadTile ( tif , buf , col , row , 0 , 0 ) < 0 && img -> stoponerr ) break ; if ( col + tw > w ) { uint32 npix = w - col ; fromskew = tw - npix ; ( * put ) ( img , raster + y * w + col , col , y , npix , nrow , fromskew , toskew + fromskew , buf ) ; } else { ( * put ) ( img , raster + y * w + col , col , y , tw , nrow , 0 , toskew , buf ) ; } } y += ( orientation == ORIENTATION_TOPLEFT ? - ( int32 ) nrow : ( int32 ) nrow ) ; } _TIFFfree ( buf ) ; return ( 1 ) ; }
Get an tile-organized image that has
      PlanarConfiguration contiguous if SamplesPerPixel > 1
 or
      SamplesPerPixel == 1
Get an tile - organized image that has PlanarConfiguration contiguous if SamplesPerPixel > 1 or SamplesPerPixel == 1
/*
		 * Tile is clipped horizontally.  Calculate
		 * visible portion and skewing factors.
		 */