TuttleOFX  1
ColorTransformPluginFactory.cpp
Go to the documentation of this file.
00001 #include "ColorTransformPluginFactory.hpp"
00002 #include "ColorTransformPlugin.hpp"
00003 #include "ColorTransformDefinitions.hpp"
00004 #include "ofxsImageEffect.h"
00005 
00006 #include <limits>
00007 
00008 namespace tuttle {
00009 namespace plugin {
00010 namespace colorTransform {
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 ColorTransformPluginFactory::describe( OFX::ImageEffectDescriptor& desc )
00020 {
00021         desc.setLabels( "TuttleColorTransform", "ColorTransform",
00022                             "ColorTransform" );
00023         desc.setPluginGrouping( "tuttle/image/process/color" );
00024 
00025         desc.setDescription( "Plugin under early development." );
00026 
00027         // add the supported contexts, only filter at the moment
00028         desc.addSupportedContext( OFX::eContextFilter );
00029         desc.addSupportedContext( OFX::eContextGeneral );
00030 
00031         // add supported pixel depths
00032         desc.addSupportedBitDepth( OFX::eBitDepthUByte );
00033         desc.addSupportedBitDepth( OFX::eBitDepthUShort );
00034         desc.addSupportedBitDepth( OFX::eBitDepthFloat );
00035 
00036         // plugin flags
00037         desc.setSupportsTiles( kSupportTiles );
00038         desc.setRenderThreadSafety( OFX::eRenderFullySafe );
00039 }
00040 
00041 /**
00042  * @brief Function called to describe the plugin controls and features.
00043  * @param[in, out]   desc       Effect descriptor
00044  * @param[in]        context    Application context
00045  */
00046 void ColorTransformPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
00047                                                   OFX::EContext context )
00048 {
00049         OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName );
00050         srcClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00051         srcClip->addSupportedComponent( OFX::ePixelComponentRGB );
00052         srcClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00053         srcClip->setSupportsTiles( kSupportTiles );
00054 
00055         // Create the mandated output clip
00056         OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName );
00057         dstClip->addSupportedComponent( OFX::ePixelComponentRGBA );
00058         dstClip->addSupportedComponent( OFX::ePixelComponentRGB );
00059         dstClip->addSupportedComponent( OFX::ePixelComponentAlpha );
00060         dstClip->setSupportsTiles( kSupportTiles );
00061 
00062         
00063         OFX::DoubleParamDescriptor* paramHueShift = desc.defineDoubleParam( kParamHueShift );
00064         paramHueShift->setLabel( "Hue Shift" );
00065         paramHueShift->setDefault( 0.0 );
00066         paramHueShift->setDisplayRange( 0.0, 1.0 );
00067         
00068         OFX::DoubleParamDescriptor* paramSaturation = desc.defineDoubleParam( kParamSaturation );
00069         paramSaturation->setLabel( "Saturation" );
00070         paramSaturation->setDefault( 1.0 );
00071         paramSaturation->setDisplayRange( 0.0, 1.0 );
00072         
00073         ////
00074         
00075         OFX::DoubleParamDescriptor* paramContrastRGB = desc.defineDoubleParam( kParamContrastRGB );
00076         paramContrastRGB->setLabel( "Global Contrast RGB" );
00077         paramContrastRGB->setHint( "Global manipulation of RGB contrast." );
00078         paramContrastRGB->setDefault( 1.0 );
00079         paramContrastRGB->setDisplayRange( 0.0, 1.0 );
00080         
00081         OFX::RGBAParamDescriptor* paramContrast = desc.defineRGBAParam( kParamContrast );
00082         paramContrast->setLabel( "Contrast" );
00083         paramContrast->setDefault( 1.0, 1.0, 1.0, 1.0 );
00084         
00085         
00086         OFX::DoubleParamDescriptor* paramBrightnessRGB = desc.defineDoubleParam( kParamBrightnessRGB );
00087         paramBrightnessRGB->setLabel( "Global Brightness RGB" );
00088         paramBrightnessRGB->setHint( "Global manipulation of RGB brightness." );
00089         paramBrightnessRGB->setDefault( 1.0 );
00090         paramBrightnessRGB->setDisplayRange( 0.0, 1.0 );
00091         
00092         OFX::RGBAParamDescriptor* paramBrightness = desc.defineRGBAParam( kParamBrightness );
00093         paramBrightness->setLabel( "Brightness" );
00094         paramBrightness->setDefault( 1.0, 1.0, 1.0, 1.0 );
00095         
00096         
00097         OFX::DoubleParamDescriptor* paramOffsetRGB = desc.defineDoubleParam( kParamOffsetRGB );
00098         paramOffsetRGB->setLabel( "Global Offset RGB" );
00099         paramOffsetRGB->setHint( "Global manipulation of RGB offset." );
00100         paramOffsetRGB->setDefault( 0.0 );
00101         paramOffsetRGB->setDisplayRange( 0.0, 1.0 );
00102         
00103         OFX::RGBAParamDescriptor* paramOffset = desc.defineRGBAParam( kParamOffset );
00104         paramOffset->setLabel( "Offset" );
00105         paramOffset->setDefault( 0.0, 0.0, 0.0, 0.0 );
00106         
00107         
00108         OFX::DoubleParamDescriptor* paramPivotRGB = desc.defineDoubleParam( kParamPivotRGB );
00109         paramPivotRGB->setLabel( "Global Pivot RGB" );
00110         paramPivotRGB->setHint( "Global manipulation of RGB pivot." );
00111         paramPivotRGB->setDefault( 0.5 );
00112         paramPivotRGB->setDisplayRange( 0.0, 1.0 );
00113         
00114         OFX::RGBAParamDescriptor* paramPivot = desc.defineRGBAParam( kParamPivot );
00115         paramPivot->setLabel( "Pivot" );
00116         paramPivot->setDefault( 0.5, 0.5, 0.5, 0.5 );
00117         
00118         
00119 }
00120 
00121 /**
00122  * @brief Function called to create a plugin effect instance
00123  * @param[in] handle  Effect handle
00124  * @param[in] context Application context
00125  * @return  plugin instance
00126  */
00127 OFX::ImageEffect* ColorTransformPluginFactory::createInstance( OfxImageEffectHandle handle,
00128                                                             OFX::EContext context )
00129 {
00130         return new ColorTransformPlugin( handle );
00131 }
00132 
00133 }
00134 }
00135 }
00136