TuttleOFX  1
HistogramKeyerOverlay.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_PLUGIN_HISTOGRAMKEYEROVERLAY_HPP_
00002 #define _TUTTLE_PLUGIN_HISTOGRAMKEYEROVERLAY_HPP_
00003 
00004 #include "HistogramKeyerPlugin.hpp"
00005 #include "RGBOverlay.hpp"
00006 #include "HSLOverlay.hpp"
00007 
00008 #include <tuttle/plugin/global.hpp>
00009 #include <tuttle/plugin/interact/interact.hpp>
00010 #include <tuttle/plugin/interact/InteractInfos.hpp>
00011 #include <tuttle/plugin/ImageEffectGilPlugin.hpp>
00012 
00013 #include <ofxsImageEffect.h>
00014 #include <ofxsInteract.h>
00015 
00016 namespace tuttle {
00017 namespace plugin {
00018 namespace histogramKeyer {
00019 
00020 class HistogramKeyerOverlay : public OFX::OverlayInteract
00021 {
00022         typedef double Scalar;
00023         typedef OfxRGBColourF Color;
00024         
00025 public: 
00026         /*Class arguments*/
00027         HistogramKeyerPlugin* _plugin;                  //plugin reference
00028         interact::InteractInfos _infos;                         
00029         
00030         bool _penDown;                                                  //is mouse under selection
00031         bool _keyDown;                                                  //is key under selection
00032         OfxPointI _origin;                                              //begin of the current selection
00033         OfxPointI _end;                                                 //end of the current selection
00034         OfxPointI _squareBegin;                                 //begin of square selection
00035         OfxPointI _squareEnd;                                   //end of square selection                       
00036         
00037         bool _isFirstTime;                                              //temporary
00038         
00039         /* temporary when Nuke doesn't support parametric parameter overlay */
00040         HSLOverlay _hslParam;
00041         RGBOverlay _rgbParam;
00042 
00043         /*Creator*/
00044         HistogramKeyerOverlay( OfxInteractHandle handle, OFX::ImageEffect* effect );
00045         ~HistogramKeyerOverlay();
00046         
00047         bool draw( const OFX::DrawArgs& args ); //draw all of the component (main display)
00048         
00049         /*Mouse management*/
00050         bool penDown( const OFX::PenArgs& args );       //mouse/pen is clicking down
00051         bool penUp( const OFX::PenArgs& args );         //mouse/pen is releasing
00052         bool penMotion( const OFX::PenArgs& args );     //mouse/pen is under motion
00053         
00054         /*Keyboard management*/
00055         bool keyDown( const OFX::KeyArgs& args );       //Ctrl key is pressing down
00056         bool keyUp( const OFX::KeyArgs& args );         //Ctrl key is releasing 
00057         
00058         /*Selection help (display)*/
00059         void displaySelectedAreas( const OfxPointI& fullImgSize, const OfxPointI& imgSize, const OfxRectI& pixelRoD);   //display the selected areas (texture)
00060         void displaySelectionZone();    //display the current selection zone (white square)
00061         
00062         /*Get overlay data*/
00063         OverlayData& getOverlayData();
00064 private:
00065         void drawWarning(const Ofx3DPointD& centerPoint, const double ratio);           //draw a warning signal
00066 };
00067 
00068 class RGBParamOverlayDescriptor : public OFX::ParamInteractDescriptor
00069 {
00070 public:
00071         OFX::Interact* createInstance( OfxInteractHandle handle, OFX::ImageEffect* effect )
00072         {
00073                 //return new RGBOverlay( handle, effect ); (when Nuke overlay works)
00074                 return NULL; //temporary
00075         }
00076 };
00077 
00078 class HSLParamOverlayDescriptor : public OFX::ParamInteractDescriptor
00079 {
00080 public:
00081         OFX::Interact* createInstance( OfxInteractHandle handle, OFX::ImageEffect* effect )
00082         {
00083                 //return new HSLOverlay( handle, effect ); (when Nuke overlay works)
00084                 return NULL; //temporary
00085         }
00086 };
00087 
00088 class HistogramKeyerOverlayDescriptor : public OFX::EffectOverlayDescriptor
00089 {
00090 public:
00091         OFX::Interact* createInstance( OfxInteractHandle handle, OFX::ImageEffect* effect )
00092         {
00093                 return new HistogramKeyerOverlay( handle, effect );
00094         }
00095 };
00096 
00097 }
00098 }
00099 }
00100 
00101 #endif