]> git.saurik.com Git - wxWidgets.git/blame - src/tiff/man/TIFFReadRGBATile.3tiff
Performance optimization
[wxWidgets.git] / src / tiff / man / TIFFReadRGBATile.3tiff
CommitLineData
8414a40c
VZ
1.\" $Id: TIFFReadRGBATile.3tiff,v 1.2 2005/11/02 11:07:18 dron Exp $
2.\"
3.\" Copyright (c) 1991-1997 Sam Leffler
4.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
5.\"
6.\" Permission to use, copy, modify, distribute, and sell this software and
7.\" its documentation for any purpose is hereby granted without fee, provided
8.\" that (i) the above copyright notices and this permission notice appear in
9.\" all copies of the software and related documentation, and (ii) the names of
10.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
11.\" publicity relating to the software without the specific, prior written
12.\" permission of Sam Leffler and Silicon Graphics.
13.\"
14.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
15.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
16.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
17.\"
18.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
19.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
20.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
22.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23.\" OF THIS SOFTWARE.
24.\"
25.if n .po 0
26.TH TIFFReadRGBATile 3TIFF "December 10, 1998" "libtiff"
27.SH NAME
28TIFFReadRGBATile \- read and decode an image tile into a fixed-format raster
29.SH SYNOPSIS
30.B "#include <tiffio.h>"
31.sp
32.B "#define TIFFGetR(abgr) ((abgr) & 0xff)"
33.br
34.B "#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)"
35.br
36.B "#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)"
37.br
38.B "#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)"
39.sp
40.BI "int TIFFReadRGBATile(TIFF *" tif ", uint32 " x ", uint32 " y ", uint32 *" raster ")"
41.SH DESCRIPTION
42.IR TIFFReadRGBATile
43reads a single tile of a tile-based image into memory, storing the result in
44the user supplied RGBA
45.IR raster .
46The raster is assumed to be an array of width times length 32-bit entries,
47where width is the width of a tile (TIFFTAG_TILEWIDTH) and length is the
48height of a tile (TIFFTAG_TILELENGTH).
49
50.PP
51The
52.IR x
53and
54.IR y
55values are the offsets from the top left corner to the top left corner of the
56tile to be read. They must be an exact multiple of the tile width and length.
57
58.PP
59Note that the raster is assume to be organized such that the pixel at location
60(\fIx\fP,\fIy\fP) is \fIraster\fP[\fIy\fP*\fIwidth\fP+\fIx\fP]; with the
61raster origin in the
62.I lower-left hand corner
63of the tile. That is bottom to top organization. Edge tiles which partly fall
64off the image will be filled out with appropriate zeroed areas.
65
66.PP
67Raster pixels are 8-bit packed red, green, blue, alpha samples. The macros
68.IR TIFFGetR ,
69.IR TIFFGetG ,
70.IR TIFFGetB ,
71and
72.I TIFFGetA
73should be used to access individual samples. Images without Associated Alpha
74matting information have a constant Alpha of 1.0 (255).
75.PP
76See the
77.IR TIFFRGBAImage (3TIFF)
78page for more details on how various image types are converted to RGBA values.
79.SH NOTES
80Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must
81be either 1, 3, or 4 (i.e.
82.I SamplesPerPixel
83minus
84.IR ExtraSamples ).
85.PP
86Palette image colormaps that appear to be incorrectly written as 8-bit values
87are automatically scaled to 16-bits.
88.PP
89.I TIFFReadRGBATile
90is just a wrapper around the more general
91.IR TIFFRGBAImage (3TIFF)
92facilities. It's main advantage over the similar
93.IR TIFFReadRGBAImage()
94function is that for large images a single buffer capable of holding the whole
95image doesn't need to be allocated, only enough for one tile. The
96.IR TIFFReadRGBAStrip()
97function does a similar operation for stripped images.
98.SH "RETURN VALUES"
991 is returned if the image was successfully read and converted.
100Otherwise, 0 is returned if an error was encountered.
101.SH DIAGNOSTICS
102All error messages are directed to the
103.IR TIFFError (3TIFF)
104routine.
105.PP
106.BR "Sorry, can not handle %d-bit pictures" .
107The image had
108.I BitsPerSample
109other than 1, 2, 4, 8, or 16.
110.PP
111.BR "Sorry, can not handle %d-channel images" .
112The image had
113.I SamplesPerPixel
114other than 1, 3, or 4.
115.PP
116\fBMissing needed "PhotometricInterpretation" tag\fP.
117The image did not have a tag that describes how to display the data.
118.PP
119\fBNo "PhotometricInterpretation" tag, assuming RGB\fP.
120The image was missing a tag that describes how to display it, but because it
121has 3 or 4 samples/pixel, it is assumed to be
122.SM RGB.
123.PP
124\fBNo "PhotometricInterpretation" tag, assuming min-is-black\fP.
125The image was missing a tag that describes how to display it,
126but because it has 1 sample/pixel, it is assumed to be a grayscale
127or bilevel image.
128.PP
129.BR "No space for photometric conversion table" .
130There was insufficient memory for a table used to convert
131image samples to 8-bit
132.SM RGB.
133.PP
134\fBMissing required "Colormap" tag\fP.
135A Palette image did not have a required
136.I Colormap
137tag.
138.PP
139.BR "No space for tile buffer" .
140There was insufficient memory to allocate an i/o buffer.
141.PP
142.BR "No space for strip buffer" .
143There was insufficient memory to allocate an i/o buffer.
144.PP
145.BR "Can not handle format" .
146The image has a format (combination of
147.IR BitsPerSample ,
148.IR SamplesPerPixel ,
149and
150.IR PhotometricInterpretation )
151that
152.I TIFFReadRGBAImage
153can not handle.
154.PP
155.BR "No space for B&W mapping table" .
156There was insufficient memory to allocate a table used to map
157grayscale data to
158.SM RGB.
159.PP
160.BR "No space for Palette mapping table" .
161There was insufficient memory to allocate a table used to map data to 8-bit
162.SM RGB.
163.SH "SEE ALSO"
164.BR TIFFOpen (3TIFF),
165.BR TIFFRGBAImage (3TIFF),
166.BR TIFFReadRGBAImage (3TIFF),
167.BR TIFFReadRGBAStrip (3TIFF),
168.BR libtiff (3TIFF)
169.PP
170Libtiff library home page:
171.BR http://www.remotesensing.org/libtiff/