TuttleOFX  1
BasicKeyerPluginFactory.cpp
Go to the documentation of this file.
00001 #include "BasicKeyerPluginFactory.hpp"
00002 #include "BasicKeyerPlugin.hpp"
00003 #include "BasicKeyerDefinitions.hpp"
00004 
00005 #include <tuttle/plugin/ImageGilProcessor.hpp>
00006 
00007 namespace tuttle {
00008 namespace plugin {
00009 namespace basicKeyer {
00010 
00011 /**
00012  * @brief Function called to describe the plugin main features.
00013  * @param[in, out]   desc     Effect descriptor
00014  */
00015 void BasicKeyerPluginFactory::describe( OFX::ImageEffectDescriptor& desc )
00016 {
00017         desc.setLabels( "TuttleBasicKeyer", "BasicKeyer",
00018                         "Basic keyer" );
00019         desc.setPluginGrouping( "tuttle/image/process/color" );
00020 
00021         desc.setDescription( "Plugin under early development." );
00022 
00023         // add the supported contexts
00024         desc.addSupportedContext( OFX::eContextFilter );
00025         desc.addSupportedContext( OFX::eContextGeneral );
00026 
00027         // add supported pixel depths
00028         desc.addSupportedBitDepth( OFX::eBitDepthUByte );
00029         desc.addSupportedBitDepth( OFX::eBitDepthUShort );
00030         desc.addSupportedBitDepth( OFX::eBitDepthFloat );
00031 
00032         // plugin flags
00033         desc.setSupportsTiles( kSupportTiles );
00034         desc.setRenderThreadSafety( OFX::eRenderFullySafe );
00035 }
00036 
00037 /**
00038  * @brief Function called to describe the plugin controls and features.
00039  * @param[in, out]   desc       Effect descriptor
00040  * @param[in]        context    Application context
00041  */
00042 void BasicKeyerPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
00043                                                  OFX::EContext               context )
00044 {
00045         OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName );
00046 
00047         srcClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00048         srcClip->addSupportedComponent( OFX::ePixelComponentRGB );
00049         srcClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00050         srcClip->setSupportsTiles( kSupportTiles );
00051 
00052         // Create the mandated output clip
00053         OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
00054         dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00055         dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
00056         dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00057         dstClip->setSupportsTiles( kSupportTiles );
00058 
00059         OFX::ChoiceParamDescriptor* mode = desc.defineChoiceParam( kParamMode );
00060         mode->appendOption( kParamModePosition );
00061         mode->appendOption( kParamModeColor );
00062         mode->setDefault( 0 );
00063 
00064         OFX::IntParamDescriptor* nbPoint = desc.defineIntParam( kParamNbPoints );
00065         nbPoint->setRange( 1, kMaxNbPoints );
00066         nbPoint->setDisplayRange( 1, 10 );
00067         nbPoint->setDefault( 1 );
00068 
00069         for( unsigned int i = 0; i < kMaxNbPoints; ++i )
00070         {
00071                 OFX::Double2DParamDescriptor* point = desc.defineDouble2DParam( getPointParamName( i ) );
00072                 point->setLabel( getPointParamName( i ) );
00073                 //              point->setIsSecret( true );
00074                 point->setDoubleType( OFX::eDoubleTypeNormalisedXYAbsolute );
00075                 OFX::RGBAParamDescriptor* color = desc.defineRGBAParam( getColorParamName( i ) );
00076                 color->setLabel( getColorParamName( i ) );
00077                 //              color->setIsSecret( true );
00078         }
00079 }
00080 
00081 /**
00082  * @brief Function called to create a plugin effect instance
00083  * @param[in] handle  effect handle
00084  * @param[in] context    Application context
00085  * @return  plugin instance
00086  */
00087 OFX::ImageEffect* BasicKeyerPluginFactory::createInstance( OfxImageEffectHandle handle,
00088                                                            OFX::EContext        context )
00089 {
00090         return new BasicKeyerPlugin( handle );
00091 }
00092 
00093 }
00094 }
00095 }