Print Page | Close Window

Markup images not rendered correctly in 16.2.3

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: MarkupLabel Control
Forum Description: Topics Related to Codejock MarkupLabel Control
URL: http://forum.codejock.com/forum_posts.asp?TID=21859
Printed Date: 21 November 2024 at 1:26pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Markup images not rendered correctly in 16.2.3
Posted By: flashk
Subject: Markup images not rendered correctly in 16.2.3
Date 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?



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


Posted By: markr
Date Posted: 13 February 2014 at 12:18am
It would be really nice to get this problem fixed in the XTP sources.


Posted By: astoyan
Date Posted: 01 July 2015 at 8:08pm
Thank you, flashk, for the suggestion. The fix has been added.
Regards,
  Alexander


Posted By: markr
Date Posted: 02 July 2015 at 9:38am
> The fix has been added.

Excellent, thanks!



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