TuttleOFX  1
FlipPluginFactory.cpp
Go to the documentation of this file.
00001 #include "FlipPluginFactory.hpp"
00002 #include "FlipDefinitions.hpp"
00003 #include "FlipPlugin.hpp"
00004 
00005 #include <tuttle/plugin/exceptions.hpp>
00006 
00007 #include <ofxsParam.h>
00008 #include <ofxsImageEffect.h>
00009 #include <ofxsMultiThread.h>
00010 
00011 #include <limits>
00012 
00013 namespace tuttle {
00014 namespace plugin {
00015 namespace flip {
00016 
00017 /**
00018  * @brief Function called to describe the plugin main features.
00019  * @param[in, out]   desc     Effect descriptor
00020  */
00021 void FlipPluginFactory::describe( OFX::ImageEffectDescriptor& desc )
00022 {
00023         desc.setLabels( "TuttleFlip", "Flip", "Flip-flop image" );
00024         desc.setPluginGrouping( "tuttle/image/process/geometry" );
00025 
00026         desc.setDescription( "Flip\n"
00027                              "Plugin is used to flip and or flop an image." );
00028 
00029         // add the supported contexts
00030         desc.addSupportedContext( OFX::eContextFilter );
00031         desc.addSupportedContext( OFX::eContextGeneral );
00032 
00033         // add supported pixel depths
00034         desc.addSupportedBitDepth( OFX::eBitDepthUByte );
00035         desc.addSupportedBitDepth( OFX::eBitDepthUShort );
00036         desc.addSupportedBitDepth( OFX::eBitDepthFloat );
00037 
00038         // plugin flags
00039         desc.setSupportsTiles( kSupportTiles );
00040         desc.setRenderThreadSafety( OFX::eRenderFullySafe );
00041 }
00042 
00043 /**
00044  * @brief Function called to describe the plugin controls and features.
00045  * @param[in, out]   desc       Effect descriptor
00046  * @param[in]        context    Application context
00047  */
00048 void FlipPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
00049                                            OFX::EContext               context )
00050 {
00051         OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName );
00052         srcClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00053         srcClip->addSupportedComponent( OFX::ePixelComponentRGB );
00054         srcClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00055         srcClip->setSupportsTiles( kSupportTiles );
00056 
00057         OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
00058         dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00059         dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
00060         dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00061         dstClip->setSupportsTiles( kSupportTiles );
00062         
00063         OFX::BooleanParamDescriptor* flip = desc.defineBooleanParam( kParamFlip );
00064         flip->setLabel( kParamFlipLabel );
00065         flip->setHint( kParamFlipHint );
00066         flip->setDefault( false );
00067 
00068         OFX::BooleanParamDescriptor* flop = desc.defineBooleanParam( kParamFlop );
00069         flop->setLabel( kParamFlopLabel );
00070         flop->setHint( kParamFlopHint );
00071         flop->setDefault( false );
00072 
00073 }
00074 
00075 /**
00076  * @brief Function called to create a plugin effect instance
00077  * @param[in] handle  effect handle
00078  * @param[in] context    Application context
00079  * @return  plugin instance
00080  */
00081 OFX::ImageEffect* FlipPluginFactory::createInstance( OfxImageEffectHandle handle,
00082                                                      OFX::EContext        context )
00083 {
00084         return new FlipPlugin( handle );
00085 }
00086 
00087 }
00088 }
00089 }