TuttleOFX  1
DiffPlugin.cpp
Go to the documentation of this file.
00001 #include "DiffPlugin.hpp"
00002 #include "DiffProcess.hpp"
00003 
00004 #include <boost/gil/gil_all.hpp>
00005 
00006 namespace tuttle {
00007 namespace plugin {
00008 namespace quality {
00009 
00010 
00011 DiffPlugin::DiffPlugin( OfxImageEffectHandle handle )
00012         : OFX::ImageEffect( handle )
00013 {
00014         _clipSrcA = fetchClip( kDiffSourceA );
00015         _clipSrcB = fetchClip( kDiffSourceB );
00016         _clipDst  = fetchClip( kOfxImageEffectOutputClipName );
00017 
00018         _measureFunction = fetchChoiceParam ( kMeasureFunction );
00019         _qualityMesure   = fetchRGBAParam( kOutputQualityMesure );
00020 }
00021 
00022 DiffProcessParams DiffPlugin::getProcessParams() const
00023 {
00024         DiffProcessParams params;
00025         params.measureFunction = static_cast<EMeasureFunction>( _measureFunction->getValue() );
00026 
00027         return params;
00028 }
00029 
00030 void DiffPlugin::changedParam( const OFX::InstanceChangedArgs& args, const std::string& paramName )
00031 {
00032 }
00033 
00034 bool DiffPlugin::getRegionOfDefinition( const OFX::RegionOfDefinitionArguments& args, OfxRectD& rod )
00035 {
00036         const OfxRectD irod = rectanglesIntersection( _clipSrcA->getCanonicalRod( args.time ),
00037                                                       _clipSrcB->getCanonicalRod( args.time ) );
00038 
00039         // Intersection of A & B
00040         rod.x1 = irod.x1;
00041         rod.x2 = irod.x2;
00042         rod.y1 = irod.y1;
00043         rod.y2 = irod.y2;
00044         return true;
00045 }
00046 /**
00047  * @brief The overridden render function
00048  * @param[in]   args     Rendering parameters
00049  */
00050 void DiffPlugin::render( const OFX::RenderArguments& args )
00051 {
00052         doGilRender<DiffProcess>( *this, args );
00053 }
00054 
00055 
00056 }
00057 }
00058 }