TuttleOFX  1
FlipPlugin.cpp
Go to the documentation of this file.
00001 #include "FlipDefinitions.hpp"
00002 #include "FlipPlugin.hpp"
00003 #include "FlipProcess.hpp"
00004 
00005 #include <tuttle/plugin/ofxToGil/point.hpp>
00006 
00007 #include <boost/gil/gil_all.hpp>
00008 #include <boost/math/special_functions/round.hpp>
00009 
00010 namespace tuttle {
00011 namespace plugin {
00012 namespace flip {
00013 
00014 using namespace boost::math;
00015 using namespace boost::gil;
00016 
00017 FlipPlugin::FlipPlugin( OfxImageEffectHandle handle )
00018 : ImageEffectGilPlugin( handle )
00019 {
00020         _paramFlip = fetchBooleanParam( kParamFlip );
00021         _paramFlop = fetchBooleanParam( kParamFlop );
00022 }
00023 
00024 OfxRectI FlipPlugin::computeFlipRegion( const OfxTime time, const bool fromRatio ) const
00025 {
00026         const OfxRectI sRod = _clipSrc->getPixelRod( time );
00027         return sRod;
00028 }
00029 
00030 FlipProcessParams FlipPlugin::getProcessParams( const OfxTime time, const OfxPointD& renderScale ) const
00031 {
00032         FlipProcessParams params;
00033 
00034         params.flip = _paramFlip->getValue( );
00035         params.flop = _paramFlop->getValue( );
00036 
00037         return params;
00038 }
00039 
00040 void FlipPlugin::getRegionsOfInterest( const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois )
00041 {
00042 //      FlipProcessParams params = getProcessParams( args.time, args.renderScale );
00043 //      if( params.flip )
00044 //      {
00045 //              /// @todo needs to transform args.regionOfInterest, like in the compute function
00046 //      }
00047 //      if( params.flop )
00048 //      {
00049 //              /// @todo needs to transform args.regionOfInterest, like in the compute function
00050 //      }
00051         OfxRectD srcRod = _clipSrc->getCanonicalRod( args.time );
00052         rois.setRegionOfInterest( *this->_clipSrc, srcRod );
00053 }
00054 
00055 bool FlipPlugin::isIdentity( const OFX::RenderArguments& args, OFX::Clip*& identityClip, double& identityTime )
00056 {
00057         FlipProcessParams params = getProcessParams( args.time, args.renderScale );
00058         if( params.flip || params.flop )
00059                 return false;
00060 
00061         identityClip = _clipSrc;
00062         identityTime = args.time;
00063         return true;
00064 }
00065 
00066 /**
00067  * @brief The overridden render function
00068  * @param[in]   args     Rendering parameters
00069  */
00070 void FlipPlugin::render( const OFX::RenderArguments& args )
00071 {
00072         doGilRender<FlipProcess > ( *this, args );
00073 }
00074 
00075 }
00076 }
00077 }