TuttleOFX
1
|
00001 #include "RampPluginFactory.hpp" 00002 #include "RampPlugin.hpp" 00003 #include "RampDefinitions.hpp" 00004 #include "ofxsImageEffect.h" 00005 00006 #include <tuttle/plugin/context/GeneratorPluginFactory.hpp> 00007 00008 namespace tuttle { 00009 namespace plugin { 00010 namespace ramp { 00011 00012 static const bool kSupportTiles = false; 00013 00014 00015 /** 00016 * @brief Function called to describe the plugin main features. 00017 * @param[in, out] desc Effect descriptor 00018 */ 00019 void RampPluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00020 { 00021 desc.setLabels( 00022 "TuttleRamp", 00023 "Ramp", 00024 "Ramp" ); 00025 desc.setPluginGrouping( "tuttle/image/generator" ); 00026 00027 desc.setDescription( "Ramp generator." ); 00028 00029 // add the supported contexts 00030 desc.addSupportedContext( OFX::eContextGenerator ); 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.setRenderThreadSafety( OFX::eRenderFullySafe ); 00040 desc.setHostFrameThreading( false ); 00041 desc.setSupportsMultiResolution( false ); 00042 desc.setSupportsMultipleClipDepths( true ); 00043 desc.setSupportsTiles( kSupportTiles ); 00044 } 00045 00046 /** 00047 * @brief Function called to describe the plugin controls and features. 00048 * @param[in, out] desc Effect descriptor 00049 * @param[in] context Application context 00050 */ 00051 void RampPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, 00052 OFX::EContext context ) 00053 { 00054 describeGeneratorParamsInContext( desc, context ); 00055 00056 OFX::ChoiceParamDescriptor* direction = desc.defineChoiceParam( kRampDirection ); 00057 direction->appendOption( "horizontal", "Horizontal" ); 00058 direction->appendOption( "vertical", "Vertical" ); 00059 direction->setLabel( "Ramp Direction" ); 00060 direction->setHint( "Select the ramp direction." ); 00061 00062 OFX::BooleanParamDescriptor* color = desc.defineBooleanParam( kRampColor ); 00063 color->setDefault( false ); 00064 color->setLabel( "Color Ramp" ); 00065 color->setHint( "Enable the R/G/B/Gray ramp." ); 00066 00067 OFX::RGBAParamDescriptor* colorStart = desc.defineRGBAParam( kRampColorStart ); 00068 colorStart->setDefault( 0, 0, 0, 1 ); 00069 colorStart->setLabel( "Start color" ); 00070 00071 OFX::RGBAParamDescriptor* colorEnd = desc.defineRGBAParam( kRampColorEnd ); 00072 colorEnd->setDefault( 1, 1, 1, 1 ); 00073 colorEnd->setLabel( "End Color" ); 00074 } 00075 00076 /** 00077 * @brief Function called to create a plugin effect instance 00078 * @param[in] handle Effect handle 00079 * @param[in] context Application context 00080 * @return plugin instance 00081 */ 00082 OFX::ImageEffect* RampPluginFactory::createInstance( OfxImageEffectHandle handle, 00083 OFX::EContext context ) 00084 { 00085 return new RampPlugin( handle ); 00086 } 00087 00088 } 00089 } 00090 } 00091