TuttleOFX
1
|
00001 #ifndef _TUTTLE_PLUGIN_MERGEPLUGIN_HPP_ 00002 #define _TUTTLE_PLUGIN_MERGEPLUGIN_HPP_ 00003 00004 #include "MergeDefinitions.hpp" 00005 00006 #include <boost/gil/color_convert.hpp> // included first, to use the hack version 00007 #include <tuttle/plugin/ImageEffectGilPlugin.hpp> 00008 00009 namespace tuttle { 00010 namespace plugin { 00011 namespace merge { 00012 00013 template<typename Scalar> 00014 struct MergeProcessParams 00015 { 00016 EParamRod _rod; 00017 00018 boost::gil::point2<std::ptrdiff_t> _offsetA; 00019 boost::gil::point2<std::ptrdiff_t> _offsetB; 00020 }; 00021 00022 /** 00023 * @brief 00024 * 00025 */ 00026 class MergePlugin : public OFX::ImageEffect 00027 { 00028 public: 00029 typedef float Scalar; 00030 private: 00031 template<template <typename> class Functor> 00032 void renderGray( const OFX::RenderArguments& args ); 00033 00034 template<template <typename> class Functor> 00035 void renderRGBA( const OFX::RenderArguments& args ); 00036 00037 public: 00038 MergePlugin( OfxImageEffectHandle handle ); 00039 00040 public: 00041 MergeProcessParams<Scalar> getProcessParams( const OfxPointD& renderScale = OFX::kNoRenderScale ) const; 00042 00043 // void changedParam( const OFX::InstanceChangedArgs& args, const std::string& paramName ); 00044 00045 bool getRegionOfDefinition( const OFX::RegionOfDefinitionArguments& args, OfxRectD& rod ); 00046 00047 void render( const OFX::RenderArguments& args ); 00048 00049 private: 00050 template< class View > 00051 void render( const OFX::RenderArguments& args ); 00052 template< class View, template <typename> class Functor > 00053 void render( const OFX::RenderArguments& args ); 00054 00055 template< class View, template <typename> class Functor > 00056 void render_if( const OFX::RenderArguments& args, boost::mpl::false_ ); 00057 template< class View, template <typename> class Functor > 00058 void render_if( const OFX::RenderArguments& args, boost::mpl::true_ ); 00059 00060 public: 00061 OFX::Clip* _clipSrcA; ///< Source image clip A 00062 OFX::Clip* _clipSrcB; ///< Source image clip B 00063 OFX::Clip* _clipDst; ///< Destination image clip 00064 00065 OFX::ChoiceParam* _paramMerge; ///< Functor structure 00066 OFX::ChoiceParam* _paramRod; 00067 OFX::Int2DParam* _paramOffsetA; 00068 OFX::Int2DParam* _paramOffsetB; 00069 }; 00070 00071 } 00072 } 00073 } 00074 00075 #endif