FromDib(IntPtr) Method (original) (raw)
Summary
Creates a new image from the specified Windows Device Independent Bitmap (DIB) stored in an unmanaged pointer.
Syntax
C#
Objective-C
C++/CLI
Python
+ (nullable LTRasterImage *)fromDib:(LTHandle *)dib error:(NSError **)error
Parameters
hdib
Handle to the Windows DIB.
Return Value
The newly created RasterImage object.
Example
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Core;
using Leadtools.ImageProcessing.Color;
using Leadtools.Dicom;
using Leadtools.Drawing;
using Leadtools.Controls;
using Leadtools.Svg;
public void ToDibExample()
{
RasterCodecs codecs = new RasterCodecs();
IntPtr dib;
using (RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")))
{
dib = image.ToDib(RasterConvertToDibType.BitmapInfoHeader);
}
using (RasterImage image = RasterImage.FromDib(dib))
{
codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Image1_FromDib.bmp"), RasterImageFormat.Bmp, 0);
}
Marshal.FreeHGlobal(dib);
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Leadtools Assembly