TuttleOFX
1
|
00001 #include "OpenImageIOReaderPluginFactory.hpp" 00002 #include "OpenImageIOReaderDefinitions.hpp" 00003 #include "OpenImageIOReaderPlugin.hpp" 00004 00005 #include <tuttle/plugin/context/ReaderPluginFactory.hpp> 00006 #include <tuttle/plugin/exceptions.hpp> 00007 00008 #include <ofxsImageEffect.h> 00009 #include <ofxsMultiThread.h> 00010 00011 #include <boost/algorithm/string/join.hpp> 00012 #include <boost/assign/std/vector.hpp> 00013 00014 #include <string> 00015 #include <vector> 00016 00017 namespace tuttle { 00018 namespace plugin { 00019 namespace openImageIO { 00020 namespace reader { 00021 00022 /** 00023 * @brief Function called to describe the plugin main features. 00024 * @param[in, out] desc Effect descriptor 00025 */ 00026 void OpenImageIOReaderPluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00027 { 00028 desc.setLabels( "TuttleOpenImageIOReader", "OpenImageIOReader", 00029 "OpenImageIO file reader" ); 00030 desc.setPluginGrouping( "tuttle/image/io" ); 00031 00032 using namespace boost::assign; 00033 std::vector<std::string> supportedExtensions; 00034 supportedExtensions += "bmp", "cin", "dds", "dpx", "exr", "fits", "hdr", "ico", 00035 "j2k", "j2c", "jp2", "jpeg", "jpg", "jpe", "jfif", "jfi", 00036 "pbm", "pgm", "png", "pnm", "ppm", "pic", "psd", "rgbe", 00037 "sgi", "tga", "tif", "tiff", "tpic", "tx", "webp"; 00038 00039 desc.setDescription( 00040 "OpenImageIO Reader" 00041 "\n\n" 00042 "Compression is only available for Exr format." 00043 "\n" 00044 "supported extensions: \n" + 00045 boost::algorithm::join( supportedExtensions, ", " ) 00046 ); 00047 00048 // add the supported contexts 00049 desc.addSupportedContext( OFX::eContextReader ); 00050 desc.addSupportedContext( OFX::eContextGenerator ); 00051 desc.addSupportedContext( OFX::eContextGeneral ); 00052 00053 // add supported pixel depths 00054 desc.addSupportedBitDepth( OFX::eBitDepthFloat ); 00055 desc.addSupportedBitDepth( OFX::eBitDepthUByte ); 00056 desc.addSupportedBitDepth( OFX::eBitDepthUShort ); 00057 00058 // add supported extensions 00059 desc.addSupportedExtensions( supportedExtensions ); 00060 00061 // plugin flags 00062 desc.setRenderThreadSafety( OFX::eRenderFullySafe ); 00063 desc.setHostFrameThreading( false ); 00064 desc.setSupportsMultiResolution( false ); 00065 desc.setSupportsMultipleClipDepths( true ); 00066 desc.setSupportsTiles( kSupportTiles ); 00067 } 00068 00069 /** 00070 * @brief Function called to describe the plugin controls and features. 00071 * @param[in, out] desc Effect descriptor 00072 * @param[in] context Application context 00073 */ 00074 void OpenImageIOReaderPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, 00075 OFX::EContext context ) 00076 { 00077 OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); 00078 dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00079 dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00080 dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00081 dstClip->setSupportsTiles( kSupportTiles ); 00082 00083 describeReaderParamsInContext( desc, context ); 00084 } 00085 00086 /** 00087 * @brief Function called to create a plugin effect instance 00088 * @param[in] handle effect handle 00089 * @param[in] context Application context 00090 * @return plugin instance 00091 */ 00092 OFX::ImageEffect* OpenImageIOReaderPluginFactory::createInstance( OfxImageEffectHandle handle, 00093 OFX::EContext context ) 00094 { 00095 return new OpenImageIOReaderPlugin( handle ); 00096 } 00097 00098 } 00099 } 00100 } 00101 }