Print Page | Close Window

CXTPImageManagerIconHandle::CopyHandle

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=13552
Printed Date: 28 February 2025 at 8:07am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPImageManagerIconHandle::CopyHandle
Posted By: rdhd
Subject: CXTPImageManagerIconHandle::CopyHandle
Date 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.



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


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



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