TuttleOFX  1
ColorCubeViewerProcess.tcc
Go to the documentation of this file.
00001 #include "ColorCubeViewerAlgorithm.hpp"
00002 
00003 #include <terry/algorithm/transform_pixels_progress.hpp>
00004 
00005 namespace tuttle {
00006 namespace plugin {
00007 namespace colorCubeViewer {
00008 
00009 template<class View>
00010 ColorCubeViewerProcess<View>::ColorCubeViewerProcess( ColorCubeViewerPlugin &effect )
00011 : ImageGilFilterProcessor<View>( effect, eImageOrientationIndependant )
00012 , _plugin( effect )
00013 {
00014         //this->setNoMultiThreading();
00015 }
00016 
00017 template<class View>
00018 void ColorCubeViewerProcess<View>::setup( const OFX::RenderArguments& args )
00019 {
00020         ImageGilFilterProcessor<View>::setup( args );
00021 }
00022 
00023 /**
00024  * @brief Function called by rendering thread each time a process must be done.
00025  * @param[in] procWindowRoW  Processing window
00026  */
00027 template<class View>
00028 void ColorCubeViewerProcess<View>::multiThreadProcessImages( const OfxRectI& procWindowRoW )
00029 {
00030         using namespace boost::gil;
00031         // this->_renderArgs.time
00032     OfxRectI procWindowOutput = this->translateRoWToOutputClipCoordinates( procWindowRoW );
00033         const OfxRectI procWindowSrc = translateRegion( procWindowRoW, this->_srcPixelRod );
00034         
00035         OfxPointI procWindowSize = { procWindowRoW.x2 - procWindowRoW.x1,
00036                                                              procWindowRoW.y2 - procWindowRoW.y1 };
00037         View src = subimage_view( this->_srcView, procWindowSrc.x1, procWindowSrc.y1,
00038                                                                           procWindowSize.x, procWindowSize.y );
00039         View dst = subimage_view( this->_dstView, procWindowOutput.x1, procWindowOutput.y1,
00040                                                                           procWindowSize.x, procWindowSize.y );
00041         
00042     //Create and initialize functor 
00043         Compute_alpha_pixel funct(false,_plugin._renderAttributes.geodesicFormColor, _plugin._renderAttributes.geodesicFormSpill); //Output is alpha
00044         //this function is chose because of functor reference and not copy
00045         terry::algorithm::transform_pixels_progress(src,dst,funct,*this);
00046 }
00047 
00048 }
00049 }
00050 }