Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - CXTPImageManagerIconHandle::CopyHandle
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPImageManagerIconHandle::CopyHandle

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 899
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: CXTPImageManagerIconHandle::CopyHandle
    Posted: 02 March 2009 at 1:17pm
I am calling CopyHandle and then GetBitmap.
 
For png based glyphs, the call to GetBitmap is returning a bitmap that appears to be blended to a background color that is black. I actually need it blended against a specific background color of a web page as we write out a bmp file that is referenced by the web page. With non-png based glyphs, I am able to spin thru the bitmap before I write it and change the backgound pixels to my desired background. But that doesn't work with the bitmap returned from GetBitmap if the underlying glyph is png because the pixels have already been blended (with black).
 
However I have found that CopyHandle calls CXTPImageManagerResource::CreateIcon. In that routine if I bypass the if (pRinfo->bAlpha) code and force the code in the else clause to run, I get a good bitmap. That is, there are no anomolies when the image is viewd on the web page. The anomolies we see are along the edges where the alpha plane has caused our image to blend to a black background (so we have black looking pixels along some "edges" in the image.
 
How can I get a consitent bitmap whether using png or not?
 
Do I need to find some code that writes a png or icon out and use those on our web page instead of bmp files? If so, then I have another issue. Whenever I call GetIcon (on the original or the copied icon handle object), the hIcon is always NULL so I have to call GetBitmap.
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: 03 March 2009 at 12:50am

Hi,

Think you can just call
HBITMAP AFX_CDECL CXTPImageManagerIcon::LoadBitmapFromResource(LPCTSTR lpszResource, BOOL* lbAlphaBitmap)
and load your png without put it to ImageHandle.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 899
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 03 March 2009 at 11:28am
Images are loaded via LoadIconArray and are not individual images. When rendering a png to a bitmap, it would seem that the user really needs to be able to provide the background. There are a lot of functions to get icons, bitmaps and even draw into a dc so I will keep trying until I find a method that allows me to obtain the image I need. After all, you manage to draw the images on the command ribbon and tooltips without the black background (and blends to black) that I am seeing.
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.033 seconds.