title: Is it possible to render antialiased text onto a transparent background with pure GDI?
body: <p>I've been asking a lot of questions about text aliasing and line aliasing and transparency lately because I wanted to write a platform agnostic vector graphics system for Go; the Windows code is written in C. Premultiplication shenanigans have led me to change the focus over to just rendering text (so I can access system fonts).</p>
  
  <p>Right now I have something that draws text to an offscreen bitmap. This works, except for the antialiased bits. In my code, as I fill the memory buffer with 0xFF to flip the alpha byte (which GDI sets to 0x00 for a pixel that is drawn), the antialiasing is to white. <a href="https://stackoverflow.com/questions/1291061/antialiased-text-on-transparent-bitmap">Other people have seen antialiasing to black.</a> This happens with both <code>ANTIALIASED_QUALITY</code> and <code>CLEARTYPE_QUALITY</code>.</p>
  
  <p>I am drawing with <code>TextOut()</code> into a DIB in this case. The DIB is backed by a copy of the screen DC (<code>GetDC(NULL)</code>).</p>
  
  <p>Is there anything I can do to just get text transparent? Can I somehow detect the white pixels, unblend them, and convert that to an alpha? How would I do that for colors too similar to white?</p>