Class representing own FreeImage-Plugins.

Namespace:  FreeImageAPI.Plugins
Assembly:  FreeImageNET (in FreeImageNET.dll)


public abstract class LocalPlugin
Visual Basic (Declaration)
Public MustInherit Class LocalPlugin
Visual C++
public ref class LocalPlugin abstract


FreeImages itself is plugin based. Each supported format is integrated by a seperat plugin, that handles loading, saving, descriptions, identifing ect. And of course the user can create own plugins and use them in FreeImage. To do that the above mentioned predefined methodes need to be implemented.

The class below handles the creation of such a plugin. The class itself is abstract as well as some core functions that need to be implemented. The class can be used to enable or disable the plugin in FreeImage after regististration or retrieve the formatid, assigned by FreeImage. The class handles the callback functions, garbage collector and pointer operation to make the implementation as user friendly as possible.

How to: There are two functions that need to be implemented: GetImplementedMethods()()() and FormatProc()()(). GetImplementedMethods()()() is used by the constructor of the abstract class. FreeImage wants a list of the implemented functions. Each function is represented by a function pointer (a .NET Delegate). In case a function is not implemented FreeImage receives an empty delegate). To tell the constructor which functions have been implemented the information is represented by a disjunction of LocalPlugin..::.MethodFlags.

For example: return MethodFlags.LoadProc | MethodFlags.SaveProc;

The above statement means that LoadProc and SaveProc have been implemented by the user. Keep in mind, that each function has a standard implementation that has static return values that may cause errors if listed in GetImplementedMethods()()() without a real implementation.

FormatProc()()() is used by some checks of FreeImage and must be implemented. LoadProc(FreeImageIO%, fi_handle, Int32, Int32, IntPtr) for example can be implemented if the plugin supports reading, but it doesn't have to, the plugin could only be used to save an already loaded bitmap in a special format.

Inheritance Hierarchy


Version Information


Supported in: 3.11.0, 3.12.0, 3.13.0, 3.13.1

See Also