TuttleOFX  1
ComponentProcess.tcc
Go to the documentation of this file.
00001 #include "ComponentAlgorithm.hpp"
00002 
00003 #include <terry/algorithm/transform_pixels_progress.hpp>
00004 
00005 namespace tuttle {
00006 namespace plugin {
00007 namespace component {
00008 
00009 template<class SView, class DView>
00010 ComponentProcess<SView, DView>::ComponentProcess( ComponentPlugin &effect )
00011 : ImageGilFilterProcessor<SView, DView>( effect, eImageOrientationIndependant )
00012 , _plugin( effect )
00013 {
00014 }
00015 
00016 template<class SView, class DView>
00017 void ComponentProcess<SView, DView>::setup( const OFX::RenderArguments& args )
00018 {
00019         ImageGilFilterProcessor<SView, DView>::setup( args );
00020         // get process params
00021         _params.grayMethod    = static_cast<terry::color::components::EConvertToGray>( _plugin._paramToGrayMethod->getValue() );
00022         _params.premultiplied = _plugin._paramPremultiplied->getValue();
00023 
00024 }
00025 
00026 /**
00027  * @brief Function called by rendering thread each time a process must be done.
00028  * @param[in] procWindowRoW  Processing window
00029  */
00030 template<class SView, class DView>
00031 void ComponentProcess<SView, DView>::multiThreadProcessImages( const OfxRectI& procWindowRoW )
00032 {
00033         using namespace terry;
00034         using namespace terry::color::components;
00035         OfxRectI procWindowOutput = this->translateRoWToOutputClipCoordinates( procWindowRoW );
00036 
00037         const OfxRectI procWindowSrc = translateRegion( procWindowRoW, this->_srcPixelRod );
00038         OfxPointI procWindowSize = { procWindowRoW.x2 - procWindowRoW.x1,
00039                                                                  procWindowRoW.y2 - procWindowRoW.y1 };
00040         SView src = subimage_view( this->_srcView, procWindowSrc.x1, procWindowSrc.y1,
00041                                                                           procWindowSize.x, procWindowSize.y );
00042         DView dst = subimage_view( this->_dstView, procWindowOutput.x1, procWindowOutput.y1,
00043                                                                           procWindowSize.x, procWindowSize.y );
00044         
00045         convertComponentsView( src, dst, _params );
00046 }
00047 
00048 
00049 
00050 
00051 }
00052 }
00053 }