![]() |
Paradox Game Engine
v1.0.0 beta06
|
Wrapper for a custom handle. More...
Public Member Functions | |
fi_handle (object obj) | |
Initializes a new instance wrapping a managed object. More... | |
override string | ToString () |
Converts the numeric value of the fi_handle object to its equivalent string representation. More... | |
override int | GetHashCode () |
Returns a hash code for this fi_handle structure. More... | |
override bool | Equals (object obj) |
Tests whether the specified object is a fi_handle structure and is equivalent to this fi_handle structure. More... | |
bool | Equals (fi_handle other) |
Indicates whether the current object is equal to another object of the same type. More... | |
int | CompareTo (object obj) |
Compares this instance with a specified Object. More... | |
int | CompareTo (fi_handle other) |
Compares this instance with a specified fi_handle object. More... | |
void | Dispose () |
Releases all resources used by the instance. More... | |
fi_handle (object obj) | |
Initializes a new instance wrapping a managed object. More... | |
override string | ToString () |
Converts the numeric value of the fi_handle object to its equivalent string representation. More... | |
override int | GetHashCode () |
Returns a hash code for this fi_handle structure. More... | |
override bool | Equals (object obj) |
Tests whether the specified object is a fi_handle structure and is equivalent to this fi_handle structure. More... | |
bool | Equals (fi_handle other) |
Indicates whether the current object is equal to another object of the same type. More... | |
int | CompareTo (object obj) |
Compares this instance with a specified Object. More... | |
int | CompareTo (fi_handle other) |
Compares this instance with a specified fi_handle object. More... | |
void | Dispose () |
Releases all resources used by the instance. More... | |
Static Public Member Functions | |
static bool | operator== (fi_handle left, fi_handle right) |
Tests whether two specified fi_handle structures are equivalent. More... | |
static bool | operator!= (fi_handle left, fi_handle right) |
Tests whether two specified fi_handle structures are different. More... | |
static bool | operator== (fi_handle left, fi_handle right) |
Tests whether two specified fi_handle structures are equivalent. More... | |
static bool | operator!= (fi_handle left, fi_handle right) |
Tests whether two specified fi_handle structures are different. More... | |
Public Attributes | |
IntPtr | handle |
The handle to wrap. More... | |
Properties | |
bool | IsNull [get] |
Gets whether the pointer is a null pointer. More... | |
Wrapper for a custom handle.
The fi_handle of FreeImage in C++ is a simple pointer, but in .NET it's not that simple. This wrapper uses fi_handle in two different ways.
We implement a new plugin and FreeImage gives us a handle (pointer) that we can simply pass through to the given functions in a 'FreeImageIO' structure. But when we want to use LoadFromhandle or SaveToHandle we need a fi_handle (that we receive again in our own functions). This handle is for example a stream (see LoadFromStream / SaveToStream) that we want to work with. To know which stream a read/write is meant for we could use a hash value that the wrapper itself handles or we can go the unmanaged way of using a handle. Therefor we use a GCHandle to receive a unique pointer that we can convert back into a .NET object. When the fi_handle instance is no longer needed the instance must be disposed by the creater manually! It is recommended to use the using
statement to be sure the instance is always disposed:
What does that mean? If we get a fi_handle from unmanaged code we get a pointer to unmanaged memory that we do not have to care about, and just pass ist back to FreeImage. If we have to create a handle our own we use the standard constructur that fills the IntPtr with an pointer that represents the given object. With calling GetObject the IntPtr is used to retrieve the original object we passed through the constructor.
This way we can implement a fi_handle that works with managed an unmanaged code.
Definition at line 83 of file fi_handle.cs.
FreeImageAPI.IO.fi_handle.fi_handle | ( | object | obj | ) |
Initializes a new instance wrapping a managed object.
obj | The object to wrap. |
ArgumentNullException | obj is null. |
Definition at line 96 of file fi_handle.cs.
FreeImageAPI.IO.fi_handle.fi_handle | ( | object | obj | ) |
Initializes a new instance wrapping a managed object.
obj | The object to wrap. |
ArgumentNullException | obj is null. |
Definition at line 96 of file fi_handle.cs.
int FreeImageAPI.IO.fi_handle.CompareTo | ( | object | obj | ) |
Compares this instance with a specified Object.
obj | An object to compare with this instance. |
ArgumentException | obj is not a fi_handle. |
Definition at line 211 of file fi_handle.cs.
int FreeImageAPI.IO.fi_handle.CompareTo | ( | object | obj | ) |
Compares this instance with a specified Object.
obj | An object to compare with this instance. |
ArgumentException | obj is not a fi_handle. |
Definition at line 211 of file fi_handle.cs.
int FreeImageAPI.IO.fi_handle.CompareTo | ( | fi_handle | other | ) |
Compares this instance with a specified fi_handle object.
other | A fi_handle to compare. |
Definition at line 230 of file fi_handle.cs.
References FreeImageAPI.IO.fi_handle.handle.
int FreeImageAPI.IO.fi_handle.CompareTo | ( | fi_handle | other | ) |
Compares this instance with a specified fi_handle object.
other | A fi_handle to compare. |
Definition at line 230 of file fi_handle.cs.
void FreeImageAPI.IO.fi_handle.Dispose | ( | ) |
Releases all resources used by the instance.
Definition at line 238 of file fi_handle.cs.
void FreeImageAPI.IO.fi_handle.Dispose | ( | ) |
Releases all resources used by the instance.
Definition at line 238 of file fi_handle.cs.
override bool FreeImageAPI.IO.fi_handle.Equals | ( | object | obj | ) |
override bool FreeImageAPI.IO.fi_handle.Equals | ( | object | obj | ) |
bool FreeImageAPI.IO.fi_handle.Equals | ( | fi_handle | other | ) |
Indicates whether the current object is equal to another object of the same type.
other | An object to compare with this object. |
Definition at line 200 of file fi_handle.cs.
bool FreeImageAPI.IO.fi_handle.Equals | ( | fi_handle | other | ) |
Indicates whether the current object is equal to another object of the same type.
other | An object to compare with this object. |
Definition at line 200 of file fi_handle.cs.
override int FreeImageAPI.IO.fi_handle.GetHashCode | ( | ) |
Returns a hash code for this fi_handle structure.
Definition at line 178 of file fi_handle.cs.
override int FreeImageAPI.IO.fi_handle.GetHashCode | ( | ) |
Returns a hash code for this fi_handle structure.
Definition at line 178 of file fi_handle.cs.
Tests whether two specified fi_handle structures are different.
left | The fi_handle that is to the left of the inequality operator. |
right | The fi_handle that is to the right of the inequality operator. |
Definition at line 127 of file fi_handle.cs.
Tests whether two specified fi_handle structures are different.
left | The fi_handle that is to the left of the inequality operator. |
right | The fi_handle that is to the right of the inequality operator. |
Definition at line 127 of file fi_handle.cs.
References FreeImageAPI.IO.fi_handle.handle.
Tests whether two specified fi_handle structures are equivalent.
left | The fi_handle that is to the left of the equality operator. |
right | The fi_handle that is to the right of the equality operator. |
Definition at line 114 of file fi_handle.cs.
References FreeImageAPI.IO.fi_handle.handle.
Tests whether two specified fi_handle structures are equivalent.
left | The fi_handle that is to the left of the equality operator. |
right | The fi_handle that is to the right of the equality operator. |
Definition at line 114 of file fi_handle.cs.
override string FreeImageAPI.IO.fi_handle.ToString | ( | ) |
Converts the numeric value of the fi_handle object to its equivalent string representation.
Definition at line 169 of file fi_handle.cs.
override string FreeImageAPI.IO.fi_handle.ToString | ( | ) |
Converts the numeric value of the fi_handle object to its equivalent string representation.
Definition at line 169 of file fi_handle.cs.
IntPtr FreeImageAPI.IO.fi_handle.handle |
The handle to wrap.
Definition at line 88 of file fi_handle.cs.
Referenced by FreeImageAPI.IO.fi_handle.CompareTo(), FreeImageAPI.IO.fi_handle.operator!=(), and FreeImageAPI.IO.fi_handle.operator==().
|
get |
Gets whether the pointer is a null pointer.
Definition at line 136 of file fi_handle.cs.