TuttleOFX
1
|
00001 #ifndef _TUTTLE_PLUGIN_COLORGRADIENT_PLUGIN_HPP_ 00002 #define _TUTTLE_PLUGIN_COLORGRADIENT_PLUGIN_HPP_ 00003 00004 #include <tuttle/plugin/context/GeneratorPlugin.hpp> 00005 #include "ColorGradientDefinitions.hpp" 00006 00007 #include <tuttle/plugin/ImageEffectGilPlugin.hpp> 00008 00009 namespace tuttle { 00010 namespace plugin { 00011 namespace colorGradient { 00012 00013 template<class View> 00014 struct ColorGradientProcessParams 00015 { 00016 typedef typename View::value_type Pixel; 00017 typedef boost::gil::point2<double> Point2; 00018 Point2 _cornerA; 00019 Point2 _cornerB; 00020 std::vector<Point2> _points; 00021 std::vector<Pixel> _colors; 00022 }; 00023 00024 /** 00025 * @brief ColorGradient plugin 00026 */ 00027 class ColorGradientPlugin : public GeneratorPlugin 00028 { 00029 public: 00030 typedef boost::gil::point2<double> Point2; 00031 00032 public: 00033 ColorGradientPlugin( OfxImageEffectHandle handle ); 00034 00035 private: 00036 template<template<typename> class Functor> 00037 void renderFunctor( const OFX::RenderArguments& args ); 00038 00039 public: 00040 void render( const OFX::RenderArguments& args ); 00041 void changedParam( const OFX::InstanceChangedArgs& args, const std::string& paramName ); 00042 void getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ); 00043 00044 template<class View> 00045 ColorGradientProcessParams<View> getProcessParams() const; 00046 00047 public: 00048 typedef std::vector<OFX::Double2DParam*> Double2DParamVector; 00049 typedef std::vector<OFX::RGBAParam*> RGBAParamVector; 00050 00051 Double2DParamVector _points; 00052 RGBAParamVector _colors; 00053 OFX::ChoiceParam* _gradientType; 00054 OFX::IntParam* _nbPoints; 00055 }; 00056 00057 } 00058 } 00059 } 00060 00061 #endif