1
///////////////////////////////////////////////////////////////////////////
3
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
6
// All rights reserved.
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.
33
///////////////////////////////////////////////////////////////////////////
37
//-----------------------------------------------------------------------------
39
// Miscellaneous helper functions for OpenEXR image file I/O
41
//-----------------------------------------------------------------------------
44
#include <ImfHeader.h>
45
#include <ImfCompressor.h>
46
#include <ImfChannelList.h>
51
#include <ImfConvert.h>
61
pixelTypeSize (PixelType type)
69
size = Xdr::size <unsigned int> ();
74
size = Xdr::size <half> ();
79
size = Xdr::size <float> ();
84
throw Iex::ArgExc ("Unknown pixel type.");
92
numSamples (int s, int a, int b)
96
return b1 - a1 + ((a1 * s < a)? 0: 1);
101
bytesPerLineTable (const Header &header,
102
vector<size_t> &bytesPerLine)
104
const Box2i &dataWindow = header.dataWindow();
105
const ChannelList &channels = header.channels();
107
bytesPerLine.resize (dataWindow.max.y - dataWindow.min.y + 1);
109
for (ChannelList::ConstIterator c = channels.begin();
113
int nBytes = pixelTypeSize (c.channel().type) *
114
(dataWindow.max.x - dataWindow.min.x + 1) /
115
c.channel().xSampling;
117
for (int y = dataWindow.min.y, i = 0; y <= dataWindow.max.y; ++y, ++i)
118
if (modp (y, c.channel().ySampling) == 0)
119
bytesPerLine[i] += nBytes;
122
size_t maxBytesPerLine = 0;
124
for (int y = dataWindow.min.y, i = 0; y <= dataWindow.max.y; ++y, ++i)
125
if (maxBytesPerLine < bytesPerLine[i])
126
maxBytesPerLine = bytesPerLine[i];
128
return maxBytesPerLine;
133
offsetInLineBufferTable (const vector<size_t> &bytesPerLine,
134
int linesInLineBuffer,
135
vector<size_t> &offsetInLineBuffer)
137
offsetInLineBuffer.resize (bytesPerLine.size());
141
for (int i = 0; i < bytesPerLine.size(); ++i)
143
if (i % linesInLineBuffer == 0)
146
offsetInLineBuffer[i] = offset;
147
offset += bytesPerLine[i];
153
lineBufferMinY (int y, int minY, int linesInLineBuffer)
155
return ((y - minY) / linesInLineBuffer) * linesInLineBuffer + minY;
160
lineBufferMaxY (int y, int minY, int linesInLineBuffer)
162
return lineBufferMinY (y, minY, linesInLineBuffer) + linesInLineBuffer - 1;
167
defaultFormat (Compressor * compressor)
169
return compressor? compressor->format(): Compressor::XDR;
174
numLinesInBuffer (Compressor * compressor)
176
return compressor? compressor->numScanLines(): 1;
181
copyIntoFrameBuffer (const char *& readPtr,
187
Compressor::Format format,
188
PixelType typeInFrameBuffer,
189
PixelType typeInFile)
192
// Copy a horizontal row of pixels from an input
193
// file's line or tile buffer to a frame buffer.
199
// The file contains no data for this channel.
200
// Store a default value in the frame buffer.
203
switch (typeInFrameBuffer)
208
unsigned int fillVal = (unsigned int) (fillValue);
210
while (writePtr <= endPtr)
212
*(unsigned int *) writePtr = fillVal;
221
half fillVal = half (fillValue);
223
while (writePtr <= endPtr)
225
*(half *) writePtr = fillVal;
234
float fillVal = float (fillValue);
236
while (writePtr <= endPtr)
238
*(float *) writePtr = fillVal;
246
throw Iex::ArgExc ("Unknown pixel data type.");
249
else if (format == Compressor::XDR)
252
// The the line or tile buffer is in XDR format.
254
// Convert the pixels from the file's machine-
255
// independent representation, and store the
256
// results in the frame buffer.
259
switch (typeInFrameBuffer)
267
while (writePtr <= endPtr)
269
Xdr::read <CharPtrIO> (readPtr, *(unsigned int *) writePtr);
276
while (writePtr <= endPtr)
279
Xdr::read <CharPtrIO> (readPtr, h);
280
*(unsigned int *) writePtr = halfToUint (h);
287
while (writePtr <= endPtr)
290
Xdr::read <CharPtrIO> (readPtr, f);
291
*(unsigned int *)writePtr = floatToUint (f);
304
while (writePtr <= endPtr)
307
Xdr::read <CharPtrIO> (readPtr, ui);
308
*(half *) writePtr = uintToHalf (ui);
315
while (writePtr <= endPtr)
317
Xdr::read <CharPtrIO> (readPtr, *(half *) writePtr);
324
while (writePtr <= endPtr)
327
Xdr::read <CharPtrIO> (readPtr, f);
328
*(half *) writePtr = floatToHalf (f);
341
while (writePtr <= endPtr)
344
Xdr::read <CharPtrIO> (readPtr, ui);
345
*(float *) writePtr = float (ui);
352
while (writePtr <= endPtr)
355
Xdr::read <CharPtrIO> (readPtr, h);
356
*(float *) writePtr = float (h);
363
while (writePtr <= endPtr)
365
Xdr::read <CharPtrIO> (readPtr, *(float *) writePtr);
374
throw Iex::ArgExc ("Unknown pixel data type.");
380
// The the line or tile buffer is in NATIVE format.
381
// Copy the results into the frame buffer.
384
switch (typeInFrameBuffer)
392
while (writePtr <= endPtr)
394
for (size_t i = 0; i < sizeof (unsigned int); ++i)
395
writePtr[i] = readPtr[i];
397
readPtr += sizeof (unsigned int);
404
while (writePtr <= endPtr)
406
half h = *(half *) readPtr;
407
*(unsigned int *) writePtr = halfToUint (h);
408
readPtr += sizeof (half);
415
while (writePtr <= endPtr)
419
for (size_t i = 0; i < sizeof (float); ++i)
420
((char *)&f)[i] = readPtr[i];
422
*(unsigned int *)writePtr = floatToUint (f);
423
readPtr += sizeof (float);
436
while (writePtr <= endPtr)
440
for (size_t i = 0; i < sizeof (unsigned int); ++i)
441
((char *)&ui)[i] = readPtr[i];
443
*(half *) writePtr = uintToHalf (ui);
444
readPtr += sizeof (unsigned int);
451
while (writePtr <= endPtr)
453
*(half *) writePtr = *(half *)readPtr;
454
readPtr += sizeof (half);
461
while (writePtr <= endPtr)
465
for (size_t i = 0; i < sizeof (float); ++i)
466
((char *)&f)[i] = readPtr[i];
468
*(half *) writePtr = floatToHalf (f);
469
readPtr += sizeof (float);
482
while (writePtr <= endPtr)
486
for (size_t i = 0; i < sizeof (unsigned int); ++i)
487
((char *)&ui)[i] = readPtr[i];
489
*(float *) writePtr = float (ui);
490
readPtr += sizeof (unsigned int);
497
while (writePtr <= endPtr)
499
half h = *(half *) readPtr;
500
*(float *) writePtr = float (h);
501
readPtr += sizeof (half);
508
while (writePtr <= endPtr)
510
for (size_t i = 0; i < sizeof (float); ++i)
511
writePtr[i] = readPtr[i];
513
readPtr += sizeof (float);
522
throw Iex::ArgExc ("Unknown pixel data type.");
529
skipChannel (const char *& readPtr,
530
PixelType typeInFile,
537
Xdr::skip <CharPtrIO> (readPtr, Xdr::size <unsigned int> () * xSize);
542
Xdr::skip <CharPtrIO> (readPtr, Xdr::size <half> () * xSize);
547
Xdr::skip <CharPtrIO> (readPtr, Xdr::size <float> () * xSize);
552
throw Iex::ArgExc ("Unknown pixel data type.");
558
convertInPlace (char *& writePtr,
559
const char *& readPtr,
567
for (int j = 0; j < numPixels; ++j)
569
Xdr::write <CharPtrIO> (writePtr, *(const unsigned int *) readPtr);
570
readPtr += sizeof(unsigned int);
576
for (int j = 0; j < numPixels; ++j)
578
Xdr::write <CharPtrIO> (writePtr, *(const half *) readPtr);
579
readPtr += sizeof(half);
585
for (int j = 0; j < numPixels; ++j)
587
Xdr::write <CharPtrIO> (writePtr, *(const float *) readPtr);
588
readPtr += sizeof(float);
594
throw Iex::ArgExc ("Unknown pixel data type.");
600
copyFromFrameBuffer (char *& writePtr,
601
const char *& readPtr,
604
Compressor::Format format,
608
// Copy a horizontal row of pixels from a frame
609
// buffer to an output file's line or tile buffer.
612
if (format == Compressor::XDR)
615
// The the line or tile buffer is in XDR format.
622
while (readPtr <= endPtr)
624
Xdr::write <CharPtrIO> (writePtr,
625
*(const unsigned int *) readPtr);
632
while (readPtr <= endPtr)
634
Xdr::write <CharPtrIO> (writePtr, *(const half *) readPtr);
641
while (readPtr <= endPtr)
643
Xdr::write <CharPtrIO> (writePtr, *(const float *) readPtr);
650
throw Iex::ArgExc ("Unknown pixel data type.");
656
// The the line or tile buffer is in NATIVE format.
663
while (readPtr <= endPtr)
665
for (size_t i = 0; i < sizeof (unsigned int); ++i)
666
*writePtr++ = readPtr[i];
674
while (readPtr <= endPtr)
676
*(half *) writePtr = *(const half *) readPtr;
677
writePtr += sizeof (half);
684
while (readPtr <= endPtr)
686
for (size_t i = 0; i < sizeof (float); ++i)
687
*writePtr++ = readPtr[i];
695
throw Iex::ArgExc ("Unknown pixel data type.");
702
fillChannelWithZeroes (char *& writePtr,
703
Compressor::Format format,
707
if (format == Compressor::XDR)
710
// Fill with data in XDR format.
717
for (int j = 0; j < xSize; ++j)
718
Xdr::write <CharPtrIO> (writePtr, (unsigned int) 0);
724
for (int j = 0; j < xSize; ++j)
725
Xdr::write <CharPtrIO> (writePtr, (half) 0);
731
for (int j = 0; j < xSize; ++j)
732
Xdr::write <CharPtrIO> (writePtr, (float) 0);
738
throw Iex::ArgExc ("Unknown pixel data type.");
744
// Fill with data in NATIVE format.
751
for (int j = 0; j < xSize; ++j)
753
static const unsigned int ui = 0;
755
for (size_t i = 0; i < sizeof (ui); ++i)
756
*writePtr++ = ((char *) &ui)[i];
762
for (int j = 0; j < xSize; ++j)
764
*(half *) writePtr = half (0);
765
writePtr += sizeof (half);
771
for (int j = 0; j < xSize; ++j)
773
static const float f = 0;
775
for (size_t i = 0; i < sizeof (f); ++i)
776
*writePtr++ = ((char *) &f)[i];
782
throw Iex::ArgExc ("Unknown pixel data type.");
1
///////////////////////////////////////////////////////////////////////////
3
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
6
// All rights reserved.
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.
33
///////////////////////////////////////////////////////////////////////////
37
//-----------------------------------------------------------------------------
39
// Miscellaneous helper functions for OpenEXR image file I/O
41
//-----------------------------------------------------------------------------
44
#include <ImfHeader.h>
45
#include <ImfCompressor.h>
46
#include <ImfChannelList.h>
51
#include <ImfConvert.h>
61
pixelTypeSize (PixelType type)
69
size = Xdr::size <unsigned int> ();
74
size = Xdr::size <half> ();
79
size = Xdr::size <float> ();
84
throw Iex::ArgExc ("Unknown pixel type.");
92
numSamples (int s, int a, int b)
96
return b1 - a1 + ((a1 * s < a)? 0: 1);
101
bytesPerLineTable (const Header &header,
102
vector<size_t> &bytesPerLine)
104
const Box2i &dataWindow = header.dataWindow();
105
const ChannelList &channels = header.channels();
107
bytesPerLine.resize (dataWindow.max.y - dataWindow.min.y + 1);
109
for (ChannelList::ConstIterator c = channels.begin();
113
int nBytes = pixelTypeSize (c.channel().type) *
114
(dataWindow.max.x - dataWindow.min.x + 1) /
115
c.channel().xSampling;
117
for (int y = dataWindow.min.y, i = 0; y <= dataWindow.max.y; ++y, ++i)
118
if (modp (y, c.channel().ySampling) == 0)
119
bytesPerLine[i] += nBytes;
122
size_t maxBytesPerLine = 0;
124
for (int y = dataWindow.min.y, i = 0; y <= dataWindow.max.y; ++y, ++i)
125
if (maxBytesPerLine < bytesPerLine[i])
126
maxBytesPerLine = bytesPerLine[i];
128
return maxBytesPerLine;
133
offsetInLineBufferTable (const vector<size_t> &bytesPerLine,
134
int linesInLineBuffer,
135
vector<size_t> &offsetInLineBuffer)
137
offsetInLineBuffer.resize (bytesPerLine.size());
141
for (int i = 0; i < bytesPerLine.size(); ++i)
143
if (i % linesInLineBuffer == 0)
146
offsetInLineBuffer[i] = offset;
147
offset += bytesPerLine[i];
153
lineBufferMinY (int y, int minY, int linesInLineBuffer)
155
return ((y - minY) / linesInLineBuffer) * linesInLineBuffer + minY;
160
lineBufferMaxY (int y, int minY, int linesInLineBuffer)
162
return lineBufferMinY (y, minY, linesInLineBuffer) + linesInLineBuffer - 1;
167
defaultFormat (Compressor * compressor)
169
return compressor? compressor->format(): Compressor::XDR;
174
numLinesInBuffer (Compressor * compressor)
176
return compressor? compressor->numScanLines(): 1;
181
copyIntoFrameBuffer (const char *& readPtr,
187
Compressor::Format format,
188
PixelType typeInFrameBuffer,
189
PixelType typeInFile)
192
// Copy a horizontal row of pixels from an input
193
// file's line or tile buffer to a frame buffer.
199
// The file contains no data for this channel.
200
// Store a default value in the frame buffer.
203
switch (typeInFrameBuffer)
208
unsigned int fillVal = (unsigned int) (fillValue);
210
while (writePtr <= endPtr)
212
*(unsigned int *) writePtr = fillVal;
221
half fillVal = half (fillValue);
223
while (writePtr <= endPtr)
225
*(half *) writePtr = fillVal;
234
float fillVal = float (fillValue);
236
while (writePtr <= endPtr)
238
*(float *) writePtr = fillVal;
246
throw Iex::ArgExc ("Unknown pixel data type.");
249
else if (format == Compressor::XDR)
252
// The the line or tile buffer is in XDR format.
254
// Convert the pixels from the file's machine-
255
// independent representation, and store the
256
// results in the frame buffer.
259
switch (typeInFrameBuffer)
267
while (writePtr <= endPtr)
269
Xdr::read <CharPtrIO> (readPtr, *(unsigned int *) writePtr);
276
while (writePtr <= endPtr)
279
Xdr::read <CharPtrIO> (readPtr, h);
280
*(unsigned int *) writePtr = halfToUint (h);
287
while (writePtr <= endPtr)
290
Xdr::read <CharPtrIO> (readPtr, f);
291
*(unsigned int *)writePtr = floatToUint (f);
304
while (writePtr <= endPtr)
307
Xdr::read <CharPtrIO> (readPtr, ui);
308
*(half *) writePtr = uintToHalf (ui);
315
while (writePtr <= endPtr)
317
Xdr::read <CharPtrIO> (readPtr, *(half *) writePtr);
324
while (writePtr <= endPtr)
327
Xdr::read <CharPtrIO> (readPtr, f);
328
*(half *) writePtr = floatToHalf (f);
341
while (writePtr <= endPtr)
344
Xdr::read <CharPtrIO> (readPtr, ui);
345
*(float *) writePtr = float (ui);
352
while (writePtr <= endPtr)
355
Xdr::read <CharPtrIO> (readPtr, h);
356
*(float *) writePtr = float (h);
363
while (writePtr <= endPtr)
365
Xdr::read <CharPtrIO> (readPtr, *(float *) writePtr);
374
throw Iex::ArgExc ("Unknown pixel data type.");
380
// The the line or tile buffer is in NATIVE format.
381
// Copy the results into the frame buffer.
384
switch (typeInFrameBuffer)
392
while (writePtr <= endPtr)
394
for (size_t i = 0; i < sizeof (unsigned int); ++i)
395
writePtr[i] = readPtr[i];
397
readPtr += sizeof (unsigned int);
404
while (writePtr <= endPtr)
406
half h = *(half *) readPtr;
407
*(unsigned int *) writePtr = halfToUint (h);
408
readPtr += sizeof (half);
415
while (writePtr <= endPtr)
419
for (size_t i = 0; i < sizeof (float); ++i)
420
((char *)&f)[i] = readPtr[i];
422
*(unsigned int *)writePtr = floatToUint (f);
423
readPtr += sizeof (float);
436
while (writePtr <= endPtr)
440
for (size_t i = 0; i < sizeof (unsigned int); ++i)
441
((char *)&ui)[i] = readPtr[i];
443
*(half *) writePtr = uintToHalf (ui);
444
readPtr += sizeof (unsigned int);
451
while (writePtr <= endPtr)
453
*(half *) writePtr = *(half *)readPtr;
454
readPtr += sizeof (half);
461
while (writePtr <= endPtr)
465
for (size_t i = 0; i < sizeof (float); ++i)
466
((char *)&f)[i] = readPtr[i];
468
*(half *) writePtr = floatToHalf (f);
469
readPtr += sizeof (float);
482
while (writePtr <= endPtr)
486
for (size_t i = 0; i < sizeof (unsigned int); ++i)
487
((char *)&ui)[i] = readPtr[i];
489
*(float *) writePtr = float (ui);
490
readPtr += sizeof (unsigned int);
497
while (writePtr <= endPtr)
499
half h = *(half *) readPtr;
500
*(float *) writePtr = float (h);
501
readPtr += sizeof (half);
508
while (writePtr <= endPtr)
510
for (size_t i = 0; i < sizeof (float); ++i)
511
writePtr[i] = readPtr[i];
513
readPtr += sizeof (float);
522
throw Iex::ArgExc ("Unknown pixel data type.");
529
skipChannel (const char *& readPtr,
530
PixelType typeInFile,
537
Xdr::skip <CharPtrIO> (readPtr, Xdr::size <unsigned int> () * xSize);
542
Xdr::skip <CharPtrIO> (readPtr, Xdr::size <half> () * xSize);
547
Xdr::skip <CharPtrIO> (readPtr, Xdr::size <float> () * xSize);
552
throw Iex::ArgExc ("Unknown pixel data type.");
558
convertInPlace (char *& writePtr,
559
const char *& readPtr,
567
for (int j = 0; j < numPixels; ++j)
569
Xdr::write <CharPtrIO> (writePtr, *(const unsigned int *) readPtr);
570
readPtr += sizeof(unsigned int);
576
for (int j = 0; j < numPixels; ++j)
578
Xdr::write <CharPtrIO> (writePtr, *(const half *) readPtr);
579
readPtr += sizeof(half);
585
for (int j = 0; j < numPixels; ++j)
587
Xdr::write <CharPtrIO> (writePtr, *(const float *) readPtr);
588
readPtr += sizeof(float);
594
throw Iex::ArgExc ("Unknown pixel data type.");
600
copyFromFrameBuffer (char *& writePtr,
601
const char *& readPtr,
604
Compressor::Format format,
608
// Copy a horizontal row of pixels from a frame
609
// buffer to an output file's line or tile buffer.
612
if (format == Compressor::XDR)
615
// The the line or tile buffer is in XDR format.
622
while (readPtr <= endPtr)
624
Xdr::write <CharPtrIO> (writePtr,
625
*(const unsigned int *) readPtr);
632
while (readPtr <= endPtr)
634
Xdr::write <CharPtrIO> (writePtr, *(const half *) readPtr);
641
while (readPtr <= endPtr)
643
Xdr::write <CharPtrIO> (writePtr, *(const float *) readPtr);
650
throw Iex::ArgExc ("Unknown pixel data type.");
656
// The the line or tile buffer is in NATIVE format.
663
while (readPtr <= endPtr)
665
for (size_t i = 0; i < sizeof (unsigned int); ++i)
666
*writePtr++ = readPtr[i];
674
while (readPtr <= endPtr)
676
*(half *) writePtr = *(const half *) readPtr;
677
writePtr += sizeof (half);
684
while (readPtr <= endPtr)
686
for (size_t i = 0; i < sizeof (float); ++i)
687
*writePtr++ = readPtr[i];
695
throw Iex::ArgExc ("Unknown pixel data type.");
702
fillChannelWithZeroes (char *& writePtr,
703
Compressor::Format format,
707
if (format == Compressor::XDR)
710
// Fill with data in XDR format.
717
for (int j = 0; j < xSize; ++j)
718
Xdr::write <CharPtrIO> (writePtr, (unsigned int) 0);
724
for (int j = 0; j < xSize; ++j)
725
Xdr::write <CharPtrIO> (writePtr, (half) 0);
731
for (int j = 0; j < xSize; ++j)
732
Xdr::write <CharPtrIO> (writePtr, (float) 0);
738
throw Iex::ArgExc ("Unknown pixel data type.");
744
// Fill with data in NATIVE format.
751
for (int j = 0; j < xSize; ++j)
753
static const unsigned int ui = 0;
755
for (size_t i = 0; i < sizeof (ui); ++i)
756
*writePtr++ = ((char *) &ui)[i];
762
for (int j = 0; j < xSize; ++j)
764
*(half *) writePtr = half (0);
765
writePtr += sizeof (half);
771
for (int j = 0; j < xSize; ++j)
773
static const float f = 0;
775
for (size_t i = 0; i < sizeof (f); ++i)
776
*writePtr++ = ((char *) &f)[i];
782
throw Iex::ArgExc ("Unknown pixel data type.");