TuttleOFX
1
|
00001 #ifndef _TUTTLE_PLUGIN_PINNING_PLUGIN_HPP_ 00002 #define _TUTTLE_PLUGIN_PINNING_PLUGIN_HPP_ 00003 00004 #include "PinningDefinitions.hpp" 00005 00006 #include <tuttle/plugin/global.hpp> 00007 00008 #include <tuttle/plugin/context/SamplerPlugin.hpp> 00009 00010 #include <ofxsImageEffect.h> 00011 00012 #include <terry/geometry/pinning.hpp> 00013 #include <terry/sampler/sampler.hpp> 00014 00015 #include <boost/gil/gil_all.hpp> 00016 00017 #include <boost/numeric/ublas/matrix.hpp> 00018 00019 00020 namespace tuttle { 00021 namespace plugin { 00022 namespace pinning { 00023 00024 template<typename Scalar> 00025 struct PinningProcessParams 00026 { 00027 terry::geometry::PinningPerspective<Scalar> _perspective; 00028 terry::geometry::PinningBilinear<Scalar> _bilinear; 00029 00030 EParamMethod _method; 00031 00032 SamplerProcessParams _samplerProcessParams; 00033 }; 00034 00035 /** 00036 * @brief Pinning plugin 00037 */ 00038 class PinningPlugin : public SamplerPlugin 00039 { 00040 public: 00041 typedef double Scalar; 00042 typedef boost::gil::point2<double> Point2; 00043 00044 public: 00045 PinningPlugin( OfxImageEffectHandle handle ); 00046 00047 public: 00048 PinningProcessParams<Scalar> getProcessParams( const OfxTime time, const OfxPointD& renderScale = OFX::kNoRenderScale ) const; 00049 00050 void changedParam( const OFX::InstanceChangedArgs &args, const std::string ¶mName ); 00051 bool isIdentity( const OFX::RenderArguments& args, OFX::Clip*& identityClip, double& identityTime ); 00052 void render( const OFX::RenderArguments &args ); 00053 00054 public: 00055 // do not need to delete these, the ImageEffect is managing them for us 00056 OFX::Clip* _clipSrc; ///< Source image clip 00057 OFX::Clip* _clipDst; ///< Destination image clip 00058 00059 OFX::ChoiceParam* _paramMethod; 00060 OFX::PushButtonParam* _paramSetToCornersIn; 00061 OFX::PushButtonParam* _paramSetToCornersOut; 00062 OFX::BooleanParam* _paramInverse; 00063 00064 // OFX::ChoiceParam* _paramManipulatorMode; 00065 OFX::BooleanParam* _paramOverlay; 00066 00067 /* 00068 //TODO-vince // 00069 OFX::GroupParam* _paramGroupCentre; 00070 OFX::Double2DParam* _paramPointCentre; 00071 OFX::BooleanParam* _paramOverlayCentre; 00072 OFX::RGBParam* _paramOverlayCentreColor; 00073 /////////////////// 00074 */ 00075 00076 OFX::GroupParam* _paramGroupIn; 00077 OFX::Double2DParam* _paramPointIn0; 00078 OFX::Double2DParam* _paramPointIn1; 00079 OFX::Double2DParam* _paramPointIn2; 00080 OFX::Double2DParam* _paramPointIn3; 00081 OFX::BooleanParam* _paramOverlayIn; 00082 OFX::RGBParam* _paramOverlayInColor; 00083 00084 OFX::GroupParam* _paramGroupOut; 00085 OFX::Double2DParam* _paramPointOut0; 00086 OFX::Double2DParam* _paramPointOut1; 00087 OFX::Double2DParam* _paramPointOut2; 00088 OFX::Double2DParam* _paramPointOut3; 00089 OFX::BooleanParam* _paramOverlayOut; 00090 OFX::RGBParam* _paramOverlayOutColor; 00091 00092 OFX::GroupParam* _paramGroupPerspMatrix; 00093 OFX::Double3DParam* _paramPerspMatrixRow0; 00094 OFX::Double3DParam* _paramPerspMatrixRow1; 00095 OFX::Double3DParam* _paramPerspMatrixRow2; 00096 00097 OFX::GroupParam* _paramGroupBilMatrix; 00098 OFX::Double2DParam* _paramBilMatrixRow0; 00099 OFX::Double2DParam* _paramBilMatrixRow1; 00100 OFX::Double2DParam* _paramBilMatrixRow2; 00101 OFX::Double2DParam* _paramBilMatrixRow3; 00102 }; 00103 00104 } 00105 } 00106 } 00107 00108 #endif