3 Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are
11 * Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer.
13 * Redistributions in binary form must reproduce the above
14 copyright notice, this list of conditions and the following disclaimer
15 in the documentation and/or other materials provided with the
17 * Neither the name of Industrial Light & Magic nor the names of
18 its contributors may be used to endorse or promote products derived
19 from this software without specific prior written permission.
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #ifndef INCLUDED_IMF_C_RGBA_FILE_H
36 #define INCLUDED_IMF_C_RGBA_FILE_H
46 ** Interpreting unsigned shorts as 16-bit floating point numbers
49 typedef unsigned short ImfHalf;
51 void ImfFloatToHalf (float f,
54 void ImfFloatToHalfArray (int n,
58 float ImfHalfToFloat (ImfHalf h);
60 void ImfHalfToFloatArray (int n,
61 const ImfHalf h[/*n*/],
65 ** RGBA pixel; memory layout must be the same as struct Imf::Rgba.
76 typedef struct ImfRgba ImfRgba;
79 ** Magic number; this must be the same as Imf::MAGIC
82 #define IMF_MAGIC 20000630
85 ** Version number; this must be the same as Imf::EXR_VERSION
88 #define IMF_VERSION_NUMBER 2
91 ** Line order; values must the the same as in Imf::LineOrder.
94 #define IMF_INCREASING_Y 0
95 #define IMF_DECREASING_Y 1
96 #define IMF_RAMDOM_Y 2
100 ** Compression types; values must be the same as in Imf::Compression.
103 #define IMF_NO_COMPRESSION 0
104 #define IMF_RLE_COMPRESSION 1
105 #define IMF_ZIPS_COMPRESSION 2
106 #define IMF_ZIP_COMPRESSION 3
107 #define IMF_PIZ_COMPRESSION 4
108 #define IMF_PXR24_COMPRESSION 5
112 ** Channels; values must be the same as in Imf::RgbaChannels.
115 #define IMF_WRITE_R 0x01
116 #define IMF_WRITE_G 0x02
117 #define IMF_WRITE_B 0x04
118 #define IMF_WRITE_A 0x08
119 #define IMF_WRITE_Y 0x10
120 #define IMF_WRITE_C 0x20
121 #define IMF_WRITE_RGB 0x07
122 #define IMF_WRITE_RGBA 0x0f
123 #define IMF_WRITE_YC 0x30
124 #define IMF_WRITE_YA 0x18
125 #define IMF_WRITE_YCA 0x38
129 ** Level modes; values must be the same as in Imf::LevelMode
132 #define IMF_ONE_LEVEL 0
133 #define IMF_MIPMAP_LEVELS 1
134 #define IMF_RIPMAP_LEVELS 2
138 ** Level rounding modes; values must be the same as in Imf::LevelRoundingMode
141 #define IMF_ROUND_DOWN 0
142 #define IMF_ROUND_UP 1
150 typedef struct ImfHeader ImfHeader;
152 ImfHeader * ImfNewHeader (void);
154 void ImfDeleteHeader (ImfHeader *hdr);
156 ImfHeader * ImfCopyHeader (const ImfHeader *hdr);
158 void ImfHeaderSetDisplayWindow (ImfHeader *hdr,
162 void ImfHeaderDisplayWindow (const ImfHeader *hdr,
163 int *xMin, int *yMin,
164 int *xMax, int *yMax);
166 void ImfHeaderSetDataWindow (ImfHeader *hdr,
170 void ImfHeaderDataWindow (const ImfHeader *hdr,
171 int *xMin, int *yMin,
172 int *xMax, int *yMax);
174 void ImfHeaderSetPixelAspectRatio (ImfHeader *hdr,
175 float pixelAspectRatio);
177 float ImfHeaderPixelAspectRatio (const ImfHeader *hdr);
179 void ImfHeaderSetScreenWindowCenter (ImfHeader *hdr,
182 void ImfHeaderScreenWindowCenter (const ImfHeader *hdr,
185 void ImfHeaderSetScreenWindowWidth (ImfHeader *hdr,
188 float ImfHeaderScreenWindowWidth (const ImfHeader *hdr);
190 void ImfHeaderSetLineOrder (ImfHeader *hdr,
193 int ImfHeaderLineOrder (const ImfHeader *hdr);
195 void ImfHeaderSetCompression (ImfHeader *hdr,
198 int ImfHeaderCompression (const ImfHeader *hdr);
200 int ImfHeaderSetIntAttribute (ImfHeader *hdr,
204 int ImfHeaderIntAttribute (const ImfHeader *hdr,
208 int ImfHeaderSetFloatAttribute (ImfHeader *hdr,
212 int ImfHeaderSetDoubleAttribute (ImfHeader *hdr,
216 int ImfHeaderFloatAttribute (const ImfHeader *hdr,
220 int ImfHeaderDoubleAttribute (const ImfHeader *hdr,
224 int ImfHeaderSetStringAttribute (ImfHeader *hdr,
228 int ImfHeaderStringAttribute (const ImfHeader *hdr,
232 int ImfHeaderSetBox2iAttribute (ImfHeader *hdr,
237 int ImfHeaderBox2iAttribute (const ImfHeader *hdr,
239 int *xMin, int *yMin,
240 int *xMax, int *yMax);
242 int ImfHeaderSetBox2fAttribute (ImfHeader *hdr,
244 float xMin, float yMin,
245 float xMax, float yMax);
247 int ImfHeaderBox2fAttribute (const ImfHeader *hdr,
249 float *xMin, float *yMin,
250 float *xMax, float *yMax);
252 int ImfHeaderSetV2iAttribute (ImfHeader *hdr,
256 int ImfHeaderV2iAttribute (const ImfHeader *hdr,
260 int ImfHeaderSetV2fAttribute (ImfHeader *hdr,
264 int ImfHeaderV2fAttribute (const ImfHeader *hdr,
268 int ImfHeaderSetV3iAttribute (ImfHeader *hdr,
270 int x, int y, int z);
272 int ImfHeaderV3iAttribute (const ImfHeader *hdr,
274 int *x, int *y, int *z);
276 int ImfHeaderSetV3fAttribute (ImfHeader *hdr,
278 float x, float y, float z);
280 int ImfHeaderV3fAttribute (const ImfHeader *hdr,
282 float *x, float *y, float *z);
284 int ImfHeaderSetM33fAttribute (ImfHeader *hdr,
286 const float m[3][3]);
288 int ImfHeaderM33fAttribute (const ImfHeader *hdr,
292 int ImfHeaderSetM44fAttribute (ImfHeader *hdr,
294 const float m[4][4]);
296 int ImfHeaderM44fAttribute (const ImfHeader *hdr,
304 struct ImfOutputFile;
305 typedef struct ImfOutputFile ImfOutputFile;
307 ImfOutputFile * ImfOpenOutputFile (const char name[],
308 const ImfHeader *hdr,
311 int ImfCloseOutputFile (ImfOutputFile *out);
313 int ImfOutputSetFrameBuffer (ImfOutputFile *out,
318 int ImfOutputWritePixels (ImfOutputFile *out,
321 int ImfOutputCurrentScanLine (const ImfOutputFile *out);
323 const ImfHeader * ImfOutputHeader (const ImfOutputFile *out);
325 int ImfOutputChannels (const ImfOutputFile *out);
329 ** Tiled RGBA output file
332 struct ImfTiledOutputFile;
333 typedef struct ImfTiledOutputFile ImfTiledOutputFile;
335 ImfTiledOutputFile * ImfOpenTiledOutputFile (const char name[],
336 const ImfHeader *hdr,
338 int xSize, int ySize,
339 int mode, int rmode);
341 int ImfCloseTiledOutputFile (ImfTiledOutputFile *out);
343 int ImfTiledOutputSetFrameBuffer (ImfTiledOutputFile *out,
348 int ImfTiledOutputWriteTile (ImfTiledOutputFile *out,
352 int ImfTiledOutputWriteTiles (ImfTiledOutputFile *out,
353 int dxMin, int dxMax,
354 int dyMin, int dyMax,
357 const ImfHeader * ImfTiledOutputHeader (const ImfTiledOutputFile *out);
359 int ImfTiledOutputChannels (const ImfTiledOutputFile *out);
361 int ImfTiledOutputTileXSize (const ImfTiledOutputFile *out);
363 int ImfTiledOutputTileYSize (const ImfTiledOutputFile *out);
365 int ImfTiledOutputLevelMode (const ImfTiledOutputFile *out);
366 int ImfTiledOutputLevelRoundingMode
367 (const ImfTiledOutputFile *out);
375 typedef struct ImfInputFile ImfInputFile;
377 ImfInputFile * ImfOpenInputFile (const char name[]);
379 int ImfCloseInputFile (ImfInputFile *in);
381 int ImfInputSetFrameBuffer (ImfInputFile *in,
386 int ImfInputReadPixels (ImfInputFile *in,
390 const ImfHeader * ImfInputHeader (const ImfInputFile *in);
392 int ImfInputChannels (const ImfInputFile *in);
394 const char * ImfInputFileName (const ImfInputFile *in);
398 ** Tiled RGBA input file
401 struct ImfTiledInputFile;
402 typedef struct ImfTiledInputFile ImfTiledInputFile;
404 ImfTiledInputFile * ImfOpenTiledInputFile (const char name[]);
406 int ImfCloseTiledInputFile (ImfTiledInputFile *in);
408 int ImfTiledInputSetFrameBuffer (ImfTiledInputFile *in,
413 int ImfTiledInputReadTile (ImfTiledInputFile *in,
417 int ImfTiledInputReadTiles (ImfTiledInputFile *in,
418 int dxMin, int dxMax,
419 int dyMin, int dyMax,
422 const ImfHeader * ImfTiledInputHeader (const ImfTiledInputFile *in);
424 int ImfTiledInputChannels (const ImfTiledInputFile *in);
426 const char * ImfTiledInputFileName (const ImfTiledInputFile *in);
428 int ImfTiledInputTileXSize (const ImfTiledInputFile *in);
430 int ImfTiledInputTileYSize (const ImfTiledInputFile *in);
432 int ImfTiledInputLevelMode (const ImfTiledInputFile *in);
434 int ImfTiledInputLevelRoundingMode
435 (const ImfTiledInputFile *in);
442 typedef struct ImfLut ImfLut;
444 ImfLut * ImfNewRound12logLut (int channels);
446 ImfLut * ImfNewRoundNBitLut (unsigned int n, int channels);
448 void ImfDeleteLut (ImfLut *lut);
450 void ImfApplyLut (ImfLut *lut,
455 ** Most recent error message
458 const char * ImfErrorMessage (void);