TuttleOFX  1
MathOperatorPlugin.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_PLUGIN_MATHOPERATOR_PLUGIN_HPP_
00002 #define _TUTTLE_PLUGIN_MATHOPERATOR_PLUGIN_HPP_
00003 
00004 #include "MathOperatorDefinitions.hpp"
00005 
00006 #include <tuttle/plugin/ImageEffectGilPlugin.hpp>
00007 
00008 namespace tuttle {
00009 namespace plugin {
00010 namespace mathOperator {
00011 
00012 template<typename Scalar>
00013 struct MathOperatorProcessParams
00014 {
00015         EMathOperatorMathOperator op;   
00016         double              iRMathOperator;
00017         double              iGMathOperator;
00018         double              iBMathOperator;
00019         double              iAMathOperator;
00020         bool                bRProcess;
00021         bool                bGProcess;
00022         bool                bBProcess;
00023         bool                bAProcess;
00024 };
00025 
00026 /**
00027  * @brief MathOperator plugin
00028  */
00029 class MathOperatorPlugin : public ImageEffectGilPlugin
00030 {
00031 public:
00032         typedef float Scalar;
00033 public:
00034     MathOperatorPlugin( OfxImageEffectHandle handle );
00035 
00036 public:
00037         MathOperatorProcessParams<Scalar> getProcessParams( const OfxPointD& renderScale = OFX::kNoRenderScale ) const;
00038 
00039     void changedParam( const OFX::InstanceChangedArgs &args, const std::string &paramName );
00040 
00041 //      bool getRegionOfDefinition( const OFX::RegionOfDefinitionArguments& args, OfxRectD& rod );
00042 //      void getRegionsOfInterest( const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois );
00043         bool isIdentity( const OFX::RenderArguments& args, OFX::Clip*& identityClip, double& identityTime );
00044 
00045     void render( const OFX::RenderArguments &args );
00046         
00047 public:
00048 //    OFX::Clip* _clipSrcMatte; ///< Matte source image clip
00049 
00050 private:
00051 
00052         OFX::ChoiceParam* _operator;
00053         OFX::ChoiceParam* _mathOperatorType;
00054 
00055         OFX::DoubleParam* _master;
00056         OFX::DoubleParam* _red;
00057         OFX::DoubleParam* _green;
00058         OFX::DoubleParam* _blue;
00059         OFX::DoubleParam* _alpha;
00060 
00061         OFX::BooleanParam* _redSelect;
00062         OFX::BooleanParam* _greenSelect;
00063         OFX::BooleanParam* _blueSelect;
00064         OFX::BooleanParam* _alphaSelect;
00065 
00066         EMathOperatorType getMathOperatorType() const { return static_cast<EMathOperatorType>( _mathOperatorType->getValue() ); }
00067         
00068         void updateInterface();
00069         
00070 };
00071 
00072 }
00073 }
00074 }
00075 
00076 #endif