TuttleOFX  1
ThinningPluginFactory.cpp
Go to the documentation of this file.
00001 #include "ThinningPluginFactory.hpp"
00002 #include "ThinningPlugin.hpp"
00003 #include "ThinningDefinitions.hpp"
00004 
00005 #include <ofxsImageEffect.h>
00006 
00007 #include <limits>
00008 
00009 namespace tuttle {
00010 namespace plugin {
00011 namespace thinning {
00012 
00013 static const bool kSupportTiles = true;
00014 
00015 
00016 /**
00017  * @brief Function called to describe the plugin main features.
00018  * @param[in, out] desc Effect descriptor
00019  */
00020 void ThinningPluginFactory::describe( OFX::ImageEffectDescriptor& desc )
00021 {
00022         desc.setLabels( "TuttleThinning", "Thinning",
00023                             "Thinning" );
00024         desc.setPluginGrouping( "tuttle/image/process/filter" );
00025 
00026         // add the supported contexts, only filter at the moment
00027         desc.addSupportedContext( OFX::eContextFilter );
00028         desc.addSupportedContext( OFX::eContextGeneral );
00029 
00030         // add supported pixel depths
00031         desc.addSupportedBitDepth( OFX::eBitDepthUByte );
00032         desc.addSupportedBitDepth( OFX::eBitDepthUShort );
00033         desc.addSupportedBitDepth( OFX::eBitDepthFloat );
00034 
00035         // plugin flags
00036         desc.setSupportsTiles( kSupportTiles );
00037         desc.setRenderThreadSafety( OFX::eRenderFullySafe );
00038 }
00039 
00040 /**
00041  * @brief Function called to describe the plugin controls and features.
00042  * @param[in, out]   desc       Effect descriptor
00043  * @param[in]        context    Application context
00044  */
00045 void ThinningPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
00046                                                   OFX::EContext context )
00047 {
00048         OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName );
00049         srcClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00050         srcClip->addSupportedComponent( OFX::ePixelComponentRGB );
00051         srcClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00052         srcClip->setSupportsTiles( kSupportTiles );
00053 
00054         // Create the mandated output clip
00055         OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
00056         dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00057         dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
00058         dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00059         dstClip->setSupportsTiles( kSupportTiles );
00060 
00061         OFX::ChoiceParamDescriptor* border = desc.defineChoiceParam( kParamBorder );
00062         border->setLabel( "Gradient border" );
00063         border->setHint( "Border method for gradient computation." );
00064         border->appendOption( kParamBorderBlack );
00065         border->appendOption( kParamBorderPadded );
00066 //      border->appendOption( kParamBorderMirror );
00067 //      border->appendOption( kParamBorderConstant );
00068         border->setDefault( 1 );
00069 }
00070 
00071 /**
00072  * @brief Function called to create a plugin effect instance
00073  * @param[in] handle  Effect handle
00074  * @param[in] context Application context
00075  * @return  plugin instance
00076  */
00077 OFX::ImageEffect* ThinningPluginFactory::createInstance( OfxImageEffectHandle handle,
00078                                                             OFX::EContext context )
00079 {
00080         return new ThinningPlugin( handle );
00081 }
00082 
00083 }
00084 }
00085 }
00086