This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Friday, March 30, 2007 6:31:21 AM(UTC)
Groups: Registered
Posts: 6
Hi:
I have a bitmap in the resource which I can load into memory using the Windows API calls like:
HBITMAP thumbLoad = NULL;
thumbLoad = LoadBitmap(ImageEditorInstance, "ThumbLoad");
How can I convert this to TLEADImage (VCL). I am willing to use the LeadTools API calls if I have to.
I am using version 14.0
Thank you
Sam
#2
Posted
:
Sunday, April 1, 2007 11:24:43 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
The bitmap returned by the Windows API LoadBitmap function is a Device Dependent Bitmap. You should be able to assign it to a LEAD bitmap using the Main VCL SetDDB function.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#3
Posted
:
Monday, April 2, 2007 4:04:23 AM(UTC)
Groups: Registered
Posts: 6
Is there a DIB version of LoadBitmap that I can use?
#4
Posted
:
Monday, April 2, 2007 6:40:31 AM(UTC)
Groups: Registered
Posts: 6
ok here is what I did:
HANDLE tBmpHandle;
tBmpHandle = LoadImage(MainInstance, "TestBmp", IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_MONOCHROME);
try
{
Image->SetDIB((unsigned int)tBmpHandle);
}
__finally
{
DeleteObject(tBmpHandle);
}
But I get "SetDIB:Invalid parameter passed." error.
Thank you
Sam
#5
Posted
:
Tuesday, April 3, 2007 9:58:04 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
Are you sure that the tBmpHandle contains valid image data?
Also, if declare the tBmpHandle as THandle and pass it as follows, do you get the same problem?
Image->SetDIB(tBmpHandle)
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#6
Posted
:
Monday, April 9, 2007 8:52:25 AM(UTC)
Groups: Registered
Posts: 6
As you can see in the attached test project, the bitmap is valid and using THandle will not have any effect.
#7
Posted
:
Thursday, April 12, 2007 4:55:24 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
The SetDIB function requires an HGLOBAL. One way to load the resource and set it is:
HRSRC pResrce = FindResource(NULL, "TestBmp", RT_BITMAP);
int n=SizeofResource(NULL, pResrce);
HGLOBAL hResBitmap = GlobalAlloc(0, n);
void *p=GlobalLock(hResBitmap);
memcpy(p, LoadResource(NULL,pResrce), n);
GlobalUnlock(hResBitmap);
LEADImage1->SetDIB((unsigned int)hResBitmap);
GlobalFree(hResBitmap);
Thanks,
Maen Badwan
LEADTOOLS Technical Support
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.