TuttleOFX
1
|
00001 #include "GammaPluginFactory.hpp" 00002 #include "GammaPlugin.hpp" 00003 #include "GammaDefinitions.hpp" 00004 00005 #include <ofxsImageEffect.h> 00006 00007 namespace tuttle { 00008 namespace plugin { 00009 namespace gamma { 00010 00011 static const bool kSupportTiles = true; 00012 00013 /** 00014 * @brief Function called to describe the plugin main features. 00015 * @param[in, out] desc Effect descriptor 00016 */ 00017 void GammaPluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00018 { 00019 desc.setLabels( "TuttleGamma", "Gamma", 00020 "Apply gamma value on image." ); 00021 desc.setPluginGrouping( "tuttle/image/process/color" ); 00022 00023 // add the supported contexts, only filter at the moment 00024 desc.addSupportedContext( OFX::eContextFilter ); 00025 desc.addSupportedContext( OFX::eContextGeneral ); 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.setSupportsTiles( kSupportTiles ); 00034 desc.setRenderThreadSafety( OFX::eRenderFullySafe ); 00035 } 00036 00037 /** 00038 * @brief Function called to describe the plugin controls and features. 00039 * @param[in, out] desc Effect descriptor 00040 * @param[in] context Application context 00041 */ 00042 void GammaPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, 00043 OFX::EContext context ) 00044 { 00045 OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName ); 00046 00047 srcClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00048 srcClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00049 srcClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00050 srcClip->setSupportsTiles( kSupportTiles ); 00051 00052 OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); 00053 dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00054 dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00055 dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00056 dstClip->setSupportsTiles( kSupportTiles ); 00057 00058 OFX::ChoiceParamDescriptor* gammaType = desc.defineChoiceParam( kGammaType ); 00059 gammaType->setLabel( "Type" ); 00060 gammaType->setHint( "Gamma selection mode." ); 00061 gammaType->appendOption( kGammaGlobal ); 00062 gammaType->appendOption( kGammaChannels ); 00063 00064 OFX::DoubleParamDescriptor* masterValue = desc.defineDoubleParam( kMasterValue ); 00065 masterValue->setLabel( "Master" ); 00066 masterValue->setRange( 0.001, 1024.0 ); 00067 masterValue->setDisplayRange( 0.001, 20.0 ); 00068 masterValue->setDoubleType( OFX::eDoubleTypePlain ); 00069 masterValue->setDefault( 1.0 ); 00070 00071 OFX::DoubleParamDescriptor* redValue = desc.defineDoubleParam( kRedValue ); 00072 redValue->setLabel( "Red" ); 00073 redValue->setRange( 0.001, 1024.0 ); 00074 redValue->setDisplayRange( 0.001, 20.0 ); 00075 redValue->setDoubleType( OFX::eDoubleTypePlain ); 00076 redValue->setDefault( 1.0 ); 00077 00078 OFX::DoubleParamDescriptor* greenValue = desc.defineDoubleParam( kGreenValue ); 00079 greenValue->setLabel( "Green" ); 00080 greenValue->setRange( 0.001, 1024.0 ); 00081 greenValue->setDisplayRange( 0.001, 20.0 ); 00082 greenValue->setDoubleType( OFX::eDoubleTypePlain ); 00083 greenValue->setDefault( 1.0 ); 00084 00085 OFX::DoubleParamDescriptor* blueValue = desc.defineDoubleParam( kBlueValue ); 00086 blueValue->setLabel( "Blue" ); 00087 blueValue->setRange( 0.001, 1024.0 ); 00088 blueValue->setDisplayRange( 0.001, 20.0 ); 00089 blueValue->setDoubleType( OFX::eDoubleTypePlain ); 00090 blueValue->setDefault( 1.0 ); 00091 00092 OFX::DoubleParamDescriptor* alphaValue = desc.defineDoubleParam( kAlphaValue ); 00093 alphaValue->setLabel( "Alpha" ); 00094 alphaValue->setRange( 0.001, 1024.0 ); 00095 alphaValue->setDisplayRange( 0.001, 20.0 ); 00096 alphaValue->setDoubleType( OFX::eDoubleTypePlain ); 00097 alphaValue->setDefault( 1.0 ); 00098 00099 OFX::BooleanParamDescriptor* invert = desc.defineBooleanParam( kInvert ); 00100 invert->setDefault( false ); 00101 } 00102 00103 /** 00104 * @brief Function called to create a plugin effect instance 00105 * @param[in] handle Effect handle 00106 * @param[in] context Application context 00107 * @return plugin instance 00108 */ 00109 OFX::ImageEffect* GammaPluginFactory::createInstance( OfxImageEffectHandle handle, 00110 OFX::EContext context ) 00111 { 00112 return new GammaPlugin( handle ); 00113 } 00114 00115 } 00116 } 00117 } 00118