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, February 17, 2006 9:27:58 AM(UTC)

torin  
torin

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.
 

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, February 20, 2006 7:01:03 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


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.
LEAD Logo
 
#3 Posted : Tuesday, February 21, 2006 5:53:58 AM(UTC)

torin  
torin

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.
File Attachment(s):
lttest.zip (15kb) downloaded 28 time(s).
 
#4 Posted : Wednesday, February 22, 2006 11:53:00 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


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.
LEAD Logo
 
#5 Posted : Wednesday, February 22, 2006 12:00:44 PM(UTC)

torin  
torin

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:28:10 PM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


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.
LEAD Logo
 
#7 Posted : Thursday, February 23, 2006 5:34:20 AM(UTC)

torin  
torin

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 28 time(s).
 
#8 Posted : Sunday, February 26, 2006 2:56:00 PM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


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.
LEAD Logo
 
#9 Posted : Sunday, August 26, 2012 6:44:00 AM(UTC)

torin  
torin

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:56: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.

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