TuttleOFX
1
|
00001 #include "PrintPluginFactory.hpp" 00002 #include "PrintPlugin.hpp" 00003 #include "PrintDefinitions.hpp" 00004 #include "ofxsImageEffect.h" 00005 00006 #include <limits> 00007 00008 namespace tuttle { 00009 namespace plugin { 00010 namespace print { 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 PrintPluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00020 { 00021 desc.setLabels( "TuttlePrint", "TuttlePrint", 00022 "TuttlePrint" ); 00023 desc.setPluginGrouping( "tuttle/image/process/color" ); 00024 00025 desc.setDescription( "TuttlePrint\n" 00026 "Allows to print a part of the image." ); 00027 00028 // add the supported contexts, only filter at the moment 00029 desc.addSupportedContext( OFX::eContextFilter ); 00030 desc.addSupportedContext( OFX::eContextGeneral ); 00031 00032 // add supported pixel depths 00033 desc.addSupportedBitDepth( OFX::eBitDepthUByte ); 00034 desc.addSupportedBitDepth( OFX::eBitDepthUShort ); 00035 desc.addSupportedBitDepth( OFX::eBitDepthFloat ); 00036 00037 // plugin flags 00038 desc.setSupportsTiles( kSupportTiles ); 00039 desc.setRenderThreadSafety( OFX::eRenderFullySafe ); 00040 } 00041 00042 /** 00043 * @brief Function called to describe the plugin controls and features. 00044 * @param[in, out] desc Effect descriptor 00045 * @param[in] context Application context 00046 */ 00047 void PrintPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, 00048 OFX::EContext context ) 00049 { 00050 OFX::ClipDescriptor* srcClip = desc.defineClip( kOfxImageEffectSimpleSourceClipName ); 00051 srcClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00052 srcClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00053 srcClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00054 srcClip->setSupportsTiles( kSupportTiles ); 00055 00056 // Create the mandated output clip 00057 OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); 00058 dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00059 dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00060 dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00061 dstClip->setSupportsTiles( kSupportTiles ); 00062 00063 OFX::ChoiceParamDescriptor* mode = desc.defineChoiceParam( kParamMode ); 00064 mode->setLabel( "Mode" ); 00065 mode->appendOption( kParamModeImage ); 00066 mode->appendOption( kParamModeRegion ); 00067 mode->appendOption( kParamModePixel ); 00068 00069 OFX::Int2DParamDescriptor* pixel = desc.defineInt2DParam( kParamPixel ); 00070 pixel->setLabel( "Pixel" ); 00071 pixel->setDisplayRange( 0, 0, 2000, 2000 ); 00072 00073 OFX::Int2DParamDescriptor* regionMin = desc.defineInt2DParam( kParamRegionMin ); 00074 regionMin->setLabel( "Region min" ); 00075 regionMin->setDisplayRange( 0, 0, 2000, 2000 ); 00076 00077 OFX::Int2DParamDescriptor* regionMax = desc.defineInt2DParam( kParamRegionMax ); 00078 regionMax->setLabel( "Region max" ); 00079 regionMax->setDefault( 1,1 ); 00080 regionMax->setDisplayRange( 0, 0, 2000, 2000 ); 00081 00082 OFX::IntParamDescriptor* outputColumns = desc.defineIntParam( kParamColumns ); 00083 outputColumns->setDefault(80); 00084 outputColumns->setDisplayRange(1,500); 00085 00086 00087 OFX::ChoiceParamDescriptor* colorType = desc.defineChoiceParam( kParamColor ); 00088 colorType->appendOption( kParamColorMono ); 00089 colorType->appendOption( kParamColorGray ); 00090 colorType->appendOption( kParamColor8 ); 00091 colorType->appendOption( kParamColor16 ); 00092 colorType->appendOption( kParamColorFullGray ); 00093 colorType->appendOption( kParamColorFull8 ); 00094 colorType->appendOption( kParamColorFull16 ); 00095 colorType->setLabel( "Color type for the output." ); 00096 00097 OFX::ChoiceParamDescriptor* output = desc.defineChoiceParam( kParamOutput ); 00098 output->setLabel( "Output" ); 00099 output->appendOption( kParamOutputAscii ); 00100 output->appendOption( kParamOutputNumeric ); 00101 00102 OFX::BooleanParamDescriptor* flip = desc.defineBooleanParam( kParamFlip ); 00103 flip->setLabel( "Flip" ); 00104 00105 OFX::BooleanParamDescriptor* openGlWindow = desc.defineBooleanParam( kParamOutputOpenGL ); 00106 openGlWindow->setLabel( "Show in OpenGL Window." ); 00107 00108 } 00109 00110 /** 00111 * @brief Function called to create a plugin effect instance 00112 * @param[in] handle Effect handle 00113 * @param[in] context Application context 00114 * @return plugin instance 00115 */ 00116 OFX::ImageEffect* PrintPluginFactory::createInstance( OfxImageEffectHandle handle, 00117 OFX::EContext context ) 00118 { 00119 return new PrintPlugin( handle ); 00120 } 00121 00122 } 00123 } 00124 } 00125