TuttleOFX  1
MathOperatorProcess.tcc
Go to the documentation of this file.
00001 
00002 #include "MathOperatorPlugin.hpp"
00003 #include "MathOperatorAlgorithm.hpp"
00004 
00005 #include <cmath>
00006 
00007 namespace tuttle {
00008 namespace plugin {
00009 namespace mathOperator {
00010 
00011 template<class View>
00012 MathOperatorProcess<View>::MathOperatorProcess( MathOperatorPlugin &effect )
00013 : ImageGilFilterProcessor<View>( effect, eImageOrientationIndependant )
00014 , _plugin( effect )
00015 {
00016 }
00017 
00018 template<class View>
00019 void MathOperatorProcess<View>::setup( const OFX::RenderArguments& args )
00020 {
00021         ImageGilFilterProcessor<View>::setup( args );
00022         _params = _plugin.getProcessParams( args.renderScale );
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 MathOperatorProcess<View>::multiThreadProcessImages( const OfxRectI& procWindowRoW )
00031 {
00032         using namespace boost::gil;
00033         OfxRectI procWindowOutput;
00034         
00035         MathOperatorProcessParams<MathOperatorPlugin::Scalar> params = _plugin.getProcessParams();
00036         procWindowOutput = this->translateRoWToOutputClipCoordinates( procWindowRoW );
00037         
00038         rgba32f_pixel_t valuesPix;
00039         valuesPix[ 0 ] = params.iRMathOperator ;
00040         valuesPix[ 1 ] = params.iGMathOperator ;
00041         valuesPix[ 2 ] = params.iBMathOperator ;
00042         valuesPix[ 3 ] = params.iAMathOperator ;
00043         
00044         rgba8_pixel_t processChannel;
00045         processChannel[ 0 ] = params.bRProcess;
00046         processChannel[ 1 ] = params.bGProcess;
00047         processChannel[ 2 ] = params.bBProcess;
00048         processChannel[ 3 ] = params.bAProcess;
00049         
00050         switch(params.op)
00051         {
00052                 case eMathOperatorOperatorPlus     : processImagePlus      ( procWindowOutput, procWindowRoW, valuesPix, processChannel ); break;
00053                 case eMathOperatorOperatorMultiply : processImageMultiply  ( procWindowOutput, procWindowRoW, valuesPix, processChannel ); break;
00054                 case eMathOperatorOperatorPow      : processImagePow       ( procWindowOutput, procWindowRoW, valuesPix, processChannel ); break;
00055                 case eMathOperatorOperatorSqrt     : processImageSqrt      ( procWindowOutput, procWindowRoW, valuesPix, processChannel ); break;
00056                 case eMathOperatorOperatorLog      : processImageLog       ( procWindowOutput, procWindowRoW, valuesPix, processChannel ); break;
00057                 case eMathOperatorOperatorLn       : processImageLn        ( procWindowOutput, procWindowRoW, valuesPix, processChannel ); break;
00058         }
00059 
00060 }
00061 
00062 }
00063 }
00064 }