Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Task Panel
  New Posts New Posts RSS Feed - Problem Loading 24-bit Images
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem Loading 24-bit Images

 Post Reply Post Reply
Author
Message
KFournier View Drop Down
Groupie
Groupie
Avatar

Joined: 17 August 2004
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote KFournier Quote  Post ReplyReply Direct Link To This Post Topic: Problem Loading 24-bit Images
    Posted: 13 December 2006 at 1:35pm
I am trying to load the Task Panel control with custom loaded images using the FreeImage library. So far, it works fine if the images are 32-bit, but 24-bit images just show up completely black.

 
The group icon is a 32-bit .bmp and the black squares are loaded from a 24-bit bmp. It doesn't matter what 24-bit bmp I load, it's black. I've stepped through the image manager code and it never errors out. Here is my logic for setting the custom loaded images:
 

 if( pImageManager && m_pImage )
 {
  if( FreeImage_FlipVertical(m_pImage) )
  {
   // get image attributes
   int nWidth = FreeImage_GetWidth(m_pImage);
   int nHeight = FreeImage_GetHeight(m_pImage);
   UINT nBPP = FreeImage_GetBPP(m_pImage);
   // convert to CBitmap
   CBitmap bmp;
   bmp.CreateBitmap( nWidth, nHeight, 1, nBPP, FreeImage_GetBits(m_pImage) );
   // load image manager
   if( m_bHasColorKey )
    pImageManager->SetMaskColor( m_clrKey );
   pImageManager->SetIcons( bmp, 0, GetFrameCount(), GetSize(), xtpImageNormal, nBPP == 32 );
   // restore the image
   FreeImage_FlipVertical( m_pImage );
  }
 }
 
Any ideas on where to start looking? Thanks.
Kevin R. Fournier
SRP Computer Solutions, Inc.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2006 at 3:36pm
Hi,
Just think nBPP is 32...  Think FreeImage automatically convert them to 32 bit. Check nBPP  value.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
KFournier View Drop Down
Groupie
Groupie
Avatar

Joined: 17 August 2004
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote KFournier Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2006 at 4:05pm
No, I checked this. nBPP is 24 when I load 24-bit images. In fact, I followed the code to the point where the Image Manager, seeing that the bAlpha is FALSE, simply loads the bitmap into an image list and goes from there. So, maybe the image list doesn't like the bitmap bits, although
I haven't had any problems using FreeImage in my own libraries.
 
In the interested of moving forward, I've modifed the Task Panel source code to use my own image class. I was just hoping I could find a way to avoid it, since modifying source is a headache when it comes to upgrades.
 
If you can think of anything else for me to look at, please share it. Thanks.
Kevin R. Fournier
SRP Computer Solutions, Inc.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.