![]() |
Paradox Game Engine
v1.0.0 beta06
|
Class representing own FreeImage-Plugins. More...
Public Member Functions | |
LocalPlugin () | |
The constructor automatically registeres the plugin in FreeImage. To do this it prepares a FreeImage defined structure with function pointers to the implemented functions or null if not implemented. Before registing the functions they are pinned in memory so the garbage collector can't move them around in memory after we passed there addresses to FreeImage. More... | |
LocalPlugin () | |
The constructor automatically registeres the plugin in FreeImage. To do this it prepares a FreeImage defined structure with function pointers to the implemented functions or null if not implemented. Before registing the functions they are pinned in memory so the garbage collector can't move them around in memory after we passed there addresses to FreeImage. More... | |
Protected Member Functions | |
abstract MethodFlags | GetImplementedMethods () |
Function that returns a bitfield containing the implemented methods. More... | |
abstract string | FormatProc () |
Implementation of FormatProc More... | |
virtual string | DescriptionProc () |
Function that can be implemented. More... | |
virtual string | ExtensionListProc () |
Function that can be implemented. More... | |
virtual string | RegExprProc () |
Function that can be implemented. More... | |
virtual IntPtr | OpenProc (ref FreeImageIO io, fi_handle handle, bool read) |
Function that can be implemented. More... | |
virtual void | CloseProc (ref FreeImageIO io, fi_handle handle, IntPtr data) |
Function that can be implemented. More... | |
virtual int | PageCountProc (ref FreeImageIO io, fi_handle handle, IntPtr data) |
Function that can be implemented. More... | |
virtual int | PageCapabilityProc (ref FreeImageIO io, fi_handle handle, IntPtr data) |
Function that can be implemented. More... | |
virtual FIBITMAP | LoadProc (ref FreeImageIO io, fi_handle handle, int page, int flags, IntPtr data) |
Function that can be implemented. More... | |
virtual bool | SaveProc (ref FreeImageIO io, FIBITMAP dib, fi_handle handle, int page, int flags, IntPtr data) |
Function that can be implemented. More... | |
virtual bool | ValidateProc (ref FreeImageIO io, fi_handle handle) |
Function that can be implemented. More... | |
virtual string | MimeProc () |
Function that can be implemented. More... | |
virtual bool | SupportsExportBPPProc (int bpp) |
Function that can be implemented. More... | |
virtual bool | SupportsExportTypeProc (FREE_IMAGE_TYPE type) |
Function that can be implemented. More... | |
virtual bool | SupportsICCProfilesProc () |
Function that can be implemented. More... | |
unsafe int | Read (FreeImageIO io, fi_handle handle, uint size, uint count, ref byte[] buffer) |
Reads from an unmanaged stream. More... | |
unsafe int | ReadByte (FreeImageIO io, fi_handle handle) |
Reads a single byte from an unmanaged stream. More... | |
unsafe int | Write (FreeImageIO io, fi_handle handle, uint size, uint count, ref byte[] buffer) |
Writes to an unmanaged stream. More... | |
unsafe int | WriteByte (FreeImageIO io, fi_handle handle, byte value) |
Writes a single byte to an unmanaged stream. More... | |
int | Seek (FreeImageIO io, fi_handle handle, int offset, SeekOrigin origin) |
Seeks in an unmanaged stream. More... | |
int | Tell (FreeImageIO io, fi_handle handle) |
Retrieves the position of an unmanaged stream. More... | |
abstract MethodFlags | GetImplementedMethods () |
Function that returns a bitfield containing the implemented methods. More... | |
abstract string | FormatProc () |
Implementation of FormatProc More... | |
virtual string | DescriptionProc () |
Function that can be implemented. More... | |
virtual string | ExtensionListProc () |
Function that can be implemented. More... | |
virtual string | RegExprProc () |
Function that can be implemented. More... | |
virtual IntPtr | OpenProc (ref FreeImageIO io, fi_handle handle, bool read) |
Function that can be implemented. More... | |
virtual void | CloseProc (ref FreeImageIO io, fi_handle handle, IntPtr data) |
Function that can be implemented. More... | |
virtual int | PageCountProc (ref FreeImageIO io, fi_handle handle, IntPtr data) |
Function that can be implemented. More... | |
virtual int | PageCapabilityProc (ref FreeImageIO io, fi_handle handle, IntPtr data) |
Function that can be implemented. More... | |
virtual FIBITMAP | LoadProc (ref FreeImageIO io, fi_handle handle, int page, int flags, IntPtr data) |
Function that can be implemented. More... | |
virtual bool | SaveProc (ref FreeImageIO io, FIBITMAP dib, fi_handle handle, int page, int flags, IntPtr data) |
Function that can be implemented. More... | |
virtual bool | ValidateProc (ref FreeImageIO io, fi_handle handle) |
Function that can be implemented. More... | |
virtual string | MimeProc () |
Function that can be implemented. More... | |
virtual bool | SupportsExportBPPProc (int bpp) |
Function that can be implemented. More... | |
virtual bool | SupportsExportTypeProc (FREE_IMAGE_TYPE type) |
Function that can be implemented. More... | |
virtual bool | SupportsICCProfilesProc () |
Function that can be implemented. More... | |
unsafe int | Read (FreeImageIO io, fi_handle handle, uint size, uint count, ref byte[] buffer) |
Reads from an unmanaged stream. More... | |
unsafe int | ReadByte (FreeImageIO io, fi_handle handle) |
Reads a single byte from an unmanaged stream. More... | |
unsafe int | Write (FreeImageIO io, fi_handle handle, uint size, uint count, ref byte[] buffer) |
Writes to an unmanaged stream. More... | |
unsafe int | WriteByte (FreeImageIO io, fi_handle handle, byte value) |
Writes a single byte to an unmanaged stream. More... | |
int | Seek (FreeImageIO io, fi_handle handle, int offset, SeekOrigin origin) |
Seeks in an unmanaged stream. More... | |
int | Tell (FreeImageIO io, fi_handle handle) |
Retrieves the position of an unmanaged stream. More... | |
Protected Attributes | |
FREE_IMAGE_FORMAT | format = FREE_IMAGE_FORMAT.FIF_UNKNOWN |
The format id assiged to the plugin. More... | |
readonly bool | registered = false |
When true the plugin was registered successfully else false. More... | |
readonly MethodFlags | implementedMethods |
A copy of the functions used to register. More... | |
Properties | |
bool | Enabled [get, set] |
Gets or sets if the plugin is enabled. More... | |
bool | Registered [get] |
Gets if the plugin was registered successfully. More... | |
FREE_IMAGE_FORMAT | Format [get] |
Gets the FREE_IMAGE_FORMAT FreeImage assigned to this plugin. More... | |
Class representing own FreeImage-Plugins.
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: FreeImageAPI.Plugins.LocalPlugin.GetImplementedMethods and FreeImageAPI.Plugins.LocalPlugin.FormatProc. FreeImageAPI.Plugins.LocalPlugin.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 System.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 FreeImageAPI.Plugins.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 FreeImageAPI.Plugins.LocalPlugin.GetImplementedMethods without a real implementation.
FreeImageAPI.Plugins.LocalPlugin.FormatProc is used by some checks of FreeImage and must be implemented. FreeImageAPI.Plugins.LocalPlugin.LoadProc 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.
Definition at line 84 of file LocalPlugin.cs.
|
protected |
MethodFlags defines values to fill a bitfield telling which functions have been implemented by a plugin.
Definition at line 121 of file LocalPlugin.cs.
|
protected |
MethodFlags defines values to fill a bitfield telling which functions have been implemented by a plugin.
Definition at line 121 of file LocalPlugin.cs.
FreeImageAPI.Plugins.LocalPlugin.LocalPlugin | ( | ) |
The constructor automatically registeres the plugin in FreeImage. To do this it prepares a FreeImage defined structure with function pointers to the implemented functions or null if not implemented. Before registing the functions they are pinned in memory so the garbage collector can't move them around in memory after we passed there addresses to FreeImage.
Definition at line 280 of file LocalPlugin.cs.
References FreeImageAPI.Plugins.CloseProc(), FreeImageAPI.Plugins.DescriptionProc(), FreeImageAPI.Plugins.ExtensionListProc(), FreeImageAPI.Plugins.FormatProc(), FreeImageAPI.Plugins.InitProc(), FreeImageAPI.Plugins.LoadProc(), FreeImageAPI.Plugins.MimeProc(), FreeImageAPI.Plugins.OpenProc(), FreeImageAPI.Plugins.PageCapabilityProc(), FreeImageAPI.Plugins.PageCountProc(), FreeImageAPI.Plugins.RegExprProc(), FreeImageAPI.Plugins.SaveProc(), FreeImageAPI.Plugins.SupportsExportBPPProc(), FreeImageAPI.Plugins.SupportsExportTypeProc(), FreeImageAPI.Plugins.SupportsICCProfilesProc(), and FreeImageAPI.Plugins.ValidateProc().
FreeImageAPI.Plugins.LocalPlugin.LocalPlugin | ( | ) |
The constructor automatically registeres the plugin in FreeImage. To do this it prepares a FreeImage defined structure with function pointers to the implemented functions or null if not implemented. Before registing the functions they are pinned in memory so the garbage collector can't move them around in memory after we passed there addresses to FreeImage.
Definition at line 280 of file LocalPlugin.cs.
References FreeImageAPI.Plugins.CloseProc(), FreeImageAPI.Plugins.DescriptionProc(), FreeImageAPI.Plugins.ExtensionListProc(), FreeImageAPI.Plugins.FormatProc(), FreeImageAPI.Plugins.InitProc(), FreeImageAPI.Plugins.LoadProc(), FreeImageAPI.Plugins.MimeProc(), FreeImageAPI.Plugins.OpenProc(), FreeImageAPI.Plugins.PageCapabilityProc(), FreeImageAPI.Plugins.PageCountProc(), FreeImageAPI.Plugins.RegExprProc(), FreeImageAPI.Plugins.SaveProc(), FreeImageAPI.Plugins.SupportsExportBPPProc(), FreeImageAPI.Plugins.SupportsExportTypeProc(), FreeImageAPI.Plugins.SupportsICCProfilesProc(), and FreeImageAPI.Plugins.ValidateProc().
|
protectedvirtual |
Function that can be implemented.
Definition at line 235 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 235 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 219 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 219 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 223 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 223 of file LocalPlugin.cs.
|
protectedpure virtual |
Implementation of FormatProc
|
protectedpure virtual |
Implementation of FormatProc
|
protectedpure virtual |
Function that returns a bitfield containing the implemented methods.
|
protectedpure virtual |
Function that returns a bitfield containing the implemented methods.
|
protectedvirtual |
Function that can be implemented.
Definition at line 247 of file LocalPlugin.cs.
References FreeImageAPI.FIBITMAP.Zero.
|
protectedvirtual |
Function that can be implemented.
Definition at line 247 of file LocalPlugin.cs.
References FreeImageAPI.FIBITMAP.Zero.
|
protectedvirtual |
Function that can be implemented.
Definition at line 259 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 259 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 231 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 231 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 243 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 243 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 239 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 239 of file LocalPlugin.cs.
|
protected |
Reads from an unmanaged stream.
Definition at line 414 of file LocalPlugin.cs.
References DirectX.count, and DirectX.size.
|
protected |
Reads from an unmanaged stream.
Definition at line 414 of file LocalPlugin.cs.
References DirectX.count, and DirectX.size.
|
protected |
Reads a single byte from an unmanaged stream.
Definition at line 425 of file LocalPlugin.cs.
|
protected |
Reads a single byte from an unmanaged stream.
Definition at line 425 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 227 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 227 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 251 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 251 of file LocalPlugin.cs.
|
protected |
Seeks in an unmanaged stream.
Definition at line 453 of file LocalPlugin.cs.
|
protected |
Seeks in an unmanaged stream.
Definition at line 453 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 263 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 263 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 267 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 267 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 271 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 271 of file LocalPlugin.cs.
|
protected |
Retrieves the position of an unmanaged stream.
Definition at line 461 of file LocalPlugin.cs.
|
protected |
Retrieves the position of an unmanaged stream.
Definition at line 461 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 255 of file LocalPlugin.cs.
|
protectedvirtual |
Function that can be implemented.
Definition at line 255 of file LocalPlugin.cs.
|
protected |
Writes to an unmanaged stream.
Definition at line 434 of file LocalPlugin.cs.
References DirectX.count, and DirectX.size.
|
protected |
Writes to an unmanaged stream.
Definition at line 434 of file LocalPlugin.cs.
References DirectX.count, and DirectX.size.
|
protected |
Writes a single byte to an unmanaged stream.
Definition at line 445 of file LocalPlugin.cs.
|
protected |
Writes a single byte to an unmanaged stream.
Definition at line 445 of file LocalPlugin.cs.
|
protected |
The format id assiged to the plugin.
Definition at line 102 of file LocalPlugin.cs.
|
protected |
A copy of the functions used to register.
Definition at line 114 of file LocalPlugin.cs.
|
protected |
When true the plugin was registered successfully else false.
Definition at line 108 of file LocalPlugin.cs.
|
getset |
Gets or sets if the plugin is enabled.
Definition at line 367 of file LocalPlugin.cs.
|
get |
Gets the FREE_IMAGE_FORMAT FreeImage assigned to this plugin.
Definition at line 404 of file LocalPlugin.cs.
|
get |
Gets if the plugin was registered successfully.
Definition at line 396 of file LocalPlugin.cs.