TuttleOFX
1
|
00001 #include "ComponentPluginFactory.hpp" 00002 #include "ComponentPlugin.hpp" 00003 #include "ComponentDefinitions.hpp" 00004 #include "ofxsImageEffect.h" 00005 00006 #include <limits> 00007 00008 namespace tuttle { 00009 namespace plugin { 00010 namespace component { 00011 00012 static const bool kSupportTiles = false; 00013 00014 /** 00015 * @brief Function called to describe the plugin main features. 00016 * @param[in, out] desc Effect descriptor 00017 */ 00018 void ComponentPluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00019 { 00020 desc.setLabels( "TuttleComponent", "Component", 00021 "Component convertor" ); 00022 desc.setPluginGrouping( "tuttle/image/process/channel" ); 00023 00024 desc.setDescription( "Convert channels components." ); 00025 00026 // add the supported contexts, only filter at the moment 00027 desc.addSupportedContext( OFX::eContextFilter ); 00028 desc.addSupportedContext( OFX::eContextGeneral ); 00029 00030 // add supported pixel depths 00031 desc.addSupportedBitDepth( OFX::eBitDepthUByte ); 00032 desc.addSupportedBitDepth( OFX::eBitDepthUShort ); 00033 desc.addSupportedBitDepth( OFX::eBitDepthFloat ); 00034 00035 // plugin flags 00036 desc.setSupportsTiles( kSupportTiles ); 00037 desc.setRenderThreadSafety( OFX::eRenderFullySafe ); 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 ComponentPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, 00046 OFX::EContext context ) 00047 { 00048 OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName ); 00049 srcClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00050 srcClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00051 srcClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00052 srcClip->setSupportsTiles( kSupportTiles ); 00053 00054 // Create the mandated output clip 00055 OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); 00056 dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00057 dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00058 dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00059 dstClip->setSupportsTiles( kSupportTiles ); 00060 00061 OFX::ChoiceParamDescriptor* outTo = desc.defineChoiceParam( kParamTo ); 00062 outTo->setLabel( kParamToLabel ); 00063 outTo->appendOption( kConvertToGray ); 00064 outTo->appendOption( kConvertToRGB ); 00065 outTo->appendOption( kConvertToRGBA ); 00066 outTo->setDefault( eConvertToRGBA ); 00067 00068 OFX::ChoiceParamDescriptor* outGray = desc.defineChoiceParam( kParamToGray ); 00069 outGray->setLabel( kParamToGrayLabel ); 00070 outGray->appendOption( kConvertToGrayMean ); 00071 outGray->appendOption( kConvertToGrayRec601 ); 00072 outGray->appendOption( kConvertToGrayRec709 ); 00073 outGray->appendOption( kConvertToGraySelectRed ); 00074 outGray->appendOption( kConvertToGraySelectGreen ); 00075 outGray->appendOption( kConvertToGraySelectBlue ); 00076 outGray->appendOption( kConvertToGraySelectAlpha ); 00077 outGray->setDefault( 3 ); // terry::color::components::eConvertToGrayRec709 00078 00079 OFX::BooleanParamDescriptor* outPremult = desc.defineBooleanParam( kParamPremutliplied ); 00080 outPremult->setLabel( kParamPremutlipliedLabel ); 00081 outPremult->setDefault( false ); 00082 } 00083 00084 /** 00085 * @brief Function called to create a plugin effect instance 00086 * @param[in] handle Effect handle 00087 * @param[in] context Application context 00088 * @return plugin instance 00089 */ 00090 OFX::ImageEffect* ComponentPluginFactory::createInstance( OfxImageEffectHandle handle, 00091 OFX::EContext context ) 00092 { 00093 return new ComponentPlugin( handle ); 00094 } 00095 00096 } 00097 } 00098 } 00099