TuttleOFX
1
|
00001 #include "InvertPluginFactory.hpp" 00002 #include "InvertPlugin.hpp" 00003 #include <tuttle/plugin/ImageGilProcessor.hpp> 00004 #include <tuttle/plugin/exceptions.hpp> 00005 00006 #include <string> 00007 #include <iostream> 00008 #include <stdio.h> 00009 #include <cmath> 00010 #include <ofxsImageEffect.h> 00011 #include <ofxsMultiThread.h> 00012 #include <boost/gil/gil_all.hpp> 00013 #include <boost/scoped_ptr.hpp> 00014 00015 namespace tuttle { 00016 namespace plugin { 00017 namespace invert { 00018 00019 /** 00020 * @brief Function called to describe the plugin main features. 00021 * @param[in, out] desc Effect descriptor 00022 */ 00023 void InvertPluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00024 { 00025 desc.setLabels( "TuttleInvert", "Invert", 00026 "Image inverter" ); 00027 desc.setPluginGrouping( "tuttle/image/process/color" ); 00028 00029 desc.setDescription( 00030 "Invert selected channels value." 00031 "\n" 00032 "\n" 00033 "http://en.wikipedia.org/wiki/Negative_image" 00034 ); 00035 00036 // add the supported contexts 00037 desc.addSupportedContext( OFX::eContextFilter ); 00038 desc.addSupportedContext( OFX::eContextGeneral ); 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 InvertPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, OFX::EContext context ) 00055 { 00056 OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName ); 00057 00058 srcClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00059 srcClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00060 srcClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00061 srcClip->setSupportsTiles( kSupportTiles ); 00062 00063 // Create the mandated output clip 00064 OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); 00065 dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00066 dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00067 dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00068 dstClip->setSupportsTiles( kSupportTiles ); 00069 00070 OFX::GroupParamDescriptor* processGroup = desc.defineGroupParam( kParamProcessGroup ); 00071 processGroup->setLabel( kParamProcessGroupLabel ); 00072 00073 OFX::BooleanParamDescriptor* processGray = desc.defineBooleanParam( kParamProcessGray ); 00074 processGray->setLabel( kParamProcessGrayLabel ); 00075 processGray->setHint( kParamProcessGrayHint ); 00076 processGray->setDefault( true ); 00077 processGray->setParent( processGroup ); 00078 00079 OFX::BooleanParamDescriptor* processR = desc.defineBooleanParam( kParamProcessR ); 00080 processR->setLabel( kParamProcessRLabel ); 00081 processR->setHint( kParamProcessRHint ); 00082 processR->setDefault( true ); 00083 processR->setParent( processGroup ); 00084 00085 OFX::BooleanParamDescriptor* processG = desc.defineBooleanParam( kParamProcessG ); 00086 processG->setLabel( kParamProcessGLabel ); 00087 processG->setHint( kParamProcessGHint ); 00088 processG->setDefault( true ); 00089 processG->setParent( processGroup ); 00090 00091 OFX::BooleanParamDescriptor* processB = desc.defineBooleanParam( kParamProcessB ); 00092 processB->setLabel( kParamProcessBLabel ); 00093 processB->setHint( kParamProcessBHint ); 00094 processB->setDefault( true ); 00095 processB->setParent( processGroup ); 00096 00097 OFX::BooleanParamDescriptor* processA = desc.defineBooleanParam( kParamProcessA ); 00098 processA->setLabel( kParamProcessALabel ); 00099 processA->setHint( kParamProcessAHint ); 00100 processA->setDefault( false ); 00101 processA->setParent( processGroup ); 00102 } 00103 00104 /** 00105 * @brief Function called to create a plugin effect instance 00106 * @param[in] handle effect handle 00107 * @param[in] context Application context 00108 * @return plugin instance 00109 */ 00110 OFX::ImageEffect* InvertPluginFactory::createInstance( OfxImageEffectHandle handle, OFX::EContext context ) 00111 { 00112 return new InvertPlugin( handle ); 00113 } 00114 00115 } 00116 } 00117 }