X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftags%2Fstable%2Fsrc%2Fmodules%2Fmod_openexr%2Fmptr_openexr.cpp;fp=synfig-core%2Ftags%2Fstable%2Fsrc%2Fmodules%2Fmod_openexr%2Fmptr_openexr.cpp;h=74a3a38c2fd44a2b4bbe04a48124a45ea2e448f8;hb=46036a57bc1ab5583c5d5c2188e8c52d7682d9d5;hp=0000000000000000000000000000000000000000;hpb=6745aa58ba1df6f71ccdcdb332fef4ca8774f278;p=synfig.git diff --git a/synfig-core/tags/stable/src/modules/mod_openexr/mptr_openexr.cpp b/synfig-core/tags/stable/src/modules/mod_openexr/mptr_openexr.cpp new file mode 100644 index 0000000..74a3a38 --- /dev/null +++ b/synfig-core/tags/stable/src/modules/mod_openexr/mptr_openexr.cpp @@ -0,0 +1,117 @@ +/*! ======================================================================== +** Sinfg +** ppm Target Module +** $Id: mptr_openexr.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $ +** +** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** +** This software and associated documentation +** are CONFIDENTIAL and PROPRIETARY property of +** the above-mentioned copyright holder. +** +** You may not copy, print, publish, or in any +** other way distribute this software without +** a prior written agreement with +** the copyright holder. +** +** === N O T E S =========================================================== +** +** ========================================================================= */ + +/* === H E A D E R S ======================================================= */ + +#ifdef USING_PCH +# include "pch.h" +#else +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "mptr_openexr.h" +#include +#include +#include +#include +#include + +#include +#include +#include + +#endif + +/* === M A C R O S ========================================================= */ + +using namespace sinfg; +using namespace std; +using namespace etl; + +/* === G L O B A L S ======================================================= */ + +SINFG_IMPORTER_INIT(exr_mptr); +SINFG_IMPORTER_SET_NAME(exr_mptr,"exr_mptr"); +SINFG_IMPORTER_SET_EXT(exr_mptr,"exr"); +SINFG_IMPORTER_SET_VERSION(exr_mptr,"0.1"); +SINFG_IMPORTER_SET_CVS_ID(exr_mptr,"$Id: mptr_openexr.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $"); + +/* === M E T H O D S ======================================================= */ + +exr_mptr::exr_mptr(const char *file) +{ + filename=file; +} + +exr_mptr::~exr_mptr() +{ +} + +bool +exr_mptr::get_frame(sinfg::Surface &out_surface,Time, sinfg::ProgressCallback *cb) +{ + try + { + + Imf::RgbaInputFile in(filename.c_str()); + + int w = in.dataWindow().max.x - in.dataWindow().min.x + 1; + int h = in.dataWindow().max.y - in.dataWindow().min.y + 1; + //int dx = in.dataWindow().min.x; + //int dy = in.dataWindow().min.y; + +#ifdef USE_HALF_TYPE + out_surface.set_wh(w,h); + in.setFrameBuffer (reinterpret_cast(out_surface[0]), 1, w); + + in.readPixels (in.dataWindow().min.y, in.dataWindow().max.y); + +#else + etl::surface in_surface; + in_surface.set_wh(w,h); + in.setFrameBuffer (reinterpret_cast(in_surface[0]), 1, w); + + in.readPixels (in.dataWindow().min.y, in.dataWindow().max.y); + + int x; + int y; + out_surface.set_wh(w,h); + for(y=0;yerror(e.what()); + else sinfg::error(e.what()); + return false; + } + + return true; +}