TuttleOFX  1
ColorTransformProcess.tcc
Go to the documentation of this file.
00001 #include "ColorTransformAlgorithm.hpp"
00002 
00003 #include <terry/algorithm/transform_pixels_progress.hpp>
00004 
00005 namespace tuttle {
00006 namespace plugin {
00007 namespace colorTransform {
00008 
00009 template<class View>
00010 ColorTransformProcess<View>::ColorTransformProcess( ColorTransformPlugin &effect )
00011 : ImageGilFilterProcessor<View>( effect, eImageOrientationIndependant )
00012 , _plugin( effect )
00013 {
00014 }
00015 
00016 template<class View>
00017 void ColorTransformProcess<View>::setup( const OFX::RenderArguments& args )
00018 {
00019         ImageGilFilterProcessor<View>::setup( args );
00020         _params = _plugin.getProcessParams( args.renderScale );
00021         
00022         _matrix = colorTransformMatrix<BoundedMatrix5x5>( _params );
00023 }
00024 
00025 /**
00026  * @brief Function called by rendering thread each time a process must be done.
00027  * @param[in] procWindowRoW  Processing window
00028  */
00029 template<class View>
00030 void ColorTransformProcess<View>::multiThreadProcessImages( const OfxRectI& procWindowRoW )
00031 {
00032         using namespace boost::gil;
00033         using namespace terry;
00034         using namespace terry::algorithm;
00035         using namespace terry::color;
00036         OfxRectI procWindowOutput = this->translateRoWToOutputClipCoordinates( procWindowRoW );
00037         OfxPointI procWindowSize  = {
00038                 procWindowRoW.x2 - procWindowRoW.x1,
00039                 procWindowRoW.y2 - procWindowRoW.y1
00040         };
00041 
00042         View src = subimage_view( this->_srcView,
00043                         procWindowOutput.x1, procWindowOutput.y1,
00044                         procWindowSize.x, procWindowSize.y );
00045         View dst = subimage_view( this->_dstView,
00046                         procWindowOutput.x1, procWindowOutput.y1,
00047                         procWindowSize.x, procWindowSize.y );
00048 
00049         transform_pixels_progress(
00050                 src,
00051                 dst,
00052                 MatrixProdPixel<BoundedMatrix5x5>(_matrix),
00053                 *this
00054                 );
00055 }
00056 
00057 }
00058 }
00059 }