TuttleOFX
1
|
00001 #include "ColorSuppressPluginFactory.hpp" 00002 #include "ColorSuppressPlugin.hpp" 00003 #include "ColorSuppressDefinitions.hpp" 00004 00005 #include <tuttle/plugin/ImageGilProcessor.hpp> 00006 00007 namespace tuttle { 00008 namespace plugin { 00009 namespace colorSuppress { 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 ColorSuppressPluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00018 { 00019 desc.setLabels( 00020 "TuttleColorSuppress", 00021 "ColorSuppress", 00022 "Color Suppress" ); 00023 desc.setPluginGrouping( "tuttle/image/process/color" ); 00024 00025 desc.setDescription( 00026 "ColorSuppress\n" 00027 "\n" 00028 "To remove a color / tint from an image.\n" 00029 "\n" 00030 "The node can modify the color and/or extract the amount of color " 00031 "selected as a mask. " 00032 "So you can use it to extract a mask and/or fix the despill of your " 00033 "keying.\n" 00034 ); 00035 00036 // add the supported contexts, only filter at the moment 00037 desc.addSupportedContext( OFX::eContextGeneral ); 00038 desc.addSupportedContext( OFX::eContextFilter ); 00039 00040 // add supported pixel depths 00041 // desc.addSupportedBitDepth( OFX::eBitDepthUByte ); 00042 // desc.addSupportedBitDepth( OFX::eBitDepthUShort ); 00043 desc.addSupportedBitDepth( OFX::eBitDepthFloat ); 00044 00045 // plugin flags 00046 desc.setSupportsTiles( kSupportTiles ); 00047 } 00048 00049 /** 00050 * @brief Function called to describe the plugin controls and features. 00051 * @param[in, out] desc Effect descriptor 00052 * @param[in] context Application context 00053 */ 00054 void ColorSuppressPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, 00055 OFX::EContext context ) 00056 { 00057 OFX::ClipDescriptor *srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName ); 00058 srcClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00059 srcClip->setSupportsTiles( kSupportTiles ); 00060 00061 // Create the mandated output clip 00062 OFX::ClipDescriptor *dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); 00063 dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00064 dstClip->setSupportsTiles( kSupportTiles ); 00065 00066 OFX::DoubleParamDescriptor *redSuppress = desc.defineDoubleParam( kParamRedSuppressRate ); 00067 redSuppress->setLabel( "Red" ); 00068 redSuppress->setHint( "Suppressing X percent of red." ); 00069 redSuppress->setDefault( 0.0 ); 00070 redSuppress->setRange( 0.0, 1.0 ); 00071 redSuppress->setDisplayRange( 0.0, 1.0 ); 00072 00073 OFX::DoubleParamDescriptor *greenSuppress = desc.defineDoubleParam( kParamGreenSuppressRate ); 00074 greenSuppress->setLabel( "Green" ); 00075 greenSuppress->setHint( "Suppressing X percent of green." ); 00076 greenSuppress->setDefault( 0.0 ); 00077 greenSuppress->setRange( 0.0, 1.0 ); 00078 greenSuppress->setDisplayRange( 0.0, 1.0 ); 00079 00080 OFX::DoubleParamDescriptor *blueSuppress = desc.defineDoubleParam( kParamBlueSuppressRate ); 00081 blueSuppress->setLabel( "Blue" ); 00082 blueSuppress->setHint( "Suppressing X percent of the blue." ); 00083 blueSuppress->setDefault( 0.0 ); 00084 blueSuppress->setRange( 0.0, 1.0 ); 00085 blueSuppress->setDisplayRange( 0.0, 1.0 ); 00086 00087 OFX::DoubleParamDescriptor *cyanSuppress = desc.defineDoubleParam( kParamCyanSuppressRate ); 00088 cyanSuppress->setLabel( "Cyan" ); 00089 cyanSuppress->setHint( "Suppressing X percent of the cyan." ); 00090 cyanSuppress->setDefault( 0.0 ); 00091 cyanSuppress->setRange( 0.0, 1.0 ); 00092 cyanSuppress->setDisplayRange( 0.0, 1.0 ); 00093 00094 OFX::DoubleParamDescriptor *magentaSuppress = desc.defineDoubleParam( kParamMagentaSuppressRate ); 00095 magentaSuppress->setLabel( "Magenta" ); 00096 magentaSuppress->setHint( "Suppressing X percent of the magenta." ); 00097 magentaSuppress->setDefault( 0.0 ); 00098 magentaSuppress->setRange( 0.0, 1.0 ); 00099 magentaSuppress->setDisplayRange( 0.0, 1.0 ); 00100 00101 OFX::DoubleParamDescriptor *yellowSuppress = desc.defineDoubleParam( kParamYellowSuppressRate ); 00102 yellowSuppress->setLabel( "Yellow" ); 00103 yellowSuppress->setHint( "Suppressing X percent of the yellow." ); 00104 yellowSuppress->setDefault( 0.0 ); 00105 yellowSuppress->setRange( 0.0, 1.0 ); 00106 yellowSuppress->setDisplayRange( 0.0, 1.0 ); 00107 00108 OFX::ChoiceParamDescriptor *outputTo = desc.defineChoiceParam( kParamApplyOn ); 00109 outputTo->setLabel( "Output" ); 00110 outputTo->setHint( "Suppress mode." ); 00111 outputTo->appendOption( kParamApplyOnImage ); 00112 outputTo->appendOption( kParamApplyOnAlpha ); 00113 outputTo->appendOption( kParamApplyOnImageAndAlpha ); 00114 00115 OFX::BooleanParamDescriptor *preserveLuma = desc.defineBooleanParam( kParamPreserveLuma ); 00116 preserveLuma->setLabel( "Preserve Luminance" ); 00117 preserveLuma->setHint( "Preserve image luminosity." ); 00118 preserveLuma->setDefault( false ); 00119 00120 OFX::BooleanParamDescriptor *obeyAlpha = desc.defineBooleanParam( kParamObeyAlpha ); 00121 obeyAlpha->setLabel( "Obey Alpha" ); 00122 obeyAlpha->setHint( "Apply through the alpha channel." ); 00123 obeyAlpha->setDefault( false ); 00124 } 00125 00126 /** 00127 * @brief Function called to create a plugin effect instance 00128 * @param[in] handle Effect handle 00129 * @param[in] context Application context 00130 * @return plugin instance 00131 */ 00132 OFX::ImageEffect* ColorSuppressPluginFactory::createInstance( OfxImageEffectHandle handle, 00133 OFX::EContext context ) 00134 { 00135 return new ColorSuppressPlugin( handle ); 00136 } 00137 00138 } 00139 } 00140 } 00141