TuttleOFX
1
|
00001 #ifndef _TUTTLE_PLUGIN_COLORSPACEKEYER_PLUGIN_HPP_ 00002 #define _TUTTLE_PLUGIN_COLORSPACEKEYER_PLUGIN_HPP_ 00003 00004 #include "ColorSpaceKeyerDefinitions.hpp" 00005 #include "CloudPointData.hpp" 00006 00007 #include <tuttle/plugin/ImageEffectGilPlugin.hpp> 00008 00009 00010 00011 namespace tuttle { 00012 namespace plugin { 00013 namespace colorSpaceKeyer { 00014 00015 template<typename Scalar> 00016 struct ColorSpaceKeyerProcessParams 00017 { 00018 OFX::Clip* _clipColor; //clip color 00019 ColorSpaceKeyerProcessParams() 00020 : _clipColor( NULL ) 00021 { 00022 } 00023 }; 00024 00025 //Structure used to evite to recompute geodesic form on each render 00026 struct CSProcessParams 00027 { 00028 OfxTime time; //current time 00029 bool recomputeGeodesicForm; //does data need to recomputed 00030 //Create geodesic form 00031 GeodesicForm geodesicFormColor; //color form 00032 GeodesicForm geodesicFormSpill; //spill form 00033 }; 00034 00035 00036 /** 00037 * @brief ColorSpaceKeyer plugin 00038 */ 00039 class ColorSpaceKeyerPlugin : public ImageEffectGilPlugin 00040 { 00041 public: 00042 typedef float Scalar; 00043 00044 // clips 00045 OFX::Clip* _clipColor; // clip color 00046 OFX::Clip* _clipSpill; // clip spill 00047 00048 //parameters 00049 OFX::BooleanParam* _paramBoolPointCloudDisplay; // display cloud point - check box 00050 OFX::BooleanParam* _paramBoolDiscretizationActive; // is discretization active on point cloud - check box 00051 OFX::IntParam* _paramIntDiscretization; // discretization step - Int parameter 00052 OFX::IntParam* _paramIntNbOfDivisionsGF; // number of divisions geodesic form - Int parameter 00053 OFX::BooleanParam* _paramBoolDisplayGeodesicForm; // see color geodesic form on screen - check box 00054 OFX::ChoiceParam* _paramChoiceAverageMode; // choice average mode - Choice parameter 00055 OFX::RGBAParam* _paramRGBAColorSelection; // color average selection - RGBA parameter 00056 OFX::PushButtonParam* _paramPushButtonAverageCompute; // color average computing - Push button 00057 OFX::BooleanParam* _paramBoolSeeSelection; // see color selection on overlay - check box 00058 OFX::DoubleParam* _paramDoubleScaleGF; // scale geodesic form - Double parameters 00059 OFX::BooleanParam* _paramBoolSeeSpillSelection; // see spill selection on overlay - check box 00060 OFX::BooleanParam* _paramBoolDisplaySpillGF; // see spill geodesic form on screen - check box 00061 00062 //Overlay data parameters 00063 bool _updateVBO; // VBO data has been changed so update VBO 00064 bool _updateAverage; // Color clip source has changed so update average 00065 bool _updateGeodesicForm; // Average of Geodesic parameters has changed so update 00066 bool _updateGeodesicFormAverage; // Change Geodesic average parameters 00067 bool _resetViewParameters; // Push button - reset transform parameters has changed 00068 bool _presetAverageSelection; // Compute average selection in overlay 00069 00070 //Render attributes 00071 OfxPointD _renderScale; // current render scale 00072 OfxTime _time; // current time 00073 00074 //Process attributes 00075 CSProcessParams _renderAttributes; // contain current time and if data need to be recomputed 00076 00077 //Scoped pointer attributes 00078 boost::scoped_ptr<CloudPointData> _cloudPointData; // scoped pointer points the overlay data (or NULL) 00079 std::size_t _cloudPointDataCount; // count (class calling scoped pointer) 00080 00081 public: 00082 ColorSpaceKeyerPlugin( OfxImageEffectHandle handle ); 00083 00084 ColorSpaceKeyerProcessParams<Scalar> getProcessParams( const OfxPointD& renderScale = OFX::kNoRenderScale ) const; 00085 00086 /*Input function*/ 00087 void changedParam( const OFX::InstanceChangedArgs &args, const std::string& paramName ); // a GUI param has changed 00088 void changedClip ( const OFX::InstanceChangedArgs& args, const std::string& clipName ); // the source clip has changed 00089 00090 // bool getRegionOfDefinition( const OFX::RegionOfDefinitionArguments& args, OfxRectD& rod ); 00091 // void getRegionsOfInterest( const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois ); 00092 00093 bool isIdentity( const OFX::RenderArguments& args, OFX::Clip*& identityClip, double& identityTime ); //does plugin do something 00094 00095 void render( const OFX::RenderArguments &args ); //treatment 00096 00097 /** @brief client end sequence render function, this is one of the few that must be set */ 00098 void endSequenceRender( const OFX::EndSequenceRenderArguments& args ) 00099 { 00100 // clear maps of process datas 00101 } 00102 00103 //Overlay data functions 00104 void addRefCloudPointData(); // add reference to cloud point data 00105 void releaseCloudPointData(); // release reference to cloud point data 00106 bool hasCloudPointData() const; // is there cloud point data ? 00107 CloudPointData& getCloudPointData(); // getter/setter 00108 const CloudPointData& getCloudPointData() const; // const getter 00109 private: 00110 void updateGeodesicForms(const OFX::InstanceChangedArgs& args); //update color & spill geodesic forms 00111 void updateProcessGeodesicForms(const OFX::RenderArguments &args); //update color & spill geodesic forms (used in process) 00112 }; 00113 00114 } 00115 } 00116 } 00117 00118 #endif