TuttleOFX
1
|
00001 #include "HistogramKeyerAlgorithm.hpp" 00002 00003 #include <terry/algorithm/transform_pixels_progress.hpp> 00004 00005 namespace tuttle { 00006 namespace plugin { 00007 namespace histogramKeyer { 00008 00009 template<class View> 00010 HistogramKeyerProcess<View>::HistogramKeyerProcess( HistogramKeyerPlugin& effect ) 00011 : ImageGilFilterProcessor<View>( effect, eImageOrientationIndependant ) 00012 , _plugin( effect ) 00013 { 00014 } 00015 00016 template<class View> 00017 void HistogramKeyerProcess<View>::setup( const OFX::RenderArguments& args ) 00018 { 00019 ImageGilFilterProcessor<View>::setup( args ); 00020 _params = _plugin.getProcessParams( args.time, args.renderScale ); 00021 00022 } 00023 00024 /** 00025 * @brief Function called by rendering thread each time a process must be done. 00026 * @param[in] procWindowRoW Processing window 00027 */ 00028 template<class View> 00029 void HistogramKeyerProcess<View>::multiThreadProcessImages( const OfxRectI& procWindowRoW ) 00030 { 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; 00044 funct._params = _params; 00045 funct._isOutputBW = (_params._paramOutputSetting->getValue() == 1); // is output black and white (or alpha channel) 00046 //this function is chose because of functor reference and not copy 00047 terry::algorithm::transform_pixels_progress(src,dst,funct,*this); 00048 } 00049 00050 } 00051 } 00052 }