FormFix v6.0 for .NET - Updated
FromHdib(IntPtr,Boolean,FormFix) Method



Accusoft.FormFixSdk Namespace > FormImage Class > FromHdib Method : FromHdib(IntPtr,Boolean,FormFix) Method
The WIN32 HDIB handle to place into the new object.
Indicates whether the new object should delete the handle to the DIB when you call its System.IDisposable.Dispose method. If you set this to true, this object will automatically delete the handle when it is finished using it. If you set it to false, this object will never delete the handle and you must delete it yourself.
A reference to the FormFix workspace object.
Creates a new object and places the given handle into it.
Syntax
'Declaration
 
Public Overloads Shared Function FromHdib( _
   ByVal dib As IntPtr, _
   ByVal ownDib As Boolean, _
   ByVal workspace As FormFix _
) As FormImage
'Usage
 
Dim dib As IntPtr
Dim ownDib As Boolean
Dim workspace As FormFix
Dim value As FormImage
 
value = FormImage.FromHdib(dib, ownDib, workspace)
public static FormImage FromHdib( 
   IntPtr dib,
   bool ownDib,
   FormFix workspace
)
public:
static FormImage^ FromHdib( 
   IntPtr dib,
   bool ownDib,
   FormFix^ workspace
) 

Parameters

dib
The WIN32 HDIB handle to place into the new object.
ownDib
Indicates whether the new object should delete the handle to the DIB when you call its System.IDisposable.Dispose method. If you set this to true, this object will automatically delete the handle when it is finished using it. If you set it to false, this object will never delete the handle and you must delete it yourself.
workspace
A reference to the FormFix workspace object.

Return Value

A new FormImage object that contains the original image.
Remarks

This method will construct a new FormImage object without creating a copy of the original image data it is given. All of this class's other static "From" methods will copy the image. While avoiding the memory copy operation will improve application performance, care must be taken in shared memory situations to prevent the new FormImage object from releasing memory that is needed by the original container or vice versa.

If passing in a value of true for the ownDib parameter, the new FormImage object will view itself as the primary owner of the shared memory. The new FormImage will therefore attempt to dispose of resources associated with the HDIB, when its Dispose method is called.

If passing in a value of false for the ownDib parameter, the new FormImage object will not dispose of resources associated with the HDIB passed into this method. It will be the responsibility of the calling code to properly dispose of the HDIB, presumably by disposing of its original container. The calling code should not dispose of the resources associated with the HDIB until after the FormImage object is no longer being used.

To create a new FormImage object that holds a copy of the original HDIB, use the FromHdib(IntPtr,FormFix) overload. That method overload will create a copy of the dib argument, and therefore the resources associated with the original HDIB can be disposed of immediately after creation of the FormImage. In most cases, this approach will simplify memory management required by the calling code, at the likely cost of some application performance.

The dib must contain a binary (1 bit per pixel) image.

See Also

Reference

FormImage Class
FormImage Members
Overload List

Is this page helpful?
Yes No
Thanks for your feedback.