Reminder to self: you cannot repeatedly draw anti-aliased text without damaging the background
Posted by jpluimers on 2013/04/11
A small duh moment when I found this out myself the hard way: when repeatedly drawing anti-aliased text, it will alter the background on each draw.
So you cannot do that. Not in Delphi, not in .NET, not in Cocoa, nowhere (:
–jeroen
via: delphi – “Additive” text rendering on TCanvas? – Stack Overflow.






Jason McMillen said
Sounds like you need a better graphics library. Or framework… ;)
jpluimers said
Anti-alising per definition modifies the background no matter the graphics library/framework. So if you paint the same thing twice, the background get modified twice. The more you repeat the painting, the more you will see artifacts.
Steffen Binas said
The problem only occurs when you use an inappropriate blend/combine mode. E.g. in the Graphics32 Library you can use the CombineMode = cmMerge which does not change the alphachannel of the background below its original value.
jpluimers said
Now that is a really great tip. Thanks!
Kloops said
If the background doesn’t vary much then one technic is to cache it to a bitmap. Before drawing the elements which varies much (some text, some animated shapes, etc) you draw the cached graphic background. Finally the background is only modified once.
SilverWarior said
Wouldn’t it be better to render the thext into some bitmap without using anti-aliasing and then combine that butmap with the background using anti-aliasing.
I mean just for rendering text you need to call multiple cals (even several hundreds) especially if you are rendering it using BitFonts.
So wouldn’t rendering text into some chached texture save you the need for calling several hundred cals for each redraw.
ObjectMethodology.com said
Good to know.