Print Page | Close Window

32bit png display using CXTPSkinImage

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=10354
Printed Date: 14 May 2024 at 2:03pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: 32bit png display using CXTPSkinImage
Posted By: winrive
Subject: 32bit png display using CXTPSkinImage
Date Posted: 25 April 2008 at 1:19am

I want to display background of control(or window) using CXTPSkinImage.

 

below is my code.

 

CXTPSkinImage  m_BKImage;

 

BOOL bIsAlpha = TRUE;

HBITMAP hBitmap = CXTPImageManagerIcon::LoadBitmapFromResource( MAKEINTRESOURCE(nResourceID), &bIsAlpha );

m_BKImage.SetBitmap( hBitmap, bIsAlpha );

 

CXTPClientRect rcClient(this);

dc.FillSolidRect( &rcClient, RGB(0,0,0) );

CSize sizeImage = CSize( m_BKImage.GetWidth(), m_BKImage.GetHeight() );

m_BKImage.DrawImage( &dc, rcClient, CRect(0,0,sizeImage.cx,sizeImage.cy), CRect(0,0,0,0), ST_TRUESIZE, TRUE );

 

but i got strange result

some parts of image are strange( see white area in b) )

 
 
a) in photoshop
 
b) result
 

What is wrong?

Here is png file
https://forum.codejock.com/uploads/20080425_011633_btn_play06_n.zip - uploads/20080425_011633_btn_play06_n.zip
 



Replies:
Posted By: Oleg
Date Posted: 25 April 2008 at 6:20am

Use ImageManager instead.

 
XTPImageManager()->SetIcons(....);
XTPImageManager()->GetIcon(1)->Draw(...);
 
 
or Premultiply bitmap for SkinImage:
 
hBitmap = CXTPImageManagerIcon::PreMultiplyAlphaBitmap(hBmp, &m_bAlpha);
DeleteObject(hBmp);


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: winrive
Date Posted: 27 April 2008 at 7:43pm
It works good
Thanks a lot.
 
Could you let me know another better apporach for dispalying alpha png for background?


Posted By: Oleg
Date Posted: 28 April 2008 at 12:43am
As I worte better use some XTPImageManager. You can create some instance for your buttons:
 
m_pImageManager = new CXTPImageManager();
m_pImageManager->SetIcons(...);
 
...
m_pImageManager()->GetImage(x)->Draw(...);


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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