Accusoft.ImagXpressSdk Namespace > ImageX Class : ToHdib(Boolean) Method |
If the release parameter is true, then the ImageX object no longer has an underlying image. It will be an empty image. Otherwise, false should be set to return a copy of the underlying ImageX's HDIB.
No matter what the release parameter is, the caller will be given an HDIB that they are responsible for freeing. This HDIB value passed back from the ToHdib function is a global memory object and needs to be manually freed by the calling application otherwise memory leaks could arise.
The easiest and less resource intensive way to free the returned HDIB is to use the static DisposeHdib method.
Another way of freeing of the HDIB can be done by creating a new ImageX object using FromHdib(ImagXpress,IntPtr,Boolean)(Accusoft.ImagXpressSdk.ImagXpress imagXpress, IntPtr hdib, System.Boolean ownDib) with the ownDib parameter set to true. This will ensure the new ImageX object will take ownership of the HDIB. Then the normal ImageX's Dispose method can be called to dispose of the ImageX object and the underlying HDIB.
Note: Calling DeleteObject() will not successfully release the HDIB.