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 : Monday, January 12, 2004 3:18:27 AM(UTC)
viswanadha.subrahmanyam

Groups: Registered
Posts: 1


Hi,
 
Previously we were using leadtools8.
Now we changed our project to LeadTools version 13.
 
But in LeadTools version13, L_GetControlBitmap is giving different handle values to the same bitmap.
We are passing this handle to one function as byref argument, which was written in VC++, which in turn is changing the color properties of the
handle. Finally we are getting the properties of the handle and set to the lead control to display the image.
 
But the function "L_GetControlBitmap" is giving different handle values. Because of this GlobalLock method is returning false.
 
The code for the method which was written in VC++ is below: This is a .c file.
 
EXTERN_C BOOL FAR PASCAL _export ModifyColorBits(HANDLE Bitmap, long Height, long Width, double red, double green, double blue)
{
 pBITMAPHANDLE pBitmap; /* pointer to the bitmap handle */
 long Row, Col;   /* Row and Column number of the pixel */
 long r, g, b;
 long PixelColor, Color;
 if((pBitmap = GlobalLock(Bitmap)) == NULL)  -------- This is giving NULL Value all the times as the handle is giving different values.

 {
  MessageBox(NULL, "Cannot lock the image memory.", "Image Color Correction", MB_OK);
  return FALSE;
 }
 
 for(Row = 0; Row < Height; Row++)
 {
  for (Col = 0; Col < Width; Col++) 
  {
   // Get the pixel color number from Bitmap (Leadtool function).
   PixelColor = L_GetPixelColor(pBitmap, Row, Col);  
   
   // Converts the large pixel color number to red, green and blue value
   r = PixelColor & 0xff; 
 
   g = PixelColor / ONEBYTE;   
   if(g > 65535) g = 65535;
   g = g & 0xff;  
 
   b = PixelColor / TWOBYTE;
   if(b > 255) b = 255;
   b = b & 0xff;
 
   // Call the color algorithm
   Color = ColorAlgorithm (r, g, b, red, green, blue);            
 
   // Put the pixel value into the bitmap
   if(Color != PixelColor) L_PutPixelColor(pBitmap, Row, Col, Color);   
  }
 } 
 
 GlobalUnlock(pBitmap);
 
 return TRUE;
}
The Code in VB to use this method is:
 
Declare Function ModifyColorBits Lib "ColorFix" (ByRef Bitmap As LEADBitmapHandle, ByVal Height As Long, ByVal Width As Long, ByVal r As Double, ByVal g As Double, ByVal b As Double) As Boolean
 
Dim r As Double, g As Double, b As Double
Dim LeadHandle As LEADBitmapHandle
 
L_GetControlBitmap leadImage, LeadHandle
ModifyColorBits LeadHandle, leadImage.BitmapHeight, leadImage.BitmapWidth, r, g, b
L_SetControlBitmap leadImage, LeadHandle
 
Can any one help me to solve this problem?
 
 

Warm Regards,

Subrahmanyam Viswanadha

 

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 : Thursday, May 5, 2005 12:37:42 PM(UTC)

Ike  
Ike

Groups: Tech Support
Posts: 23

Thanks: 3 times

In version 13, the function L_GetControlBitmap does not return a HANDLE that must be locked using GlobalLock. It returns a pointer to a LEAD BITMAPHANDLE structure. The following is a sample that uses L_GetControlBitmap and L_SetControlBitmap:
Dim hBitmap As LEADBitmapHandle
Dim lRet As Long

LEAD1.Load "d:\temp\golf.jpg", 0, 1, 1
lRet = L_GetControlBitmap(LEAD1, hBitmap)
If (lRet = 1) Then
LEAD1.bitmap = 0 'free existing image
MsgBox "wait"
lRet = L_FlipBitmap(hBitmap)
lRet = L_SetControlBitmap(LEAD1, hBitmap)
L_FreeBitmap hBitmap
End If

Edited by moderator Monday, April 10, 2017 2:01:00 PM(UTC)  | Reason: Not specified

Ike
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-2024, Yet Another Forum.NET
This page was generated in 0.093 seconds.