Blame man/TIFFReadRGBATile.3tiff

Packit 85355f
.\" $Id: TIFFReadRGBATile.3tiff,v 1.3 2016-09-25 20:05:50 bfriesen Exp $
Packit 85355f
.\"
Packit 85355f
.\" Copyright (c) 1991-1997 Sam Leffler
Packit 85355f
.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
Packit 85355f
.\"
Packit 85355f
.\" Permission to use, copy, modify, distribute, and sell this software and 
Packit 85355f
.\" its documentation for any purpose is hereby granted without fee, provided
Packit 85355f
.\" that (i) the above copyright notices and this permission notice appear in
Packit 85355f
.\" all copies of the software and related documentation, and (ii) the names of
Packit 85355f
.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
Packit 85355f
.\" publicity relating to the software without the specific, prior written
Packit 85355f
.\" permission of Sam Leffler and Silicon Graphics.
Packit 85355f
.\" 
Packit 85355f
.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
Packit 85355f
.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
Packit 85355f
.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
Packit 85355f
.\" 
Packit 85355f
.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
Packit 85355f
.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
Packit 85355f
.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
Packit 85355f
.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
Packit 85355f
.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
Packit 85355f
.\" OF THIS SOFTWARE.
Packit 85355f
.\"
Packit 85355f
.if n .po 0
Packit 85355f
.TH TIFFReadRGBATile 3TIFF "December 10, 1998" "libtiff"
Packit 85355f
.SH NAME
Packit 85355f
TIFFReadRGBATile \- read and decode an image tile into a fixed-format raster
Packit 85355f
.SH SYNOPSIS
Packit 85355f
.B "#include <tiffio.h>"
Packit 85355f
.sp
Packit 85355f
.B "#define TIFFGetR(abgr)	((abgr) & 0xff)"
Packit 85355f
.br
Packit 85355f
.B "#define TIFFGetG(abgr)	(((abgr) >> 8) & 0xff)"
Packit 85355f
.br
Packit 85355f
.B "#define TIFFGetB(abgr)	(((abgr) >> 16) & 0xff)"
Packit 85355f
.br
Packit 85355f
.B "#define TIFFGetA(abgr)	(((abgr) >> 24) & 0xff)"
Packit 85355f
.sp
Packit 85355f
.BI "int TIFFReadRGBATile(TIFF *" tif ", uint32 " x ", uint32 " y ", uint32 *" raster ")"
Packit 85355f
.SH DESCRIPTION
Packit 85355f
.IR TIFFReadRGBATile
Packit 85355f
reads a single tile of a tile-based image into memory, storing the result in
Packit 85355f
the user supplied RGBA
Packit 85355f
.IR raster .
Packit 85355f
The raster is assumed to be an array of width times length 32-bit entries,
Packit 85355f
where width is the width of a tile (TIFFTAG_TILEWIDTH) and length is the
Packit 85355f
height of a tile (TIFFTAG_TILELENGTH). 
Packit 85355f
Packit 85355f
.PP
Packit 85355f
The 
Packit 85355f
.IR x
Packit 85355f
and 
Packit 85355f
.IR y
Packit 85355f
values are the offsets from the top left corner to the top left corner of the
Packit 85355f
tile to be read.  They must be an exact multiple of the tile width and length. 
Packit 85355f
Packit 85355f
.PP
Packit 85355f
Note that the raster is assume to be organized such that the pixel at location
Packit 85355f
(\fIx\fP,\fIy\fP) is \fIraster\fP[\fIy\fP*\fIwidth\fP+\fIx\fP]; with the
Packit 85355f
raster origin in the 
Packit 85355f
.I lower-left hand corner
Packit 85355f
of the tile. That is bottom to top organization.  Edge tiles which partly fall
Packit 85355f
off the image will be filled out with appropriate zeroed areas.
Packit 85355f
Packit 85355f
.PP
Packit 85355f
Raster pixels are 8-bit packed red, green, blue, alpha samples. The macros
Packit 85355f
.IR TIFFGetR ,
Packit 85355f
.IR TIFFGetG ,
Packit 85355f
.IR TIFFGetB ,
Packit 85355f
and
Packit 85355f
.I TIFFGetA
Packit 85355f
should be used to access individual samples. Images without Associated Alpha
Packit 85355f
matting information have a constant Alpha of 1.0 (255).
Packit 85355f
.PP
Packit 85355f
See the 
Packit 85355f
.IR TIFFRGBAImage (3TIFF) 
Packit 85355f
page for more details on how various image types are converted to RGBA values.
Packit 85355f
.SH NOTES
Packit 85355f
Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must
Packit 85355f
be either 1, 3, or 4 (i.e.
Packit 85355f
.I SamplesPerPixel
Packit 85355f
minus
Packit 85355f
.IR ExtraSamples ).
Packit 85355f
.PP
Packit 85355f
Palette image colormaps that appear to be incorrectly written as 8-bit values
Packit 85355f
are automatically scaled to 16-bits.
Packit 85355f
.PP
Packit 85355f
.I TIFFReadRGBATile
Packit 85355f
is just a wrapper around the more general
Packit 85355f
.IR TIFFRGBAImage (3TIFF)
Packit 85355f
facilities.  It's main advantage over the similar 
Packit 85355f
.IR TIFFReadRGBAImage() 
Packit 85355f
function is that for large images a single buffer capable of holding the whole
Packit 85355f
image doesn't need to be allocated, only enough for one tile.  The 
Packit 85355f
.IR TIFFReadRGBAStrip() 
Packit 85355f
function does a similar operation for stripped images.
Packit 85355f
.SH "RETURN VALUES"
Packit 85355f
1 is returned if the image was successfully read and converted.
Packit 85355f
Otherwise, 0 is returned if an error was encountered.
Packit 85355f
.SH DIAGNOSTICS
Packit 85355f
All error messages are directed to the
Packit 85355f
.IR TIFFError (3TIFF)
Packit 85355f
routine.
Packit 85355f
.PP
Packit 85355f
.BR "Sorry, can not handle %d-bit pictures" .
Packit 85355f
The image had
Packit 85355f
.I BitsPerSample
Packit 85355f
other than 1, 2, 4, 8, or 16.
Packit 85355f
.PP
Packit 85355f
.BR "Sorry, can not handle %d-channel images" .
Packit 85355f
The image had
Packit 85355f
.I SamplesPerPixel
Packit 85355f
other than 1, 3, or 4.
Packit 85355f
.PP
Packit 85355f
\fBMissing needed "PhotometricInterpretation" tag\fP.
Packit 85355f
The image did not have a tag that describes how to display the data.
Packit 85355f
.PP
Packit 85355f
\fBNo "PhotometricInterpretation" tag, assuming RGB\fP.
Packit 85355f
The image was missing a tag that describes how to display it, but because it
Packit 85355f
has 3 or 4 samples/pixel, it is assumed to be
Packit 85355f
.SM RGB.
Packit 85355f
.PP
Packit 85355f
\fBNo "PhotometricInterpretation" tag, assuming min-is-black\fP.
Packit 85355f
The image was missing a tag that describes how to display it,
Packit 85355f
but because it has 1 sample/pixel, it is assumed to be a grayscale
Packit 85355f
or bilevel image.
Packit 85355f
.PP
Packit 85355f
.BR "No space for photometric conversion table" .
Packit 85355f
There was insufficient memory for a table used to convert
Packit 85355f
image samples to 8-bit
Packit 85355f
.SM RGB.
Packit 85355f
.PP
Packit 85355f
\fBMissing required "Colormap" tag\fP.
Packit 85355f
A Palette image did not have a required
Packit 85355f
.I Colormap
Packit 85355f
tag.
Packit 85355f
.PP
Packit 85355f
.BR "No space for tile buffer" .
Packit 85355f
There was insufficient memory to allocate an i/o buffer.
Packit 85355f
.PP
Packit 85355f
.BR "No space for strip buffer" .
Packit 85355f
There was insufficient memory to allocate an i/o buffer.
Packit 85355f
.PP
Packit 85355f
.BR "Can not handle format" .
Packit 85355f
The image has a format (combination of
Packit 85355f
.IR BitsPerSample ,
Packit 85355f
.IR SamplesPerPixel ,
Packit 85355f
and
Packit 85355f
.IR PhotometricInterpretation )
Packit 85355f
that
Packit 85355f
.I TIFFReadRGBAImage
Packit 85355f
can not handle.
Packit 85355f
.PP
Packit 85355f
.BR "No space for B&W mapping table" .
Packit 85355f
There was insufficient memory to allocate a table used to map
Packit 85355f
grayscale data to
Packit 85355f
.SM RGB.
Packit 85355f
.PP
Packit 85355f
.BR "No space for Palette mapping table" .
Packit 85355f
There was insufficient memory to allocate a table used to map data to 8-bit
Packit 85355f
.SM RGB.
Packit 85355f
.SH "SEE ALSO"
Packit 85355f
.BR TIFFOpen (3TIFF),
Packit 85355f
.BR TIFFRGBAImage (3TIFF),
Packit 85355f
.BR TIFFReadRGBAImage (3TIFF),
Packit 85355f
.BR TIFFReadRGBAStrip (3TIFF),
Packit 85355f
.BR libtiff (3TIFF)
Packit 85355f
.PP
Packit 85355f
Libtiff library home page:
Packit 85355f
.BR http://www.simplesystems.org/libtiff/