|
|
hi,
I'm writing a patch for povray to support the OpenEXR
(http://www.openexr.com/) Fileformat.
At the moment the patch doesn't work 100% correct and their is something
todo
TODO
-search OpenEXR in autoconf at the flags are just added to configure.in
-fix the problem with the file output
-add token and parser support for OpenEXR
but here is the patch so far (it is released under the terms of the GPL2
License http://www.gnu.org/licenses/gpl.html )
povray_openexr.diff
diff -r -u ./file_pov.cpp ../../povray-3.50c/src/file_pov.cpp
--- ./file_pov.cpp 2003-09-02 22:03:42.000000000 +0200
+++ ../../povray-3.50c/src/file_pov.cpp 2003-01-07 02:08:27.000000000 +0100
@@ -91,7 +91,6 @@
{ ".iff", ".IFF", "", "" }, // POV_File_Image_IFF
{ ".jpg", ".JPG", ".jpeg", ".JPEG" }, // POV_File_Image_JPEG
{ ".tif", ".TIF", ".tiff", ".TIFF" }, // POV_File_Image_TIFF
- { ".exr", ".EXR", "", "" }, // POV_File_Image_OpenEXR
{ POV_IS1, POV_IS2, POV_IS3, POV_IS4 }, // POV_File_Image_System
{ ".pov", ".POV", "", "" }, // POV_File_Text_POV
{ ".inc", ".INC", "", "" }, // POV_File_Text_INC
diff -r -u ./file_pov.h ../../povray-3.50c/src/file_pov.h
--- ./file_pov.h 2003-09-02 21:58:42.000000000 +0200
+++ ../../povray-3.50c/src/file_pov.h 2003-01-07 02:08:30.000000000 +0100
@@ -55,20 +55,19 @@
POV_File_Image_IFF = 6,
POV_File_Image_JPEG = 7,
POV_File_Image_TIFF = 8,
- POV_File_Image_OpenEXR = 9,
- POV_File_Image_System = 10,
- POV_File_Text_POV = 11,
- POV_File_Text_INC = 12,
+ POV_File_Image_System = 9,
+ POV_File_Text_POV = 10,
+ POV_File_Text_INC = 11,
POV_File_Text_Macro = POV_File_Text_INC,
- POV_File_Text_INI = 13,
- POV_File_Text_CSV = 14,
- POV_File_Text_Stream = 15,
- POV_File_Text_User = 16,
- POV_File_Data_DF3 = 17,
- POV_File_Data_RCA = 18,
- POV_File_Data_LOG = 19,
- POV_File_Font_TTF = 20,
- POV_File_Unknown_Count = 21
+ POV_File_Text_INI = 12,
+ POV_File_Text_CSV = 13,
+ POV_File_Text_Stream = 14,
+ POV_File_Text_User = 15,
+ POV_File_Data_DF3 = 16,
+ POV_File_Data_RCA = 17,
+ POV_File_Data_LOG = 18,
+ POV_File_Font_TTF = 19,
+ POV_File_Unknown_Count = 20
};
class pov_io_base
diff -r -u ./frame.h ../../povray-3.50c/src/frame.h
--- ./frame.h 2003-09-03 11:39:28.000000000 +0200
+++ ../../povray-3.50c/src/frame.h 2003-01-07 02:08:30.000000000 +0100
@@ -1203,7 +1203,6 @@
#define PNG_FILE 0x00000100
#define JPEG_FILE 0x00000200
#define TIFF_FILE 0x00000400
-#define OPENEXR_FILE 0x00000800
#define IMAGE_FILE_MASK 0x000007FF
@@ -1219,10 +1218,10 @@
/* Image types. */
-#define IMAGE_FILE
IMAGE_FTYPE+GIF_FILE+SYS_FILE+IFF_FILE+GRAD_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE+OPENEXR_FILE
-#define NORMAL_FILE
NORMAL_FTYPE+GIF_FILE+SYS_FILE+IFF_FILE+GRAD_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE+OPENEXR_FILE
-#define MATERIAL_FILE
MATERIAL_FTYPE+GIF_FILE+SYS_FILE+IFF_FILE+GRAD_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE+OPENEXR_FILE
-#define HF_FILE
HF_FTYPE+GIF_FILE+SYS_FILE+POT_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE+OPENEXR_FILE
+#define IMAGE_FILE
IMAGE_FTYPE+GIF_FILE+SYS_FILE+IFF_FILE+GRAD_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE
+#define NORMAL_FILE
NORMAL_FTYPE+GIF_FILE+SYS_FILE+IFF_FILE+GRAD_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE
+#define MATERIAL_FILE
MATERIAL_FTYPE+GIF_FILE+SYS_FILE+IFF_FILE+GRAD_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE
+#define HF_FILE
HF_FTYPE+GIF_FILE+SYS_FILE+POT_FILE+TGA_FILE+PGM_FILE+PPM_FILE+PNG_FILE+JPEG_FILE+TIFF_FILE
typedef struct Image_Struct IMAGE;
diff -r -u ./histogra.cpp ../../povray-3.50c/src/histogra.cpp
--- ./histogra.cpp 2003-09-02 22:04:29.000000000 +0200
+++ ../../povray-3.50c/src/histogra.cpp 2003-01-07 02:08:27.000000000 +0100
@@ -279,7 +279,6 @@
case SYS :
case TARGA :
case PNG:
- case OPENEXR:
OptionsSave = opts.Options;
OutputQualitySave = opts.OutputQuality;
diff -r -u ./image.cpp ../../povray-3.50c/src/image.cpp
--- ./image.cpp 2003-09-02 22:05:13.000000000 +0200
+++ ../../povray-3.50c/src/image.cpp 2003-01-07 02:08:27.000000000 +0100
@@ -527,7 +527,6 @@
case TGA_FILE:
case PNG_FILE:
case TIFF_FILE:
- case OPENEXR_FILE:
case SYS_FILE:
if(Image->Colour_Map == NULL)
{
diff -r -u ./Makefile.in ../../povray-3.50c/src/Makefile.in
--- ./Makefile.in 2003-09-03 11:44:03.000000000 +0200
+++ ../../povray-3.50c/src/Makefile.in 2003-01-07 02:23:23.000000000 +0100
@@ -88,12 +88,12 @@
PACKAGE = @PACKAGE@
VERSION = @VERSION@
bin_PROGRAMS = povray
-povray_SOURCES = atmosph.cpp bbox.cpp bcyl.cpp benchmark.cpp bezier.cpp
blob.cpp boxes.cpp bsphere.cpp camera.cpp chi2.cpp colour.cpp colutils.cpp
cones.cpp csg.cpp discs.cpp express.cpp file_pov.cpp fncode.cpp
fnintern.cpp fnpovfpu.cpp fnsyntax.cpp fpmetric.cpp fractal.cpp
function.cpp gif.cpp gifdecod.cpp hcmplx.cpp hfield.cpp histogra.cpp
iff.cpp image.cpp interior.cpp isosurf.cpp jpeg_pov.cpp lathe.cpp
lbuffer.cpp lightgrp.cpp lighting.cpp matrices.cpp media.cpp mesh.cpp
normal.cpp objects.cpp octree.cpp optin.cpp optout.cpp parse.cpp
parsestr.cpp parstxtr.cpp pattern.cpp pgm.cpp photons.cpp pigment.cpp
planes.cpp png_pov.cpp point.cpp poly.cpp polygon.cpp polysolv.cpp
pov_mem.cpp povms.cpp povmscpp.cpp povmsend.cpp povmsrec.cpp povray.cpp
pov_util.cpp ppm.cpp prism.cpp quadrics.cpp quatern.cpp rad_data.cpp
radiosit.cpp ray.cpp render.cpp renderio.cpp sor.cpp spheres.cpp
sphsweep.cpp splines.cpp statspov.cpp super.cpp targa.cpp texture.cpp
tiff_pov.cpp tokenize.cpp torus.cpp triangle.cpp truetype.cpp txttest.cpp
userdisp.cpp userio.cpp vbuffer.cpp vlbuffer.cpp warps.cpp unix.cpp
povxlib.c config.h jversion.h optout.h povxlib.h atmosph.h bbox.h bcyl.h
bezier.h blob.h boxes.h bsphere.h camera.h chi2.h colour.h colutils.h
cones.h csg.h discs.h express.h file_pov.h fncode.h fnintern.h fnpovfpu.h
fnsyntax.h fpmetric.h fractal.h frame.h function.h gifdecod.h gif.h
hcmplx.h hfield.h histogra.h iff.h image.h interior.h isosurf.h jpeg_pov.h
lathe.h lbuffer.h lightgrp.h lighting.h matrices.h media.h mesh.h normal.h
objects.h octree.h optin.h parse.h parsestr.h parstxtr.h pattern.h pgm.h
photons.h pigment.h planes.h png_pov.h point.h polygon.h poly.h polysolv.h
pov_err.h pov_mem.h povmscpp.h povmsend.h povmsgid.h povms.h povmsrec.h
povproto.h povray.h pov_util.h ppm.h prism.h quadrics.h quatern.h
radiosit.h ray.h render.h renderio.h sor.h spheres.h sphsweep.h splines.h
statspov.h super.h targa.h texture.h tiff_pov.h tokenize.h torus.h
triangle.h truetype.h txttest.h userdisp.h userio.h vbuffer.h vector.h
vlbuffer.h warps.h conf.h openexr_pov.cpp openexr_pov.h
+povray_SOURCES = atmosph.cpp bbox.cpp bcyl.cpp benchmark.cpp bezier.cpp
blob.cpp boxes.cpp bsphere.cpp camera.cpp chi2.cpp colour.cpp colutils.cpp
cones.cpp csg.cpp discs.cpp express.cpp file_pov.cpp fncode.cpp
fnintern.cpp fnpovfpu.cpp fnsyntax.cpp fpmetric.cpp fractal.cpp
function.cpp gif.cpp gifdecod.cpp hcmplx.cpp hfield.cpp histogra.cpp
iff.cpp image.cpp interior.cpp isosurf.cpp jpeg_pov.cpp lathe.cpp
lbuffer.cpp lightgrp.cpp lighting.cpp matrices.cpp media.cpp mesh.cpp
normal.cpp objects.cpp octree.cpp optin.cpp optout.cpp parse.cpp
parsestr.cpp parstxtr.cpp pattern.cpp pgm.cpp photons.cpp pigment.cpp
planes.cpp png_pov.cpp point.cpp poly.cpp polygon.cpp polysolv.cpp
pov_mem.cpp povms.cpp povmscpp.cpp povmsend.cpp povmsrec.cpp povray.cpp
pov_util.cpp ppm.cpp prism.cpp quadrics.cpp quatern.cpp rad_data.cpp
radiosit.cpp ray.cpp render.cpp renderio.cpp sor.cpp spheres.cpp
sphsweep.cpp splines.cpp statspov.cpp super.cpp targa.cpp texture.cpp
tiff_pov.cpp tokenize.cpp torus.cpp triangle.cpp truetype.cpp txttest.cpp
userdisp.cpp userio.cpp vbuffer.cpp vlbuffer.cpp warps.cpp unix.cpp
povxlib.c config.h jversion.h optout.h povxlib.h atmosph.h bbox.h bcyl.h
bezier.h blob.h boxes.h bsphere.h camera.h chi2.h colour.h colutils.h
cones.h csg.h discs.h express.h file_pov.h fncode.h fnintern.h fnpovfpu.h
fnsyntax.h fpmetric.h fractal.h frame.h function.h gifdecod.h gif.h
hcmplx.h hfield.h histogra.h iff.h image.h interior.h isosurf.h jpeg_pov.h
lathe.h lbuffer.h lightgrp.h lighting.h matrices.h media.h mesh.h normal.h
objects.h octree.h optin.h parse.h parsestr.h parstxtr.h pattern.h pgm.h
photons.h pigment.h planes.h png_pov.h point.h polygon.h poly.h polysolv.h
pov_err.h pov_mem.h povmscpp.h povmsend.h povmsgid.h povms.h povmsrec.h
povproto.h povray.h pov_util.h ppm.h prism.h quadrics.h quatern.h
radiosit.h ray.h render.h renderio.h sor.h spheres.h sphsweep.h splines.h
statspov.h super.h targa.h texture.h tiff_pov.h tokenize.h torus.h
triangle.h truetype.h txttest.h userdisp.h userio.h vbuffer.h vector.h
vlbuffer.h warps.h conf.h
DEFS = -DPREFIX=\"$(prefix)\" -DPOV_LIB_DIR=\"@datadir@/povray-3.5\"
-DCOMPILER_VER=\".Linux.$(CC)\" -DSYSCONFDIR=\"$(sysconfdir)\"
-DUSE_IO_RESTRICTIONS=\"$(ac_use_io_restrictions)\"
NOMULTICHAR = `if [ "X$(CC)" = "Xgcc" ]; then echo "-Wno-multichar"; fi `
LDADD = @X_LIBS@
CFLAGS = -O3 -mcpu=i586 -march=i586 -finline-functions -ffast-math
-fomit-frame-pointer -funroll-loops -fexpensive-optimizations
-malign-double -foptimize-sibling-calls -minline-all-stringops
-Wno-multichar
-CXXFLAGS = -I/usr/include/OpenEXR $(NOMULTICHAR) -O3 -finline-functions
-ffast-math -fomit-frame-pointer -funroll-loops -fexpensive-optimizations
-malign-double -foptimize-sibling-calls -minline-all-stringops
-Wno-multichar
+CXXFLAGS = $(NOMULTICHAR) -O3 -finline-functions -ffast-math
-fomit-frame-pointer -funroll-loops -fexpensive-optimizations
-malign-double -foptimize-sibling-calls -minline-all-stringops
-Wno-multichar
LDFLAGS = @X_CFLAGS@
EXTRA_DIST = xpovicon.xbm xpovmask.xbm xpovicon.xpm
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -102,7 +102,7 @@
PROGRAMS = $(bin_PROGRAMS)
CPPFLAGS = @CPPFLAGS@
-LIBS = @LIBS@ -lIex -lHalf -lIlmImf
+LIBS = @LIBS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
@@ -120,7 +120,7 @@
radiosit.o ray.o render.o renderio.o sor.o spheres.o sphsweep.o \
splines.o statspov.o super.o targa.o texture.o tiff_pov.o tokenize.o \
torus.o triangle.o truetype.o txttest.o userdisp.o userio.o vbuffer.o \
-vlbuffer.o warps.o unix.o povxlib.o openexr_pov.o
+vlbuffer.o warps.o unix.o povxlib.o
povray_LDADD = $(LDADD)
povray_DEPENDENCIES =
povray_LDFLAGS =
diff -r -u ./optin.cpp ../../povray-3.50c/src/optin.cpp
--- ./optin.cpp 2003-09-02 21:11:20.000000000 +0200
+++ ../../povray-3.50c/src/optin.cpp 2003-01-07 02:08:28.000000000 +0100
@@ -120,7 +120,7 @@
};
/* Supported output file types */
-char *Output_File_Types = "sStTcCpPnNdDrRoO";
+char *Output_File_Types = "sStTcCpPnNdDrR";
/*
Keyword table for the INI-file parser.
diff -r -u ./optout.cpp ../../povray-3.50c/src/optout.cpp
--- ./optout.cpp 2003-09-02 22:12:56.000000000 +0200
+++ ../../povray-3.50c/src/optout.cpp 2003-01-07 02:08:28.000000000 +0100
@@ -550,7 +550,6 @@
Banner(" Fx = write output file in format x\n");
Banner(" FC - Compressed Targa with 24 or 32 bpp\n");
Banner(" FNn - PNG (n bits/color, n = 5 to 16, default is
8)\n");
- Banner(" FO - OpenEXR");
// Banner(" FJn - JPEG (n compression quality, n = 0 to
100, default is 100)\n");
Banner(" FP - PPM\n");
Banner(" FS - System specific\n");
@@ -855,7 +854,6 @@
case 'P': Render_Info("PPM"); break;
case 'S': Render_Info("(system format)"); break;
case 'T': Render_Info("Targa"); break;
- case 'O': Render_Info("OpenEXR"); break;
}
if (opts.Options & HF_GRAY_16)
@@ -933,7 +931,6 @@
case TARGA: type = "TGA"; break;
case PNG: type = "PNG"; break;
case PPM: type = "PPM"; break;
- case OPENEXR: type = "OpenEXR"; break;
case SYS: type = "(system format)"; break;
case NONE: /* Just to stop warning messages */
default: type = "None"; break;
diff -r -u ./optout.h ../../povray-3.50c/src/optout.h
--- ./optout.h 2003-06-02 21:06:36.000000000 +0200
+++ ../../povray-3.50c/src/optout.h 2003-01-07 02:30:05.000000000 +0100
@@ -46,7 +46,7 @@
#define OFFICIAL_VERSION_NUMBER 350
#define DISTRIBUTION_MESSAGE_1 "This is an unofficial version compiled by:"
-//#error You must complete the following DISTRIBUTION_MESSAGE macro
+#error You must complete the following DISTRIBUTION_MESSAGE macro
#define DISTRIBUTION_MESSAGE_2 " FILL IN NAME
HERE........................."
#define DISTRIBUTION_MESSAGE_3 " The POV-Ray Team(tm) is not responsible
for supporting this version."
diff -r -u ./povmsrec.cpp ../../povray-3.50c/src/povmsrec.cpp
--- ./povmsrec.cpp 2003-09-02 22:09:32.000000000 +0200
+++ ../../povray-3.50c/src/povmsrec.cpp 2003-01-07 02:08:29.000000000 +0100
@@ -410,10 +410,6 @@
switch(i)
{
- case 'O':
- case 'o':
- opts.histogram_type = OPENEXR;
- opts.histogram_file_type = OPENEXR_FILE;
case 'C':
case 'c':
opts.histogram_type = CSV;
@@ -465,7 +461,6 @@
switch(opts.histogram_type)
{
- case OPENEXR: def_ext = ".exr"; break;
case CSV: def_ext = ".csv"; break;
case TARGA: def_ext = ".tga"; break;
case PNG: def_ext = ".png"; break;
diff -r -u ./render.h ../../povray-3.50c/src/render.h
--- ./render.h 2003-09-02 22:00:02.000000000 +0200
+++ ../../povray-3.50c/src/render.h 2003-01-07 02:08:31.000000000 +0100
@@ -52,7 +52,6 @@
PPM,
TARGA,
PNG,
- OPENEXR,
NONE
} Histogram_Types;
diff -r -u ./renderio.cpp ../../povray-3.50c/src/renderio.cpp
--- ./renderio.cpp 2003-09-02 23:14:00.000000000 +0200
+++ ../../povray-3.50c/src/renderio.cpp 2003-01-07 02:08:29.000000000 +0100
@@ -62,7 +62,6 @@
#include "targa.h"
#include "png_pov.h"
#include "jpeg_pov.h"
-#include "openexr_pov.h"
#include <algorithm>
@@ -222,11 +221,6 @@
opts.Output_File_Type = PNG_FILE;
def_ext=".png";
break;
- case 'o':
- case 'O':
- opts.Output_File_Type = OPENEXR_FILE;
- def_ext=".exr";
- break;
case 'd' :
case 'D' :
Error ("Dump format no longer supported.");
@@ -547,18 +541,6 @@
}
}
}
- else if((file_type & OPENEXR_FILE) == OPENEXR_FILE)
- {
- i = POV_NEW(OpenEXR_Image)(filename, w, h, m, l);
- /*if(i != NULL)
- {
- if(i->Valid() == false)
- {
- POV_DELETE(i, Image_File_Class);
- i = NULL;
- }
- }*/
- }
return i;
}
openexr_pov.h
/****************************************************************************
* openexr_pov.h
*
* This module contains all defines, typedefs, and prototypes for
* OPENEXR_POV.CPP.
*
* Copyright 2003 Ruediger Sonderfeld <kin### [at] c-plusplusde>
*---------------------------------------------------------------------------
* this file is released under the terms of the GPL 2 License
* http://www.gnu.org/licenses/gpl.html
*
* $File: //depot/povray/3.5/source/openexr_pov.h $
* $Revision: #1 $
* $Change: 0 $
* $DateTime: 2003/09/03 11:25:17 CEST $
* $Author: Ruediger Sonderfeld $
* $Log$
*
*****************************************************************************/
#ifndef OPENEXR_POV_H
#define OPENEXR_POV_H
#include <OpenEXR/ImfRgbaFile.h>
#include <OpenEXR/ImfArray.h>
#include "frame.h"
#include "povproto.h"
// base class for the OpenEXR Managing classes
class OpenEXRImage
{
public:
virtual void write(COLOUR *line_data) { Error("write not implemented"); };
virtual void read(COLOUR *line_data) { Error("read not implemented"); };
virtual int line() =0;
virtual int Width() =0;
virtual int Height() =0;
};
// class for reading OpenEXR images (untestet)
class OpenEXR_Read_Image : public OpenEXRImage, public Imf::RgbaInputFile
{
Imf::Array2D<Imf::Rgba> pixels;
int width,height,current_line;
public:
OpenEXR_Read_Image(const char *filename,int width,int height,int line);
void read(COLOUR *line_data);
int line() { return current_line; }
int Width() { return width; }
int Height() { return height; }
};
// class for writing OpenEXR images
class OpenEXR_Write_Image : public OpenEXRImage, public Imf::RgbaOutputFile
{
Imf::Array2D<Imf::Rgba> pixels;
int current_line;
int width;
int height;
public:
OpenEXR_Write_Image(const char *filename,int w,int h,int line);
void write(COLOUR *line_data);
int line() { return current_line; }
int Width() { return width; }
int Height() { return height; }
};
// image class
class OpenEXR_Image : public Image_File_Class
{
OpenEXRImage *img;
public:
OpenEXR_Image(char *filename,int width,int height,int mode, int line=0);
~OpenEXR_Image() { delete img; }
void Write_Line(COLOUR *line_data) { img->write(line_data); }
int Read_Line(COLOUR *line_data) { img->read(line_data); }
int Line() { return img->line();; }
int Width() { return img->Width(); }
int Height() { return img->Height(); }
};
#endif
openexr_pov.cpp
/*****************************************************************************
* openexr_pov.cpp
*
* This module contains the code to read and write the OpenEXR output file
*
* Copyright 2003 Ruediger Sonderfeld <kin### [at] c-plusplusde>
*---------------------------------------------------------------------------
* this file is released under the terms of the GPL 2 License
* http://www.gnu.org/licenses/gpl.html
*
* $File: //depot/povray/3.5/source/openexr_pov.cpp $
* $Revision: #1 $
* $Change: 0 $
* $DateTime: $
* $Author: Ruediger Sonderfeld $
* $Log$
*
*****************************************************************************/
#include "openexr_pov.h"
OpenEXR_Write_Image::OpenEXR_Write_Image(const char *filename,int w,int h,
int line)
: Imf::RgbaOutputFile(filename,w,h),
pixels(h,w),width(w),height(h),current_line(line)
{ }
void OpenEXR_Write_Image::write(COLOUR *line_data)
{
//convert COLOUR to Imf::Rgba
for(int i=0;i<width;++i) {
pixels[current_line][i].r=line_data[i][pRED];
pixels[current_line][i].g=line_data[i][pGREEN];
pixels[current_line][i].b=line_data[i][pBLUE];
pixels[current_line][i].a=line_data[i][pTRANSM]; //TODO: Check this!
}
// this could be done in the dtor but povray doesn't delete the memory
// and the dtor isn't called :(
// Writing to the file
if(++current_line==height) {
setFrameBuffer(pixels[0],1,width);
writePixels(height);
}
}
OpenEXR_Read_Image:: OpenEXR_Read_Image(const char *filename,int w,int h,
int line)
: Imf::RgbaInputFile(filename),current_line(line)
{
Imath::Box2i header=dataWindow();
int real_width= header.max.x - header.min.x + 1;
int real_height= header.max.y - header.min.y + 1;
width=real_width>w ? real_width : w;
height=real_height>h ? real_height : h;
pixels.resizeErase(height,width);
//read pixel data into the pixels array
setFrameBuffer(pixels[0]-header.min.x-header.min.y*width,1,width);
readPixels(header.min.y,header.max.y);
width=w;
height=h;
}
void OpenEXR_Read_Image::read(COLOUR *line_data)
{
// convert pixel data
for(int i=0;i<width;++i) {
line_data[i][pRED]=pixels[current_line][i].r;
line_data[i][pGREEN]=pixels[current_line][i].g;
line_data[i][pBLUE]=pixels[current_line][i].b;
line_data[i][pTRANSM]=pixels[current_line][i].a; //TODO: Check this!
}
++current_line;
}
OpenEXR_Image::OpenEXR_Image(char *filename,int width,int height,int mode,
int line)
{
switch(mode)
{
case READ_MODE:
img=new OpenEXR_Read_Image(filename,width,height,line);
break;
case WRITE_MODE:
img=new OpenEXR_Write_Image(filename,width,height,line);
break;
case APPEND_MODE:
Error("not supported at the moment");
//img=new OpenEXR_Write_Image();
break;
}
}
Post a reply to this message
|
|