TuttleOFX
1
|
00001 #include "ColorGradientPluginFactory.hpp" 00002 #include "ColorGradientPlugin.hpp" 00003 #include "ColorGradientDefinitions.hpp" 00004 00005 #include <tuttle/plugin/context/GeneratorPluginFactory.hpp> 00006 #include <tuttle/plugin/ImageGilProcessor.hpp> 00007 00008 00009 namespace tuttle { 00010 namespace plugin { 00011 namespace colorGradient { 00012 00013 /** 00014 * @brief Function called to describe the plugin main features. 00015 * @param[in, out] desc Effect descriptor 00016 */ 00017 void ColorGradientPluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00018 { 00019 desc.setLabels( "TuttleColorGradient", "ColorGradient", 00020 "Create a color gradient" ); 00021 desc.setPluginGrouping( "tuttle/image/generator" ); 00022 00023 // add the supported contexts 00024 desc.addSupportedContext( OFX::eContextGeneral ); 00025 desc.addSupportedContext( OFX::eContextFilter ); 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.setRenderThreadSafety( OFX::eRenderFullySafe ); 00034 desc.setHostFrameThreading( false ); 00035 desc.setSupportsMultiResolution( false ); 00036 desc.setSupportsMultipleClipDepths( true ); 00037 desc.setSupportsTiles( kSupportTiles ); 00038 } 00039 00040 /** 00041 * @brief Function called to describe the plugin controls and features. 00042 * @param[in, out] desc Effect descriptor 00043 * @param[in] context Application context 00044 */ 00045 void ColorGradientPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, 00046 OFX::EContext context ) 00047 { 00048 describeGeneratorParamsInContext( desc, context ); 00049 00050 OFX::ChoiceParamDescriptor* gradientType = desc.defineChoiceParam( kGradientType ); 00051 gradientType->appendOption( kGradientType1DLinear ); 00052 gradientType->appendOption( kGradientType1DRadial ); 00053 gradientType->appendOption( kGradientType2D ); 00054 gradientType->setDefault( 0 ); 00055 00056 OFX::IntParamDescriptor* nbPoint = desc.defineIntParam( kNbPoints ); 00057 nbPoint->setDefault( 2 ); 00058 nbPoint->setRange( 2, kMaxNbPoints ); 00059 nbPoint->setDisplayRange( 2, kMaxNbPoints ); 00060 00061 for( unsigned int i = 0; i < kMaxNbPoints; ++i ) 00062 { 00063 OFX::Double2DParamDescriptor* point = desc.defineDouble2DParam( getPointParamName( i ) ); 00064 point->setLabel( getPointParamName( i ) ); 00065 // point->setIsSecret( true ); 00066 point->setDoubleType( OFX::eDoubleTypeNormalisedXYAbsolute ); 00067 OFX::RGBAParamDescriptor* color = desc.defineRGBAParam( getColorParamName( i ) ); 00068 color->setLabel( getColorParamName( i ) ); 00069 // color->setIsSecret( true ); 00070 } 00071 } 00072 00073 /** 00074 * @brief Function called to create a plugin effect instance 00075 * @param[in] handle effect handle 00076 * @param[in] context Application context 00077 * @return plugin instance 00078 */ 00079 OFX::ImageEffect* ColorGradientPluginFactory::createInstance( OfxImageEffectHandle handle, 00080 OFX::EContext context ) 00081 { 00082 return new ColorGradientPlugin( handle ); 00083 } 00084 00085 } 00086 } 00087 }