]> git.saurik.com Git - wxWidgets.git/blame - src/tiff/man/TIFFRGBAImage.3tiff
Add virtual ~wxAnyScrollHelperBase() to fix compiler warning.
[wxWidgets.git] / src / tiff / man / TIFFRGBAImage.3tiff
CommitLineData
8414a40c
VZ
1.\"
2.\" Copyright (c) 1991-1997 Sam Leffler
3.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
4.\"
5.\" Permission to use, copy, modify, distribute, and sell this software and
6.\" its documentation for any purpose is hereby granted without fee, provided
7.\" that (i) the above copyright notices and this permission notice appear in
8.\" all copies of the software and related documentation, and (ii) the names of
9.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
10.\" publicity relating to the software without the specific, prior written
11.\" permission of Sam Leffler and Silicon Graphics.
12.\"
13.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
14.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
15.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
16.\"
17.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
18.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
21.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22.\" OF THIS SOFTWARE.
23.\"
24.if n .po 0
25.TH TIFFRGBAImage 3TIFF "October 29, 2004" "libtiff"
26.SH NAME
27TIFFRGBAImageOK, TIFFRGBAImageBegin, TIFFRGBAImageGet, TIFFRGBAImageEnd
28\- read and decode an image into a raster
29.SH SYNOPSIS
30.B "#include <tiffio.h>"
31.sp
32.B "typedef unsigned char TIFFRGBValue;"
33.B "typedef struct _TIFFRGBAImage TIFFRGBAImage;"
34.sp
35.BI "int TIFFRGBAImageOK(TIFF *" tif ", char " emsg[1024] ")"
36.br
37.BI "int TIFFRGBAImageBegin(TIFFRGBAImage *" img ", TIFF* " tif ", int " stopOnError ", char " emsg[1024] ")"
38.br
39.BI "int TIFFRGBAImageGet(TIFFRGBAImage *" img ", uint32* " raster ", uint32 " width " , uint32 " height ")"
40.br
41.BI "void TIFFRGBAImageEnd(TIFFRGBAImage *" img ")"
42.br
43.SH DESCRIPTION
44The routines described here provide a high-level interface
45through which
46.SM TIFF
47images may be read into memory.
48Images may be strip- or tile-based and have a variety of different
49characteristics: bits/sample, samples/pixel, photometric, etc.
50Decoding state is encapsulated in a
51.I TIFFRGBAImage
52structure making it possible to capture state for multiple images
53and quickly switch between them.
54The target raster format can be customized to a particular application's
55needs by installing custom routines that manipulate image data
56according to application requirements.
57.PP
58The default usage for these routines is: check if an image can
59be processed using
60.IR TIFFRGBAImageOK ,
61construct a decoder state block using
62.IR TIFFRGBAImageBegin ,
63read and decode an image into a target raster using
64.IR TIFFRGBAImageGet ,
65and then
66release resources using
67.IR TIFFRGBAImageEnd .
68.I TIFFRGBAImageGet
69can be called multiple times to decode an image using different
70state parameters.
71If multiple images are to be displayed and there is not enough
72space for each of the decoded rasters, multiple state blocks can
73be managed and then calls can be made to
74.I TIFFRGBAImageGet
75as needed to display an image.
76.PP
77The generated raster is assumed to be an array of
78.I width
79times
80.I height
8132-bit entries, where
82.I width
83must be less than or equal to the width of the image (\c
84.I height
85may be any non-zero size).
86If the raster dimensions are smaller than the image, the image data
87is cropped to the raster bounds.
88If the raster height is greater than that of the image, then the
89image data are placed in the lower part of the raster.
90(Note that the raster is assume to be organized such that the pixel
91at location (\fIx\fP,\fIy\fP) is \fIraster\fP[\fIy\fP*\fIwidth\fP+\fIx\fP];
92with the raster origin in the
93.B lower-left
94hand corner.)
95.PP
96Raster pixels are 8-bit packed red, green, blue, alpha samples.
97The macros
98.IR TIFFGetR ,
99.IR TIFFGetG ,
100.IR TIFFGetB ,
101and
102.I TIFFGetA
103should be used to access individual samples.
104Images without Associated Alpha matting information have a constant
105Alpha of 1.0 (255).
106.PP
107.I TIFFRGBAImageGet
108converts non-8-bit images by scaling sample values.
109Palette, grayscale, bilevel,
110.SM CMYK\c
111, and YCbCr images are converted to
112.SM RGB
113transparently.
114Raster pixels are returned uncorrected by any colorimetry information
115present in the directory.
116.PP
117The parameter
118.I stopOnError
119specifies how to act if an error is encountered while reading
120the image.
121If
122.I stopOnError
123is non-zero, then an error will terminate the operation; otherwise
124.I TIFFRGBAImageGet
125will continue processing data until all the possible data in the
126image have been requested.
127.SH "ALTERNATE RASTER FORMATS"
128To use the core support for reading and processing
129.SM TIFF
130images, but write the resulting raster data in a different format
131one need only override the ``\fIput methods\fP'' used to store raster data.
132These methods are are defined in the
133.I TIFFRGBAImage
134structure and initially setup by
135.I TIFFRGBAImageBegin
136to point to routines that pack raster data in the default
137.SM ABGR
138pixel format.
139Two different routines are used according to the physical organization
140of the image data in the file:
141.IR PlanarConfiguration =1
142(packed samples),
143and
144.IR PlanarConfiguration =2
145(separated samples).
146Note that this mechanism can be used to transform the data before
147storing it in the raster.
148For example one can convert data
149to colormap indices for display on a colormap display.
150.SH "SIMULTANEOUS RASTER STORE AND DISPLAY"
151It is simple to display an image as it is being read into memory
152by overriding the put methods as described above for supporting
153alternate raster formats.
154Simply keep a reference to the default put methods setup by
155.I TIFFRGBAImageBegin
156and then invoke them before or after each display operation.
157For example, the
158.IR tiffgt (1)
159utility uses the following put method to update the display as
160the raster is being filled:
161.sp
162.nf
163.ft C
164static void
165putContigAndDraw(TIFFRGBAImage* img, uint32* raster,
166 uint32 x, uint32 y, uint32 w, uint32 h,
167 int32 fromskew, int32 toskew,
168 unsigned char* cp)
169{
170 (*putContig)(img, raster, x, y, w, h, fromskew, toskew, cp);
171 if (x+w == width) {
172 w = width;
173 if (img->orientation == ORIENTATION_TOPLEFT)
174 lrectwrite(0, y-(h-1), w-1, y, raster-x-(h-1)*w);
175 else
176 lrectwrite(0, y, w-1, y+h-1, raster);
177 }
178}
179.ft R
180.fi
181.sp
182(the original routine provided by the library is saved in the
183variable
184.IR putContig .)
185.SH "SUPPORTING ADDITIONAL TIFF FORMATS"
186The
187.I TIFFRGBAImage
188routines support the most commonly encountered flavors of
189.SM TIFF.
190It is possible to extend this support by overriding the ``\fIget method\fP''
191invoked by
192.I TIFFRGBAImageGet
193to read
194.SM TIFF
195image data.
196Details of doing this are a bit involved, it is best to make a copy
197of an existing get method and modify it to suit the needs of an
198application.
199.SH NOTES
200Samples must be either 1, 2, 4, 8, or 16 bits.
201Colorimetric samples/pixel must be either 1, 3, or 4 (i.e.
202.I SamplesPerPixel
203minus
204.IR ExtraSamples ).
205.PP
206Palette image colormaps that appear to be incorrectly written
207as 8-bit values are automatically scaled to 16-bits.
208.SH "RETURN VALUES"
209All routines return
2101 if the operation was successful.
211Otherwise, 0 is returned if an error was encountered and
212.I stopOnError
213is zero.
214.SH DIAGNOSTICS
215All error messages are directed to the
216.IR TIFFError (3TIFF)
217routine.
218.PP
219.BR "Sorry, can not handle %d-bit pictures" .
220The image had
221.I BitsPerSample
222other than 1, 2, 4, 8, or 16.
223.PP
224.BR "Sorry, can not handle %d-channel images" .
225The image had
226.I SamplesPerPixel
227other than 1, 3, or 4.
228.PP
229\fBMissing needed "PhotometricInterpretation" tag\fP.
230The image did not have a tag that describes how to display
231the data.
232.PP
233\fBNo "PhotometricInterpretation" tag, assuming RGB\fP.
234The image was missing a tag that describes how to display it,
235but because it has 3 or 4 samples/pixel, it is assumed to be
236.SM RGB.
237.PP
238\fBNo "PhotometricInterpretation" tag, assuming min-is-black\fP.
239The image was missing a tag that describes how to display it,
240but because it has 1 sample/pixel, it is assumed to be a grayscale
241or bilevel image.
242.PP
243.BR "No space for photometric conversion table" .
244There was insufficient memory for a table used to convert
245image samples to 8-bit
246.SM RGB.
247.PP
248\fBMissing required "Colormap" tag\fP.
249A Palette image did not have a required
250.I Colormap
251tag.
252.PP
253.BR "No space for tile buffer" .
254There was insufficient memory to allocate an i/o buffer.
255.PP
256.BR "No space for strip buffer" .
257There was insufficient memory to allocate an i/o buffer.
258.PP
259.BR "Can not handle format" .
260The image has a format (combination of
261.IR BitsPerSample ,
262.IR SamplesPerPixel ,
263and
264.IR PhotometricInterpretation )
265that can not be handled.
266.PP
267.BR "No space for B&W mapping table" .
268There was insufficient memory to allocate a table used to map
269grayscale data to
270.SM RGB.
271.PP
272.BR "No space for Palette mapping table" .
273There was insufficient memory to allocate a table used to map
274data to 8-bit
275.SM RGB.
276.SH "SEE ALSO"
277.BR TIFFOpen (3TIFF),
278.BR TIFFReadRGBAImage (3TIFF),
279.BR TIFFReadRGBAImageOriented (3TIFF),
280.BR TIFFReadRGBAStrip (3TIFF),
281.BR TIFFReadRGBATile (3TIFF),
282.BR libtiff (3TIFF)
283.PP
284Libtiff library home page:
285.BR http://www.remotesensing.org/libtiff/