TuttleOFX  1
CheckerboardPluginFactory.cpp
Go to the documentation of this file.
00001 #include "CheckerboardPluginFactory.hpp"
00002 #include "CheckerboardPlugin.hpp"
00003 #include "CheckerboardDefinitions.hpp"
00004 
00005 #include <tuttle/plugin/context/GeneratorPluginFactory.hpp>
00006 #include <tuttle/plugin/exceptions.hpp>
00007 
00008 #include <ofxsImageEffect.h>
00009 #include <ofxsMultiThread.h>
00010 
00011 namespace tuttle {
00012 namespace plugin {
00013 namespace checkerboard {
00014 
00015 /**
00016  * @brief Function called to describe the plugin main features.
00017  * @param[in, out]   desc     Effect descriptor
00018  */
00019 void CheckerboardPluginFactory::describe( OFX::ImageEffectDescriptor& desc )
00020 {
00021         desc.setLabels( "TuttleCheckerboard", "Checkerboard",
00022                         "Checkerboard" );
00023         desc.setPluginGrouping( "tuttle/image/generator" );
00024 
00025         desc.setDescription(
00026 "Checkerboard / square tiling / square grid / quadrille"
00027 "\n"
00028 "is a regular tiling of the Euclidean plane."
00029 "\n"
00030 "It is often used for its ability to be detected by a simple corner detect filter."
00031 "\n"
00032 "\n"
00033 "http://en.wikipedia.org/wiki/Square_tiling"
00034 );
00035 
00036         // add the supported contexts
00037         desc.addSupportedContext( OFX::eContextGenerator );
00038         desc.addSupportedContext( OFX::eContextGeneral );
00039 
00040         // add supported pixel depths
00041         desc.addSupportedBitDepth( OFX::eBitDepthUByte );
00042         desc.addSupportedBitDepth( OFX::eBitDepthUShort );
00043         desc.addSupportedBitDepth( OFX::eBitDepthFloat );
00044 
00045         // plugin flags
00046         desc.setRenderThreadSafety( OFX::eRenderFullySafe );
00047         desc.setHostFrameThreading( false );
00048         desc.setSupportsMultiResolution( false );
00049         desc.setSupportsMultipleClipDepths( true );
00050         desc.setSupportsTiles( kSupportTiles );
00051 }
00052 
00053 /**
00054  * @brief Function called to describe the plugin controls and features.
00055  * @param[in, out]   desc       Effect descriptor
00056  * @param[in]        context    Application context
00057  */
00058 void CheckerboardPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
00059                                                    OFX::EContext               context )
00060 {
00061         describeGeneratorParamsInContext( desc, context );
00062 
00063         OFX::Int2DParamDescriptor* boxes = desc.defineInt2DParam( kCheckerboardBoxes );
00064         boxes->setDefault( 10, 10 );
00065         boxes->setLabel( "boxes number" );
00066         boxes->setHint( "Number of boxes of the checkerboard." );
00067 
00068         OFX::RGBAParamDescriptor* color1 = desc.defineRGBAParam( kCheckerboardColor1 );
00069         color1->setDefault( 0, 0, 0, 1 );
00070         color1->setLabel( "color1" );
00071 
00072         OFX::RGBAParamDescriptor* color2 = desc.defineRGBAParam( kCheckerboardColor2 );
00073         color2->setDefault( 1, 1, 1, 1 );
00074         color2->setLabel( "color2" );
00075 }
00076 
00077 /**
00078  * @brief Function called to create a plugin effect instance
00079  * @param[in] handle  effect handle
00080  * @param[in] context    Application context
00081  * @return  plugin instance
00082  */
00083 OFX::ImageEffect* CheckerboardPluginFactory::createInstance( OfxImageEffectHandle handle,
00084                                                              OFX::EContext        context )
00085 {
00086         return new CheckerboardPlugin( handle );
00087 }
00088 
00089 }
00090 }
00091 }