TuttleOFX  1
IdKeyerPluginFactory.cpp
Go to the documentation of this file.
00001 #include "IdKeyerPluginFactory.hpp"
00002 #include "IdKeyerPlugin.hpp"
00003 #include "IdKeyerDefinitions.hpp"
00004 
00005 #include <tuttle/plugin/ImageGilProcessor.hpp>
00006 
00007 #include <algorithm>
00008 
00009 namespace tuttle {
00010 namespace plugin {
00011 namespace idKeyer {
00012 
00013 /**
00014  * @brief Function called to describe the plugin main features.
00015  * @param[in, out]   desc     Effect descriptor
00016  */
00017 void IdKeyerPluginFactory::describe( OFX::ImageEffectDescriptor& desc )
00018 {
00019         desc.setLabels( "TuttleIdKeyer", "IdKeyer", "Id keyer" );
00020         desc.setPluginGrouping( "tuttle/image/process/color" );
00021 
00022         desc.setDescription( "Simplest Keyer: ID selectioner Keyer" );
00023 
00024         // add the supported contexts
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 }
00037 
00038 /**
00039  * @brief Function called to describe the plugin controls and features.
00040  * @param[in, out]   desc       Effect descriptor
00041  * @param[in]        context    Application context
00042  */
00043 void IdKeyerPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
00044                                                                                           OFX::EContext               context )
00045 {
00046         OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName );
00047 
00048         srcClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00049         srcClip->addSupportedComponent( OFX::ePixelComponentRGB );
00050         srcClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00051         srcClip->setSupportsTiles( kSupportTiles );
00052 
00053         // Create the mandated output clip
00054         OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
00055         dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00056         dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
00057         dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00058         dstClip->setSupportsTiles( kSupportTiles );
00059 
00060         OFX::IntParamDescriptor* nbPoint = desc.defineIntParam( kParamNbPoints );
00061         nbPoint->setRange( 1, kMaxNbPoints );
00062         nbPoint->setDisplayRange( 1, kMaxNbPoints );
00063         nbPoint->setDefault( 1 );
00064 
00065         for( size_t i = 0; i < kMaxNbPoints; ++i )
00066         {
00067                 OFX::RGBAParamDescriptor* color = desc.defineRGBAParam( getColorParamName( i ) );
00068                 color->setLabel( getColorParamName( i ) );
00069         }
00070         
00071         OFX::BooleanParamDescriptor* useAlpha = desc.defineBooleanParam( kParamUseAlpha );
00072         useAlpha->setLabel( "Use alpha" );
00073         useAlpha->setDefault( false );
00074         
00075         OFX::DoubleParamDescriptor* tolerance = desc.defineDoubleParam( kParamTolerance );
00076         tolerance->setLabel( "Tolerance" );
00077         tolerance->setDefault( 0.00001 );
00078         tolerance->setRange( 0.0, 1000 );
00079         tolerance->setDisplayRange( 0.0, 1.0 );
00080 }
00081 
00082 /**
00083  * @brief Function called to create a plugin effect instance
00084  * @param[in] handle  effect handle
00085  * @param[in] context    Application context
00086  * @return  plugin instance
00087  */
00088 OFX::ImageEffect* IdKeyerPluginFactory::createInstance( OfxImageEffectHandle handle,
00089                                                                                                                 OFX::EContext        context )
00090 {
00091         return new IdKeyerPlugin( handle );
00092 }
00093 
00094 }
00095 }
00096 }