Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, July 29, 2005 7:02:58 AM(UTC)

mmiller  
mmiller

Groups: Registered
Posts: 11


Is there any way to easily convert a VB.net bitmap object to the bitmap property of a LEAD Raster Viewer control?  I am using the COM version of LEADTools version 14.

 

Thanks.

 

Mark Miller

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, August 1, 2005 5:00:20 AM(UTC)

Gabe  
Gabe

Groups: Registered, Tech Support
Posts: 46


Mark,

Thank you for your interest in LEAD and LEADTOOLS.

In the Leadtools.Compatibility DLL is a RasterImageConverter Class. You may use the function RasterImageConverter.ToLeadBitmap Method to convert a .NET image to a LEADTOOLS ActiveX, COM or API BITMAPHANDLE.

Let us know if you have any additional questions.

Gabriel Smith
LEAD Technologies, Inc.

Gabe
Developer Support
LEAD Technologies, Inc.

LEAD Logo
 
#3 Posted : Monday, August 1, 2005 5:23:19 AM(UTC)

mmiller  
mmiller

Groups: Registered
Posts: 11


I saw something like this in another post, but I can't find the reference in my project.  Can you tell me which control/dll I need to reference to get the RasterImageConverter class?
 
#4 Posted : Tuesday, August 2, 2005 8:19:39 AM(UTC)

Gabe  
Gabe

Groups: Registered, Tech Support
Posts: 46


Thank you for your interest in LEAD and LEADTOOLS.

LEADTOOLS.Compatibility.DLL

Thanks,

Gabriel Smith
LEAD Technologies, Inc.

Gabe
Developer Support
LEAD Technologies, Inc.

LEAD Logo
 
#5 Posted : Tuesday, August 2, 2005 10:02:44 AM(UTC)

mmiller  
mmiller

Groups: Registered
Posts: 11


As I said in my earlier post, I am using the COM objects, not the .NET versions of the controls.  I do not have a LEADTOOLS name space.  Can you tell me what reference or DLL I need to add to get this control?
 
#6 Posted : Tuesday, August 2, 2005 10:14:04 AM(UTC)

Gabe  
Gabe

Groups: Registered, Tech Support
Posts: 46


I apologize. I saw bitmap and .NET and had nothing but LEADTOOLS on my mind.

I am not sure if this is the best way, but you may be able to use the bitmap.Save method and save the image to a memory stream and then use the LoadMemory or LoadArray method of the LEADTOOLS RasterIO object.

I will check with some of the other guys here to see if there is a better way. Thanks,

Gabriel

Gabe
Developer Support
LEAD Technologies, Inc.

LEAD Logo
 
#7 Posted : Tuesday, August 2, 2005 11:26:18 AM(UTC)

Gabe  
Gabe

Groups: Registered, Tech Support
Posts: 46


There is a better way.

Use the Bitmap.GetHbitmap method and then the LEAD GetDDB Method.

Gabriel

Gabe
Developer Support
LEAD Technologies, Inc.

LEAD Logo
 
#8 Posted : Wednesday, August 3, 2005 5:06:01 AM(UTC)

mmiller  
mmiller

Groups: Registered
Posts: 11


Gabriel,

You wouldn't happen to have an example, would you?  The following example code doesn't work, but it is as close as I can get to using functions that take parameters that I have access to.

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim theImage As Bitmap

Dim _rasterIO As New LTRASTERIOLib.LEADRasterIO

Dim i As Integer, j As Integer, col As Color

theImage = New Bitmap(10, 10)

col = Color.FromArgb(255, 0, 0)

For i = 3 To 5

For j = 3 To 5

theImage.SetPixel(i, j, col)  ' just put a little red square in the bitmap

Next

Next

' the following 2 lines work

'theImage.Save("c:\tmp\test.bmp")

'_rasterIO.Load(lpicPreview.Raster, "c:\tmp\test.bmp", 24, 1, 1)

' but this one doesn't

lpicPreview.Raster.SetDIB(theImage.GetHbitmap.ToInt32)

End Sub

 
#9 Posted : Thursday, August 4, 2005 8:56:48 AM(UTC)

Gabe  
Gabe

Groups: Registered, Tech Support
Posts: 46


Attached is a VB.NET project that will load a .NET bitmap to a LEADTOOLS Raster Image Viewer.

If you have any questions, let me know.

Gabriel

File Attachment(s):
dotNetBitmapToLEADCom.zip (216kb) downloaded 28 time(s).
Gabe
Developer Support
LEAD Technologies, Inc.

LEAD Logo
 
#10 Posted : Thursday, August 4, 2005 11:03:25 AM(UTC)

mmiller  
mmiller

Groups: Registered
Posts: 11


Gabriel,

That works like a charm.  Thanks for your help.

Mark

 
#11 Posted : Tuesday, July 18, 2006 11:58:29 AM(UTC)
RobbSadler

Groups: Registered
Posts: 4


I am needing to do the conversion from a Windows Bitmap or Image object, and I looked into your RasterImageConverter.ToLeadBitmap function but it has only one parameter and it takes a IRasterImage and kernel name.

I don't see an overload that allows for a .net object to be passed in...

Thanks!

Robb
 
#12 Posted : Thursday, July 20, 2006 10:11:57 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 356


Robb,
RasterImageConverter converts between LEADTOOLS OCX bitmaps and LEADTOOLS .NET bitmaps. It does not work with non-LEAD images.

An easy way to convert a Windows System.Drawing.Image to a Leadtools.RasterImage is to use the RasterImage Constructor that takes a System.Drawing.Image. Here's a VB.NET sample code:

Dim WinImg As System.Drawing.Image = New Bitmap("C:\SourcFile.BMP")
Dim LtImg As Leadtools.RasterImage = New Leadtools.RasterImage(WinImg)

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.261 seconds.