This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Friday, February 17, 2006 9:22:58 AM(UTC)
Groups: Registered
Posts: 6
I'm trying to use the LBitmapWindow class for displaying grayscale (8 bit) images. I've got a little MFC test app where I'm just trying to display a 128x128 pixel image. My LBitmapWindow object is a member of my View derived class, here is the OnCreate method:
int ClttestView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
m_LBitmapWindow.SetWndHandle(GetSafeHwnd());
LPBYTE buffer = new BYTE[128 * 128];
memset(buffer, 255, 128 * 128);
L_INT iResult = m_LBitmapWindow.Create(128, 128, 0, 0, 0, TOP_LEFT, TYPE_USER, buffer, 128 * 128);
return 0;
}
The documentation says if you pass 0 for the bits per pixel, it will do 8 bit grayscale, and ignore the uOrder and pPalette parameters. I'm initializing my buffer to 255, so I'm expecting a white square to be displayed. Instead of getting white though, I'm getting a bright yellow square. Is there something I'm missing?
Thanks,
Torin Ford
nextScan Inc.
#2
Posted
:
Monday, February 20, 2006 6:56:03 AM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
Torin,
I tried similar code using LEADTOOLS 14 and I got a white rectangle. I
then filled have the data with 50 instead of 255 and got half white and
half dark gray. So whatever is happening at your side is not happening
here.
Can you reproduce the problem in a small test project and either post it here or send it to
support@LEADTOOLS.com
Important note: If you post or email files, please put them in a ZIP file first.
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
#3
Posted
:
Tuesday, February 21, 2006 5:48:58 AM(UTC)
Groups: Registered
Posts: 6
Amin,
Here is a simple sample that is close to the way that I want to use the LBitmapWindow class. I should note that I'm using LeadTools 13 for this.
Thanks,
Torin Ford
nextScan Inc.
#4
Posted
:
Wednesday, February 22, 2006 11:48:00 AM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
Torin,
I tried to run your project but ran into problems I couldn't fix, which were:
1. there are missing resource files.
2. The project uses some paths from environment variables not defined on my machine.
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
#5
Posted
:
Wednesday, February 22, 2006 11:55:44 AM(UTC)
Groups: Registered
Posts: 6
You should be able to change the environment variables easily. The custom build step contains one usage that copies the executable to a common directory (where the LeadTools dlls are). The other environment variable usages are just pointing to where the includes and libraries are for LeadTools. Again, these should be easy to update. I don't see any missing resource files on this end.
Torin
#6
Posted
:
Wednesday, February 22, 2006 1:23:10 PM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
Torin,
I already solved the path problems, but there are 5 missing files the project references from a folder named .\res\
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
#7
Posted
:
Thursday, February 23, 2006 5:29:20 AM(UTC)
Groups: Registered
Posts: 6
My bad. Here is a zip of the res dir.
Torin Ford
nextScan Inc.
File Attachment(s):
res.zip (12kb) downloaded 38 time(s).
#8
Posted
:
Sunday, February 26, 2006 2:51:00 PM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
Torin,
Using your project I found the problem. When you call
m_LBitmapWindow.SetWndHandle before creating the bitmap, the
LBitmapWindow object does not add an appropriate palette handler. There
are 2 solutions to this:
1. Either change the order by calling m_LBitmapWindow.Create before SetWndHandle.
2. Or if you want to keep the order, call this after creating the bitmap:
m_LBitmapWindow.HandlePalette(WM_QUERYNEWPALETTE, 0, 0);
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
#9
Posted
:
Sunday, August 26, 2012 6:39:00 AM(UTC)
Groups: Registered
Posts: 6
Quote:Amin wrote:Torin,
Using your project I found the problem. When you call m_LBitmapWindow.SetWndHandle before creating the bitmap, the LBitmapWindow object does not add an appropriate palette handler. There are 2 solutions to this:
1. Either change the order by calling m_LBitmapWindow.Create before SetWndHandle.
2. Or if you want to keep the order, call this after creating the bitmap:
m_LBitmapWindow.HandlePalette(WM_QUERYNEWPALETTE, 0, 0);
Amin, This is great. For whatever reason we never ended up doing what we wanted before but here I am six years later and am looking into this again. Thanks for your response as it helped out this time.
Edited by moderator Wednesday, October 19, 2016 8:51:09 AM(UTC)
| Reason: Not specified
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.