TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/plugin/interact/InteractInfos.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_PLUGIN_INTERACTINFOS_HPP_
00002 #define _TUTTLE_PLUGIN_INTERACTINFOS_HPP_
00003 
00004 #include <tuttle/plugin/global.hpp>
00005 #include <tuttle/plugin/ofxToGil/point.hpp>
00006 #include <tuttle/plugin/numeric/coordinateSystem.hpp>
00007 #include <terry/globals.hpp>
00008 
00009 #include <ofxsCore.h>
00010 #include <ofxsParam.h>
00011 #include <ofxsImageEffect.h>
00012 
00013 #include <boost/gil/utilities.hpp>
00014 
00015 namespace tuttle {
00016 namespace plugin {
00017 namespace interact {
00018 
00019 class InteractInfos
00020 {
00021 typedef boost::gil::point2<double> Point2;
00022 
00023 public:
00024         InteractInfos( OFX::ImageEffect* effect )
00025                 : _effect( effect )
00026                 , _focus( false )
00027                 , _lastPenPos( 0, 0 )
00028                 , _penDown( false )
00029                 , _projectSize( ofxToGil( effect->getProjectSize() ) )
00030                 , _marge( 0.01 )
00031         {}
00032 
00033         OFX::ImageEffect* _effect;
00034         bool _focus;
00035         Point2 _lastPenPos;
00036         bool _penDown;
00037         Point2 _projectSize; ///< ideally must be the RoW and not a project size...
00038         double _marge;
00039 
00040         template<typename Value>
00041         Value canonicalXXToNormalizedXX( const Value& point ) const { return canonicalXXToNormalizedXX( point, _projectSize ); }
00042         template<typename Value>
00043         Value normalizedXXToCanonicalXX( const Value& point ) const { return normalizedXXToCanonicalXX( point, _projectSize ); }
00044 
00045         template<typename Value>
00046         Value pointCanonicalXYToNormalizedXY( const Value& point ) const { return pointCanonicalXYToNormalizedXY( point, _projectSize ); }
00047         template<typename Point>
00048         Point pointNormalizedXYToCanonicalXY( const Point& point ) const { return pointNormalizedXYToCanonicalXY( point, _projectSize ); }
00049 
00050         //      template<typename Point>
00051         //    Point pointCanonicalXYToNormalizedXX( const Point& point ) const
00052         //      {
00053         //              return pointCanonicalXYToNormalizedXX( point, _imgSize );
00054         //      }
00055         template<typename Point>
00056         Point pointCanonicalXYToNormalizedXXc( const Point& point ) const
00057         {
00058                 return pointCanonicalXYToNormalizedXXc( point, _projectSize );
00059         }
00060 
00061         //      template<typename Point>
00062         //    Point pointNormalizedXXToCanonicalXY( const Point& point ) const
00063         //      {
00064         //              return pointNormalizedXXToCanonicalXY( point, _imgSize );
00065         //      }
00066         template<typename Point>
00067         Point pointNormalizedXXcnToCanonicalXY( const Point& point ) const
00068         {
00069                 return pointNormalizedXXcToCanonicalXY( point, _projectSize );
00070         }
00071 
00072 };
00073 
00074 }
00075 }
00076 }
00077 
00078 #endif
00079