TuttleOFX  1
GeneratorPlugin.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_PLUGIN_CONTEXT_GENERATORPLUGIN_HPP_
00002 #define _TUTTLE_PLUGIN_CONTEXT_GENERATORPLUGIN_HPP_
00003 
00004 #include "GeneratorDefinition.hpp"
00005 
00006 #include <tuttle/plugin/ImageEffectGilPlugin.hpp>
00007 #include <tuttle/plugin/exceptions.hpp>
00008 
00009 namespace tuttle {
00010 namespace plugin {
00011 
00012 class GeneratorPlugin : public OFX::ImageEffect
00013 {
00014 public:
00015         GeneratorPlugin( OfxImageEffectHandle handle );
00016         virtual ~GeneratorPlugin() = 0;
00017 
00018 public:
00019         virtual void changedParam( const OFX::InstanceChangedArgs& args, const std::string& paramName );
00020         virtual bool getRegionOfDefinition( const OFX::RegionOfDefinitionArguments& args, OfxRectD& rod );
00021         virtual void getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences );
00022         virtual bool getTimeDomain( OfxRangeD& range );
00023 
00024         virtual void render( const OFX::RenderArguments& args );
00025 
00026 public:
00027 
00028         EParamGeneratorExplicitConversion getExplicitConversion() const
00029         {
00030                 return static_cast<EParamGeneratorExplicitConversion>( _paramExplicitConv->getValue() );
00031         }
00032 
00033         OFX::EBitDepth getOfxExplicitConversion() const
00034         {
00035                 switch( getExplicitConversion() )
00036                 {
00037                         case eParamGeneratorExplicitConversionByte:
00038                                 return OFX::eBitDepthUByte;
00039                         case eParamGeneratorExplicitConversionShort:
00040                                 return OFX::eBitDepthUShort;
00041                         case eParamGeneratorExplicitConversionFloat:
00042                                 return OFX::eBitDepthFloat;
00043                         case eParamGeneratorExplicitConversionAuto:
00044                                 BOOST_THROW_EXCEPTION( exception::Value() );
00045                 }
00046                 return OFX::eBitDepthNone;
00047         }
00048 
00049 protected:
00050         void updateVisibleTools();
00051 
00052 public:
00053         OFX::Clip*              _clipSrc;  ///< Input image clip
00054         OFX::Clip*              _clipDst;  ///< Destination image clip
00055         /// @name user parameters
00056         /// @{
00057         OFX::ChoiceParam*       _paramExplicitConv; ///< Explicit conversion
00058         OFX::ChoiceParam*       _paramComponents;
00059 
00060         OFX::ChoiceParam*       _paramMode;
00061 
00062         OFX::ChoiceParam*       _paramFormat;
00063 
00064         OFX::Int2DParam*        _paramSize;
00065         OFX::IntParam*          _paramSizeWidth;
00066         OFX::IntParam*          _paramSizeHeight;
00067         OFX::BooleanParam*      _paramSizeSpecificRatio;
00068         OFX::DoubleParam*       _paramSizeRatioValue;
00069         OFX::ChoiceParam*       _paramSizeOrientation;
00070         /// @}
00071 };
00072 
00073 }
00074 }
00075 
00076 #endif
00077