Print Page | Close Window

Problem Loading 24-bit Images

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Task Panel
Forum Description: Topics Related to Codejock Task Panel
URL: http://forum.codejock.com/forum_posts.asp?TID=5784
Printed Date: 28 April 2024 at 3:21am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Problem Loading 24-bit Images
Posted By: KFournier
Subject: Problem Loading 24-bit Images
Date 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.



Replies:
Posted By: Oleg
Date 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


Posted By: KFournier
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net