Accusoft.FormFixSdk Namespace > FormImage Class > FromHdib Method : FromHdib(IntPtr,Boolean,FormFix) Method |
'Declaration Public Overloads Shared Function FromHdib( _ ByVal dib As IntPtr, _ ByVal ownDib As Boolean, _ ByVal workspace As FormFix _ ) As FormImage
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.