TuttleOFX
1
|
00001 #include "ImageMagickReaderPluginFactory.hpp" 00002 #include "ImageMagickReaderDefinitions.hpp" 00003 #include "ImageMagickReaderPlugin.hpp" 00004 00005 #include <tuttle/plugin/context/ReaderPluginFactory.hpp> 00006 00007 #include <boost/algorithm/string/join.hpp> 00008 #include <boost/assign/std/vector.hpp> 00009 00010 #include <string> 00011 #include <vector> 00012 00013 namespace tuttle { 00014 namespace plugin { 00015 namespace imagemagick { 00016 namespace reader { 00017 00018 /** 00019 * @brief Function called to describe the plugin main features. 00020 * @param[in, out] desc Effect descriptor 00021 */ 00022 void ImageMagickReaderPluginFactory::describe( OFX::ImageEffectDescriptor& desc ) 00023 { 00024 desc.setLabels( "TuttleImageMagickReader", "ImageMagickReader", 00025 "ImageMagick file reader" ); 00026 desc.setPluginGrouping( "tuttle/image/io" ); 00027 00028 using namespace boost::assign; 00029 std::vector<std::string> supportedExtensions; 00030 supportedExtensions += "aai", "art", "arw", "avi", "avs", "bmp", "bmp2", "bmp3", 00031 "cals", "cgm", "cin", "cmyk", "cmyka", "cr2", "crw", "cur", "cut", "dcm", 00032 "dcr", "dcx", "dib", "djvu", "dng", "dot", "dpx", "emf", "epdf", "epi", "eps", 00033 "eps2", "eps3", "epsf", "epsi", "ept", "exr", "fax", "fig", 00034 "fits", "fpx", "gif", "gplt", "gray", "hdr", "hpgl", "hrz", 00035 "html", "ico", "info", "inline", "jbig", "jng", "jp2", "jpc", 00036 "jpg", "jpeg", "man", "mat", "miff", "mono", "mng", "m2v", 00037 "mpeg", "mpc", "mpr", "mrw", "msl", "mtv", "mvg", "nef", 00038 "orf", "otb", "p7", "palm", "pam", "pbm", "pcd", "pcds", 00039 "pcl", "pcx", "pdb", "pdf", "pef", "pfa", "pfb", "pfm", 00040 "pgm", "picon", "pict", "pix", "png", "png8", "png16", "png32", 00041 "pnm", "ppm", "ps", "ps2", "ps3", "psb", "psd", "ptif", 00042 "pwp", "rad", "rgb", "rgba", "rla", "rle", "sct", "sfw", 00043 "sgi", "shtml", "sid", "mrsid", "sun", "svg", "tga", "tiff", 00044 "tim", "tif", "txt", "uil", "uyvy", "vicar", "viff", "wbmp", 00045 "webp", "wmf", "wpg", "x", "xbm", "xcf", "xpm", "xwd", "x3f", 00046 "ycbcr", "ycbcra", "yuv"; 00047 00048 desc.setDescription( 00049 "ImageMagick File reader" 00050 "\n\n" 00051 "plugin is used to read imagemagick files." 00052 "\n" 00053 "supported extensions: \n" + 00054 boost::algorithm::join( supportedExtensions, ", " ) 00055 ); 00056 00057 // add the supported contexts 00058 desc.addSupportedContext( OFX::eContextReader ); 00059 desc.addSupportedContext( OFX::eContextGeneral ); 00060 00061 // add supported pixel depths 00062 desc.addSupportedBitDepth( OFX::eBitDepthUByte ); 00063 desc.addSupportedBitDepth( OFX::eBitDepthUShort ); 00064 desc.addSupportedBitDepth( OFX::eBitDepthFloat ); 00065 00066 // add supported extensions 00067 desc.addSupportedExtensions( supportedExtensions ); 00068 00069 // plugin flags 00070 desc.setRenderThreadSafety( OFX::eRenderFullySafe ); 00071 desc.setHostFrameThreading( false ); 00072 desc.setSupportsMultiResolution( false ); 00073 desc.setSupportsMultipleClipDepths( true ); 00074 desc.setSupportsTiles( kSupportTiles ); 00075 } 00076 00077 /** 00078 * @brief Function called to describe the plugin controls and features. 00079 * @param[in, out] desc Effect descriptor 00080 * @param[in] context Application context 00081 */ 00082 void ImageMagickReaderPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc, 00083 OFX::EContext context ) 00084 { 00085 // Create the mandated output clip 00086 OFX::ClipDescriptor* dstClip = desc.defineClip( kOfxImageEffectOutputClipName ); 00087 dstClip->addSupportedComponent( OFX::ePixelComponentRGBA ); 00088 dstClip->addSupportedComponent( OFX::ePixelComponentRGB ); 00089 dstClip->addSupportedComponent( OFX::ePixelComponentAlpha ); 00090 dstClip->setSupportsTiles( kSupportTiles ); 00091 00092 describeReaderParamsInContext( desc, context ); 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* ImageMagickReaderPluginFactory::createInstance( OfxImageEffectHandle handle, 00102 OFX::EContext context ) 00103 { 00104 return new ImageMagickReaderPlugin( handle ); 00105 } 00106 00107 } 00108 } 00109 } 00110 }