TuttleOFX  1
ThinningPlugin.cpp
Go to the documentation of this file.
00001 #include "ThinningPlugin.hpp"
00002 #include "ThinningProcess.hpp"
00003 #include "ThinningDefinitions.hpp"
00004 
00005 #include <boost/gil/gil_all.hpp>
00006 
00007 namespace tuttle {
00008 namespace plugin {
00009 namespace thinning {
00010 
00011 ThinningPlugin::ThinningPlugin( OfxImageEffectHandle handle )
00012 : ImageEffectGilPlugin( handle )
00013 {
00014         _paramBorder = fetchChoiceParam( kParamBorder );
00015 }
00016 
00017 ThinningProcessParams<ThinningPlugin::Scalar> ThinningPlugin::getProcessParams( const OfxPointD& renderScale ) const
00018 {
00019         ThinningProcessParams<Scalar> params;
00020         params._border = static_cast<EParamBorder>( _paramBorder->getValue() );
00021         return params;
00022 }
00023 
00024 bool ThinningPlugin::getRegionOfDefinition( const OFX::RegionOfDefinitionArguments& args, OfxRectD& rod )
00025 {
00026         ThinningProcessParams<Scalar> params = getProcessParams();
00027         const OfxRectD srcRod = _clipSrc->getCanonicalRod( args.time );
00028 
00029         switch( params._border )
00030         {
00031                 case eParamBorderPadded:
00032                         rod = rectangleReduce( srcRod, 2 );
00033                         return true;
00034                 default:
00035                         break;
00036         }
00037         return false;
00038 }
00039 
00040 void ThinningPlugin::getRegionsOfInterest( const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois )
00041 {
00042         const OfxRectD srcRod = _clipSrc->getCanonicalRod( args.time );
00043         
00044         const OfxRectD srcRoi = rectangleGrow( srcRod, 2 );
00045 
00046         rois.setRegionOfInterest( *_clipSrc, srcRoi );
00047 }
00048 
00049 
00050 /**
00051  * @brief The overridden render function
00052  * @param[in]   args     Rendering parameters
00053  */
00054 void ThinningPlugin::render( const OFX::RenderArguments &args )
00055 {
00056         doGilRender<ThinningProcess>( *this, args );
00057 }
00058 
00059 }
00060 }
00061 }