MDL SDK API nvidia_logo_transpbg.gif Up
mi::neuraylib::IImage_plugin Class Referenceabstract

Abstract interface for image plugins. More...

#include <iimage_plugin.h>

Inheritance diagram for mi::neuraylib::IImage_plugin:

Public Member Functions

virtual const char * get_name () const =0
 Returns the name of the plugin. More...
 
virtual bool init (IPlugin_api *plugin_api)=0
 Initializes the plugin. More...
 
virtual bool exit (IPlugin_api *plugin_api)=0
 De-initializes the plugin. More...
 
virtual const char * get_file_extension (Uint32 index) const =0
 Returns the index -th supported file extension. More...
 
virtual const char * get_supported_type (Uint32 index) const =0
 Returns the index -th supported pixel type for exporting. More...
 
virtual Impexp_priority get_priority () const =0
 Returns the priority of the image plugin. More...
 
virtual bool supports_selectors () const =0
 Indicates whether the image plugin implements selector support. More...
 
virtual bool test (IReader *reader) const =0
 Indicates whether the image plugin can handle a given image. More...
 
virtual IImage_fileopen_for_reading (IReader *reader, const char *selector) const =0
 Creates an object that reads an image from a stream. More...
 
virtual IImage_fileopen_for_writing (IWriter *writer, const char *pixel_type, Uint32 resolution_x, Uint32 resolution_y, Uint32 nr_of_layers, Uint32 miplevels, bool is_cubemap, Float32 gamma, const IMap *export_options) const =0
 Creates an object that writes an image to a stream. More...
 
- Public Member Functions inherited from mi::base::Plugin
virtual Sint32 get_plugin_system_version () const
 Returns the version of the plugin system used to compile this. More...
 
virtual const char * get_name () const =0
 Returns the name of the plugin. More...
 
virtual const char * get_type () const =0
 Returns the type of the plugin. More...
 
virtual Sint32 get_version () const
 Returns the version number of the plugin. More...
 
virtual const char * get_compiler () const
 Returns the compiler used to compile the plugin. More...
 
virtual void release ()=0
 Destroys the plugin instance. More...
 
virtual const char * get_string_property (Sint32 index, const char **value)
 Returns a plugin property. More...
 

Detailed Description

Abstract interface for image plugins.

The image plugin API allows to add support for third-party image formats. Such an image format will then be supported in import, export, and streaming operations. The image plugin API comprises the interfaces mi::neuraylib::IImage_plugin and mi::neuraylib::IImage_file. It also uses the interfaces mi::neuraylib::IReader, mi::neuraylib::IWriter, and mi::neuraylib::ITile.

Image plugins need to return MI_NEURAY_IMAGE_PLUGIN_TYPE in mi::base::Plugin::get_type().

A plugin to support a certain image format is selected as follows. For import operations the reader is presented to each plugin for testing. Each plugin indicates whether it recognizes the header format and whether it can handle the image format. For export operations a matching plugin is selected according to the file name extension (see mi::neuraylib::IImage_plugin::get_file_extension()).

Member Function Documentation

 exit()

virtual bool mi::neuraylib::IImage_plugin::exit ( IPlugin_api plugin_api)
pure virtual

De-initializes the plugin.

Parameters
plugin_apiProvides access to API components available for plugins.
Returns
true in case of success, and false otherwise.

 get_file_extension()

virtual const char * mi::neuraylib::IImage_plugin::get_file_extension ( Uint32  index) const
pure virtual

Returns the index -th supported file extension.

Parameters
indexThe index of the file extensions to be returned.
Returns
The index -th supported file extension, NULL if index is out of bounds.

 get_name()

virtual const char * mi::neuraylib::IImage_plugin::get_name ( ) const
pure virtual

Returns the name of the plugin.

For image plugins, typically the name of the image format is used, for example, "jpeg".

Note
This method from mi::base::Plugin is repeated here only for documentation purposes.

Implements mi::base::Plugin.

 get_priority()

virtual Impexp_priority mi::neuraylib::IImage_plugin::get_priority ( ) const
pure virtual

Returns the priority of the image plugin.

The priority expresses the confidence of the plugin that its test() method can identify the image format and that the image format is fully supported.

 get_supported_type()

virtual const char * mi::neuraylib::IImage_plugin::get_supported_type ( Uint32  index) const
pure virtual

Returns the index -th supported pixel type for exporting.

The pixel types should be ordered, from index 0 for the most common to the least useful type. See Types for a list of supported pixel types.

Parameters
indexThe index of the pixel type to be returned.
Returns
The index -th supported pixel type, NULL if index is out of bounds.

 init()

virtual bool mi::neuraylib::IImage_plugin::init ( IPlugin_api plugin_api)
pure virtual

Initializes the plugin.

Parameters
plugin_apiProvides access to API components available for plugins.
Returns
true in case of success, and false otherwise.

 open_for_reading()

virtual IImage_file * mi::neuraylib::IImage_plugin::open_for_reading ( IReader reader,
const char *  selector 
) const
pure virtual

Creates an object that reads an image from a stream.

This method is called to start an image import operation.

Parameters
readerA reader representing the stream to read from.
selectorThe selector (or NULL).
Returns
The object that reads the image from the reader.

 open_for_writing()

virtual IImage_file * mi::neuraylib::IImage_plugin::open_for_writing ( IWriter writer,
const char *  pixel_type,
Uint32  resolution_x,
Uint32  resolution_y,
Uint32  nr_of_layers,
Uint32  miplevels,
bool  is_cubemap,
Float32  gamma,
const IMap export_options 
) const
pure virtual

Creates an object that writes an image to a stream.

This method is called to start an image export operation.

Parameters
writerA writer representing the stream to write to.
pixel_typeThe pixel type of the image tiles. This is one of the pixel types returned by get_supported_type().
resolution_xThe resolution of the image in x direction.
resolution_yThe resolution of the image in y direction.
nr_of_layersThe number of layers in the image.
miplevelsThe number of mipmap levels in the image.
is_cubemaptrue if the image is supposed to be cubemap, false otherwise.
gammaThe gamma value of the image.
export_optionsSee Image export options for options that should be supported by an exporter for the corresponding format. The option "force_default_gamma" is handled by the MDL SDK and can be ignored in the plugin.
Returns
The object that writes the image to a stream.

 supports_selectors()

virtual bool mi::neuraylib::IImage_plugin::supports_selectors ( ) const
pure virtual

Indicates whether the image plugin implements selector support.

Returns
true if open_for_reading() handles the selector parameter, false otherwise. In the latter case a generic, possibly less efficient, support for RGBA channel selectors only is applied to the tiles returned by mi::neuraylib::IImage_file::read() by the caller.

 test()

virtual bool mi::neuraylib::IImage_plugin::test ( IReader reader) const
pure virtual

Indicates whether the image plugin can handle a given image.

Parameters
readerA reader representing the stream to read from.
Returns
true if the plugin can handle the image, false otherwise.