<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Markup rendering with alpha channel</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : Markup rendering with alpha channel]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sun, 19 Apr 2026 12:38:16 +0000</pubDate>
  <lastBuildDate>Tue, 17 Jan 2017 09:13:24 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=23247</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Markup rendering with alpha channel : Hi,I&amp;#039;m trying to rendering...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=23247&amp;PID=75499&amp;title=markup-rendering-with-alpha-channel#75499</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=9119">Marc.Gregoire</a><br /><strong>Subject:</strong> 23247<br /><strong>Posted:</strong> 17 January 2017 at 9:13am<br /><br /><div>Hi,</div><div><br></div><div>I'm trying to rendering some markup text to a bitmap but I would like to have a correct alpha channel in that bitmap.</div><div>For example, take the following code:</div><div><table width="99%"><tr><td><pre class="BBcode">CXTPMarkupContext* ctx = XTPMarkupCreateContext();<br>CXTPMarkupUIElement* pUIElement = XTPMarkupParseText(ctx, <br>&nbsp;_T("&lt;Page VerticalAlignment='Top' HorizontalAlignment='Left'&gt;")<br>&nbsp;_T("&lt;Border BorderThickness='5' BorderBrush='#500000FF' Background='white' CornerRadius='16' Padding='8'&gt;")<br>&nbsp;_T("&lt;TextBlock&gt;Test&lt;/TextBlock&gt;")<br>&nbsp;_T("&lt;/Border&gt;")<br>&nbsp;_T("&lt;/Page&gt;"));<br>&nbsp;<br>CSize desiredSize = XTPMarkupMeasureElement(pUIElement);<br>CRect rc (CPoint(0, 0), desiredSize);<br>pUIElement-&gt;Arrange(rc);</div><div>CDC memoryDC;<br>memoryDC.CreateCompatibleDC(nullptr);<br>memoryDC.SetBkMode(TRANSPARENT);</div><div>BITMAPINFO pbiDIB;<br>pbiDIB.bmiHeader.biBitCount = 32;<br>pbiDIB.bmiHeader.biClrImportant = 0;<br>pbiDIB.bmiHeader.biClrUsed = 0;<br>pbiDIB.bmiHeader.biCompression = BI_RGB;<br>pbiDIB.bmiHeader.biPlanes = 1;<br>pbiDIB.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);<br>pbiDIB.bmiHeader.biSizeImage = 0;<br>pbiDIB.bmiHeader.biXPelsPerMeter = 0;<br>pbiDIB.bmiHeader.biYPelsPerMeter = 0;<br>pbiDIB.bmiHeader.biHeight = rc.Height();<br>pbiDIB.bmiHeader.biWidth = rc.Width();</div><div>BYTE* pDIBitmap = nullptr;<br>HBITMAP bmpRender = ::CreateDIBSection(memoryDC, &amp;pbiDIB, DIB_RGB_COLORS, (void **)&amp;pDIBitmap, 0, 0);<br>HBITMAP oldBmp = (HBITMAP)SelectObject(memoryDC, bmpRender);</div><div>XTPMarkupRenderElement(pUIElement, memoryDC.GetSafeHdc(), rc);<br>XTPMarkupReleaseElement(pUIElement);<br>XTPMarkupReleaseContext(ctx);<br>ctx = nullptr;</div><div>SelectObject(memoryDC, oldBmp);</pre></td></tr></table></div><div><br></div><div>The R, G, and B channels are perfect.</div><div>But, the resulting alpha channel looks as follows:</div><div><br></div><div><img src="uploads/9119/Markup_Wr&#111;ng_Transparency.PNG" height="146" width="170" border="0" /></div><div><br></div><div>The border is nicely anti-aliased, but the alpha values for the text are quite wrong.</div><div>These are completely black meaning the text would be completely transparent.</div><div><br></div><div>What am I doing wrong here?</div><div><br></div>]]>
   </description>
   <pubDate>Tue, 17 Jan 2017 09:13:24 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=23247&amp;PID=75499&amp;title=markup-rendering-with-alpha-channel#75499</guid>
  </item> 
 </channel>
</rss>