ImageGear .NET v24.12 - Updated
Converting DIB to HDIB (Accusoft Xpress)
User Guide > How to Work with... > Common Operations > Manipulating Image Data > Converting DIB to HDIB (Accusoft Xpress)

ImageGear .NET provides a point of integration between the Xpress components and ImageGear, which allows you to copy the raster page DIB to the Xpress components HDIB. This can be done by using the ImGearRasterPage.CopyTo() method that makes a copy of the raster page's image data and gives the new image data to another object, which can be defined in a different Accusoft assembly. When finished, both the raster page and the destination object will contain separate copies of the same image data.

C# Example
Copy Code
using (FileStream fileStream = new FileStream("image.tif", FileMode.Open))
{
    // Load an image page.
    ImGearRasterPage page = ImGearFileFormats.LoadPage(fileStream, 0) as ImGearRasterPage;
    // Copy the page's DIB to the xpressComponent's HDIB.
    page.CopyTo(xpressComponent);
}
Visual Basic Example
Copy Code
Using fileStream As New FileStream("image.tif", FileMode.Open, FileAccess.Read, FileShare.Read)
    ' Load an image page.
    Dim page As ImGearRasterPage = DirectCast(ImGearFileFormats.LoadPage(fileStream, 0), ImGearRasterPage)
    ' Copy the page's DIB to the xpressComponent's HDIB.
    page.CopyTo(xpressComponent)
End Using

Using ImageGear from Xpress Components

ImageGear .NET implements an internal interface that allows the ImGearRasterPage to act as a target of the CopyTo(), TransferTo() and Analyze() methods of the Xpress components, which makes it easier for the ImageGear .NET and Xpress code to work together and for you to pass an HDIB to and from the Xpress components.

C# Example
Copy Code
using (FileStream fileStream = new FileStream("image.tif", FileMode.Open))
{
    // Load an image page.
    ImGearRasterPage page = ImGearFileFormats.LoadPage(fileStream, 0) as ImGearRasterPage;
    // Analyze loaded raster page using Xpress component.
    xpressComponent.Analyze(page);
}
Visual Basic Example
Copy Code
Using fileStream As New FileStream("image.tif", FileMode.Open, FileAccess.Read, FileShare.Read)
    ' Load an image page.
    Dim page As ImGearRasterPage = DirectCast(ImGearFileFormats.LoadPage(fileStream, 0), ImGearRasterPage)
    ' Analyze loaded raster page using Xpress component.
    xpressComponent.Analyze(page)
End Using