TuttleOFX
1
|
00001 #include "FadePluginFactory.hpp" 00002 #include "FadePlugin.hpp" 00003 #include "FadeDefinitions.hpp" 00004 #include "ofxsImageEffect.h" 00005 00006 #include <limits> 00007 00008 namespace tuttle { 00009 namespace plugin { 00010 namespace fade { 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 FadePluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00020 { 00021 desc.setLabels( 00022 "TuttleFade", 00023 "Fade", 00024 "Fade" ); 00025 desc.setPluginGrouping( "tuttle/image/process/transition" ); 00026 00027 desc.setDescription( "Plugin under early development." ); 00028 00029 // add the supported contexts, only filter at the moment 00030 desc.addSupportedContext( OFX::eContextTransition ); 00031 desc.addSupportedContext( OFX::eContextGeneral ); 00032 00033 // add supported pixel depths 00034 desc.addSupportedBitDepth( OFX::eBitDepthUByte ); 00035 desc.addSupportedBitDepth( OFX::eBitDepthUShort ); 00036 desc.addSupportedBitDepth( OFX::eBitDepthFloat ); 00037 00038 // plugin flags 00039 desc.setSupportsTiles( kSupportTiles ); 00040 desc.setRenderThreadSafety( OFX::eRenderFullySafe ); 00041 } 00042 00043 /** 00044 * @brief Function called to describe the plugin controls and features. 00045 * @param[in, out] desc Effect descriptor 00046 * @param[in] context Application context 00047 */ 00048 void FadePluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, 00049 OFX::EContext context ) 00050 { 00051 OFX::ClipDescriptor* srcClipFrom = desc.defineClip( kOfxImageEffectTransitionSourceFromClipName ); 00052 srcClipFrom->addSupportedComponent( OFX::ePixelComponentRGBA ); 00053 srcClipFrom->addSupportedComponent( OFX::ePixelComponentRGB ); 00054 srcClipFrom->addSupportedComponent( OFX::ePixelComponentAlpha ); 00055 srcClipFrom->setSupportsTiles( kSupportTiles ); 00056 srcClipFrom->setOptional( true ); 00057 00058 OFX::ClipDescriptor* srcClipTo = desc.defineClip( kOfxImageEffectTransitionSourceToClipName ); 00059 srcClipTo->addSupportedComponent( OFX::ePixelComponentRGBA ); 00060 srcClipTo->addSupportedComponent( OFX::ePixelComponentRGB ); 00061 srcClipTo->addSupportedComponent( OFX::ePixelComponentAlpha ); 00062 srcClipTo->setSupportsTiles( kSupportTiles ); 00063 srcClipTo->setOptional( true ); 00064 00065 // Create the mandated output clip 00066 OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); 00067 dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00068 dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00069 dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00070 dstClip->setSupportsTiles( kSupportTiles ); 00071 00072 OFX::DoubleParamDescriptor* transition = desc.defineDoubleParam( kOfxImageEffectTransitionParamName ); 00073 transition->setLabel( "Transition" ); 00074 transition->setDefault( 0.5 ); 00075 transition->setRange( 0.0, 1.0 ); 00076 transition->setDisplayRange( 0.0, 1.0 ); 00077 00078 OFX::ChoiceParamDescriptor* mode = desc.defineChoiceParam( kParamMode ); 00079 mode->setLabel( "Mode" ); 00080 mode->appendOption( kParamModeFromColor ); 00081 mode->appendOption( kParamModeToColor ); 00082 00083 OFX::RGBAParamDescriptor* color = desc.defineRGBAParam( kParamColor ); 00084 color->setLabel( "Color" ); 00085 color->setDefault( 0.0, 0.0, 0.0, 0.0 ); 00086 00087 OFX::ChoiceParamDescriptor* rod = desc.defineChoiceParam( kParamRod ); 00088 rod->appendOption( kParamRodIntersect ); 00089 rod->appendOption( kParamRodUnion ); 00090 rod->appendOption( kParamRodA ); 00091 rod->appendOption( kParamRodB ); 00092 rod->setDefault( eParamRodIntersect ); 00093 } 00094 00095 /** 00096 * @brief Function called to create a plugin effect instance 00097 * @param[in] handle Effect handle 00098 * @param[in] context Application context 00099 * @return plugin instance 00100 */ 00101 OFX::ImageEffect* FadePluginFactory::createInstance( OfxImageEffectHandle handle, 00102 OFX::EContext context ) 00103 { 00104 return new FadePlugin( handle ); 00105 } 00106 00107 } 00108 } 00109 } 00110