Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Skin Framework
  New Posts New Posts RSS Feed - 32bit png display using CXTPSkinImage
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

32bit png display using CXTPSkinImage

 Post Reply Post Reply
Author
Message
winrive View Drop Down
Newbie
Newbie


Joined: 16 April 2008
Location: Korea, South
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote winrive Quote  Post ReplyReply Direct Link To This Post Topic: 32bit png display using CXTPSkinImage
    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
 
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: 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
Back to Top
winrive View Drop Down
Newbie
Newbie


Joined: 16 April 2008
Location: Korea, South
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote winrive Quote  Post ReplyReply Direct Link To This Post 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?
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: 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
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.156 seconds.