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
109
#define IMF_B44_COMPRESSION 6
110
#define IMF_B44A_COMPRESSION 7
114
** Channels; values must be the same as in Imf::RgbaChannels.
117
#define IMF_WRITE_R 0x01
118
#define IMF_WRITE_G 0x02
119
#define IMF_WRITE_B 0x04
120
#define IMF_WRITE_A 0x08
121
#define IMF_WRITE_Y 0x10
122
#define IMF_WRITE_C 0x20
123
#define IMF_WRITE_RGB 0x07
124
#define IMF_WRITE_RGBA 0x0f
125
#define IMF_WRITE_YC 0x30
126
#define IMF_WRITE_YA 0x18
127
#define IMF_WRITE_YCA 0x38
131
** Level modes; values must be the same as in Imf::LevelMode
134
#define IMF_ONE_LEVEL 0
135
#define IMF_MIPMAP_LEVELS 1
136
#define IMF_RIPMAP_LEVELS 2
140
** Level rounding modes; values must be the same as in Imf::LevelRoundingMode
143
#define IMF_ROUND_DOWN 0
144
#define IMF_ROUND_UP 1
152
typedef struct ImfHeader ImfHeader;
154
ImfHeader * ImfNewHeader (void);
156
void ImfDeleteHeader (ImfHeader *hdr);
158
ImfHeader * ImfCopyHeader (const ImfHeader *hdr);
160
void ImfHeaderSetDisplayWindow (ImfHeader *hdr,
164
void ImfHeaderDisplayWindow (const ImfHeader *hdr,
165
int *xMin, int *yMin,
166
int *xMax, int *yMax);
168
void ImfHeaderSetDataWindow (ImfHeader *hdr,
172
void ImfHeaderDataWindow (const ImfHeader *hdr,
173
int *xMin, int *yMin,
174
int *xMax, int *yMax);
176
void ImfHeaderSetPixelAspectRatio (ImfHeader *hdr,
177
float pixelAspectRatio);
179
float ImfHeaderPixelAspectRatio (const ImfHeader *hdr);
181
void ImfHeaderSetScreenWindowCenter (ImfHeader *hdr,
184
void ImfHeaderScreenWindowCenter (const ImfHeader *hdr,
187
void ImfHeaderSetScreenWindowWidth (ImfHeader *hdr,
190
float ImfHeaderScreenWindowWidth (const ImfHeader *hdr);
192
void ImfHeaderSetLineOrder (ImfHeader *hdr,
195
int ImfHeaderLineOrder (const ImfHeader *hdr);
197
void ImfHeaderSetCompression (ImfHeader *hdr,
200
int ImfHeaderCompression (const ImfHeader *hdr);
202
int ImfHeaderSetIntAttribute (ImfHeader *hdr,
206
int ImfHeaderIntAttribute (const ImfHeader *hdr,
210
int ImfHeaderSetFloatAttribute (ImfHeader *hdr,
214
int ImfHeaderSetDoubleAttribute (ImfHeader *hdr,
218
int ImfHeaderFloatAttribute (const ImfHeader *hdr,
222
int ImfHeaderDoubleAttribute (const ImfHeader *hdr,
226
int ImfHeaderSetStringAttribute (ImfHeader *hdr,
230
int ImfHeaderStringAttribute (const ImfHeader *hdr,
234
int ImfHeaderSetBox2iAttribute (ImfHeader *hdr,
239
int ImfHeaderBox2iAttribute (const ImfHeader *hdr,
241
int *xMin, int *yMin,
242
int *xMax, int *yMax);
244
int ImfHeaderSetBox2fAttribute (ImfHeader *hdr,
246
float xMin, float yMin,
247
float xMax, float yMax);
249
int ImfHeaderBox2fAttribute (const ImfHeader *hdr,
251
float *xMin, float *yMin,
252
float *xMax, float *yMax);
254
int ImfHeaderSetV2iAttribute (ImfHeader *hdr,
258
int ImfHeaderV2iAttribute (const ImfHeader *hdr,
262
int ImfHeaderSetV2fAttribute (ImfHeader *hdr,
266
int ImfHeaderV2fAttribute (const ImfHeader *hdr,
270
int ImfHeaderSetV3iAttribute (ImfHeader *hdr,
272
int x, int y, int z);
274
int ImfHeaderV3iAttribute (const ImfHeader *hdr,
276
int *x, int *y, int *z);
278
int ImfHeaderSetV3fAttribute (ImfHeader *hdr,
280
float x, float y, float z);
282
int ImfHeaderV3fAttribute (const ImfHeader *hdr,
284
float *x, float *y, float *z);
286
int ImfHeaderSetM33fAttribute (ImfHeader *hdr,
288
const float m[3][3]);
290
int ImfHeaderM33fAttribute (const ImfHeader *hdr,
294
int ImfHeaderSetM44fAttribute (ImfHeader *hdr,
296
const float m[4][4]);
298
int ImfHeaderM44fAttribute (const ImfHeader *hdr,
306
struct ImfOutputFile;
307
typedef struct ImfOutputFile ImfOutputFile;
309
ImfOutputFile * ImfOpenOutputFile (const char name[],
310
const ImfHeader *hdr,
313
int ImfCloseOutputFile (ImfOutputFile *out);
315
int ImfOutputSetFrameBuffer (ImfOutputFile *out,
320
int ImfOutputWritePixels (ImfOutputFile *out,
323
int ImfOutputCurrentScanLine (const ImfOutputFile *out);
325
const ImfHeader * ImfOutputHeader (const ImfOutputFile *out);
327
int ImfOutputChannels (const ImfOutputFile *out);
331
** Tiled RGBA output file
334
struct ImfTiledOutputFile;
335
typedef struct ImfTiledOutputFile ImfTiledOutputFile;
337
ImfTiledOutputFile * ImfOpenTiledOutputFile (const char name[],
338
const ImfHeader *hdr,
340
int xSize, int ySize,
341
int mode, int rmode);
343
int ImfCloseTiledOutputFile (ImfTiledOutputFile *out);
345
int ImfTiledOutputSetFrameBuffer (ImfTiledOutputFile *out,
350
int ImfTiledOutputWriteTile (ImfTiledOutputFile *out,
354
int ImfTiledOutputWriteTiles (ImfTiledOutputFile *out,
355
int dxMin, int dxMax,
356
int dyMin, int dyMax,
359
const ImfHeader * ImfTiledOutputHeader (const ImfTiledOutputFile *out);
361
int ImfTiledOutputChannels (const ImfTiledOutputFile *out);
363
int ImfTiledOutputTileXSize (const ImfTiledOutputFile *out);
365
int ImfTiledOutputTileYSize (const ImfTiledOutputFile *out);
367
int ImfTiledOutputLevelMode (const ImfTiledOutputFile *out);
368
int ImfTiledOutputLevelRoundingMode
369
(const ImfTiledOutputFile *out);
377
typedef struct ImfInputFile ImfInputFile;
379
ImfInputFile * ImfOpenInputFile (const char name[]);
381
int ImfCloseInputFile (ImfInputFile *in);
383
int ImfInputSetFrameBuffer (ImfInputFile *in,
388
int ImfInputReadPixels (ImfInputFile *in,
392
const ImfHeader * ImfInputHeader (const ImfInputFile *in);
394
int ImfInputChannels (const ImfInputFile *in);
396
const char * ImfInputFileName (const ImfInputFile *in);
400
** Tiled RGBA input file
403
struct ImfTiledInputFile;
404
typedef struct ImfTiledInputFile ImfTiledInputFile;
406
ImfTiledInputFile * ImfOpenTiledInputFile (const char name[]);
408
int ImfCloseTiledInputFile (ImfTiledInputFile *in);
410
int ImfTiledInputSetFrameBuffer (ImfTiledInputFile *in,
415
int ImfTiledInputReadTile (ImfTiledInputFile *in,
419
int ImfTiledInputReadTiles (ImfTiledInputFile *in,
420
int dxMin, int dxMax,
421
int dyMin, int dyMax,
424
const ImfHeader * ImfTiledInputHeader (const ImfTiledInputFile *in);
426
int ImfTiledInputChannels (const ImfTiledInputFile *in);
428
const char * ImfTiledInputFileName (const ImfTiledInputFile *in);
430
int ImfTiledInputTileXSize (const ImfTiledInputFile *in);
432
int ImfTiledInputTileYSize (const ImfTiledInputFile *in);
434
int ImfTiledInputLevelMode (const ImfTiledInputFile *in);
436
int ImfTiledInputLevelRoundingMode
437
(const ImfTiledInputFile *in);
444
typedef struct ImfLut ImfLut;
446
ImfLut * ImfNewRound12logLut (int channels);
448
ImfLut * ImfNewRoundNBitLut (unsigned int n, int channels);
450
void ImfDeleteLut (ImfLut *lut);
452
void ImfApplyLut (ImfLut *lut,
457
** Most recent error message
460
const char * ImfErrorMessage (void);