Changes a LEADTOOLS Leadtools.RasterImage object to a Windows Device-Dependent Bitmap (DDB).
public static IntPtr ChangeToHBitmap(Leadtools.RasterImage image)
Public Overloads Shared Function ChangeToHBitmap( _ByVal image As Leadtools.RasterImage _) As IntPtr
public:static IntPtr ChangeToHBitmap(Leadtools.RasterImage^ image)
image
The source image.
A handle to the device dependent bitmap (DDB) this method creates.
This method results in only one copy of the image, and it invalidates this Leadtools.RasterImage object. You must call RasterImage.Dispose after calling this method.
For more information on DDBs and DIBs, refer to Using DIBs, DDBs, and the Clipboard.
For more information refer to RasterImage and GDI/GDI+.
For an example, refer to ChangeToHBitmap(RasterImage). This example loads a Leadtools.RasterImage, changes it to a DDB and then changes it back to Leadtools.RasterImage.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.DrawingImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.Color<TestMethod()> _Public Sub ChangeToHBitmapExample()Dim codecs As New RasterCodecs()Dim hbitmap As IntPtr' Load an imageUsing image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"), 24, CodecsLoadByteOrder.BgrOrGray, 1, 1)' Change to DDBhbitmap = RasterImageConverter.ChangeToHBitmap(image)' Dispose the image since it is unusable nowEnd Using' Change the DDB to a new LEAD RasterImageUsing image As RasterImage = RasterImageConverter.ChangeFromHBitmap(hbitmap, IntPtr.Zero)' Save this image back to diskcodecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Image1_ChangeToHBitmap.bmp"), RasterImageFormat.Bmp, 24)End UsingDeleteObject(hbitmap)' Clean upcodecs.Dispose()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.Drawing;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;public void ChangeToHBitmapExample(){RasterCodecs codecs = new RasterCodecs();IntPtr hbitmap;// Load an imageusing(RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"), 24, CodecsLoadByteOrder.BgrOrGray, 1, 1)){// Change to DDBhbitmap = RasterImageConverter.ChangeToHBitmap(image);// Dispose the image since it is unusable now}// Change the DDB to a new LEAD RasterImageusing(RasterImage image = RasterImageConverter.ChangeFromHBitmap(hbitmap, IntPtr.Zero)){// Save this image back to diskcodecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Image1_ChangeToHBitmap.bmp"), RasterImageFormat.Bmp, 24);}DeleteObject(hbitmap);// Clean upcodecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
|
Products |
Support |
Feedback: ChangeToHBitmap(RasterImage) Method - Leadtools.Drawing |
Introduction |
Help Version 19.0.2017.3.21
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.