Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > MarkupLabel Control
  New Posts New Posts RSS Feed - Markup images not rendered correctly in 16.2.3
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Markup images not rendered correctly in 16.2.3

 Post Reply Post Reply
Author
Message
flashk View Drop Down
Groupie
Groupie


Joined: 04 March 2008
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote flashk Quote  Post ReplyReply Direct Link To This Post Topic: Markup images not rendered correctly in 16.2.3
    Posted: 25 August 2013 at 6:16pm
I just upgraded from 15.0.2 to 16.2.3 and noticed that markup controls don't render images with alpha channels correctly. I've attached a screenshot showing the difference between the two versions.



I'm using the following markup to specify the image from its resource ID (based on a 32-bit PNG):
<Image Source='1200' VerticalAlignment='Center' />

Is this a known issue? Do I need to change the markup or other setting to render the image correctly?
Back to Top
flashk View Drop Down
Groupie
Groupie


Joined: 04 March 2008
Status: Offline
Points: 44
Post Options Post Options   Thanks (1) Thanks(1)   Quote flashk Quote  Post ReplyReply Direct Link To This Post Posted: 12 September 2013 at 5:52pm
I believe I've found why the images are not being rendered correctly. The code for rendering markup images was changed from:
HDC hDC = pDC->GetDC();
m_pImage->Draw(CDC::FromHandle(hDC), CPoint(0, 0), szRender);
pDC->ReleaseDC(hDC);
to:
pDC->DrawImage(m_pImage, CRect(0, 0, szRender.cx, szRender.cy));
This change seems to cause the image to be drawn using GDI+ instead of GDI. The CXTPMarkupGdiPlusDeviceContext class seems to draw images with alpha channels incorrectly. In CXTPMarkupGdiPlusDeviceContext::IconToGdiplusBitmap, the PixelFormat32bppARGB flag is used to create the bitmap for rendering. However, I believe the flag should be changed to PixelFormat32bppPARGB, since the CXTPImageManagerIcon object stores pre-multiplied alpha values.

Making this one change seems to fix the image rendering issues for me.
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2014 at 12:18am
It would be really nice to get this problem fixed in the XTP sources.
Back to Top
astoyan View Drop Down
Admin Group
Admin Group
Avatar

Joined: 24 August 2013
Status: Offline
Points: 304
Post Options Post Options   Thanks (0) Thanks(0)   Quote astoyan Quote  Post ReplyReply Direct Link To This Post Posted: 01 July 2015 at 8:08pm
Thank you, flashk, for the suggestion. The fix has been added.
Regards,
  Alexander
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2015 at 9:38am
> The fix has been added.

Excellent, thanks!
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.234 seconds.