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