I want to manually antialias the output of GDI drawing functions on Windows. Each drawing function is rendered onto its own image and then blitted back (so alpha blending can work, as GDI doesn’t do that natively), so the image has only two colors: transparent and the drawing color.
My question is simple: is there a way to antialias an existing line, circle, text, etc. drawn after the fact by hand (in a loop)?
I found this but I have no idea how it works, or if it even does work.
I’d rather not reimplement the drawing primitives myself; if I did that then I wouldn’t need to be using GDI. I already have an alpha premultiplication loop; can I do the antialiasing there?
Update 23 September 2014/Alternate Question – there’s this CodeProject article which suggests using HALFTONE
blit stretching, however the GDI AlphaBlend()
API does not support it, and I’m not sure if the output of using a third image for doing the halftone resize will be properly alpha-premultiplied if the input color is; is it?
7
Technically no, you can’t antialias an existing line because you don’t truly know where the bounds of the line are–or mathematically where the line exists in relation to the surrounding pixels. Add that to the fact that the line actually obscures underlying pixels–which can’t be blended into line.
You could smooth the image; but I don’t believe that’s even close to anti-aliasing.