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