00001 #include <ImfInputFile.h>
00002 #include <ImfOutputFile.h>
00003 #include <ImfChannelList.h>
00004 #include <ImfFrameBuffer.h>
00005 #include <half.h>
00006
00007 using namespace Imf;
00008 using namespace Imath;
00009
00010 void
00011 ReadImage(const char *name, int *width, int *height)
00012 {
00013 InputFile file(name);
00014 Box2i dw = file.header().dataWindow();
00015 *width = dw.max.x - dw.min.x + 1;
00016 *height = dw.max.y - dw.min.y + 1;
00017
00018 half *rgb = new half[3 * *width * *height];
00019
00020 FrameBuffer frameBuffer;
00021 frameBuffer.insert("R", Slice(HALF, (char *)rgb,
00022 3*sizeof(half), *width * 3 * sizeof(half), 1, 1, 0.0));
00023 frameBuffer.insert("G", Slice(HALF, (char *)rgb+sizeof(half),
00024 3*sizeof(half), *width * 3 * sizeof(half), 1, 1, 0.0));
00025 frameBuffer.insert("B", Slice(HALF, (char *)rgb+2*sizeof(half),
00026 3*sizeof(half), *width * 3 * sizeof(half), 1, 1, 0.0));
00027
00028 file.setFrameBuffer(frameBuffer);
00029 file.readPixels(dw.min.y, dw.max.y);
00030 }
00031
00032
00033 int main() {
00034 return 0;
00035 }