AntiAliased text on X [was code bloat]
Kendall Bennett
KendallB at scitechsoft.com
Tue Nov 2 13:38:19 PST 2004
Keith Packard <keithp at keithp.com> wrote:
> Around 8 o'clock on Nov 2, "Kendall Bennett" wrote:
>
> > So the only slow down is the blending of the small number of pixels around
> > the edges.
>
> That's true of software rendering as well -- it doesn't read the
> destination pixels when the source is opaque, and doesn't read or
> write for transparent pixels.
One thing I forgot to mention and perhaps was not entirely clear in my
original post. When you use the multi-layer glyph approach if the
background is known to be solid, you don't have to do any blending at
all. Before you start drawing the glyphs you pre-compute the blended
colors for the different glyph layers based on the foreground color and
the solid background color. Then you can draw all the glyh layers
entirely in hardware using the existing mono text functions, which is
going to be way faster than any software blending code, even if you do
the background color blending without reading the framebuffer.
You can also fine tune the quality as well. For crappy quality but better
performance, only use say 4 layers (3 glyphs). For better performance you
could use even more layers, although in my experience going past 6 layers
(5 glyphs) is pointless as most anti-aliased text does not have that many
blended pixels around the edges. For our SciTech MGL library we use 100%,
75%, 50% and 25% glyph layers (4 layers total per glyph or 5 shades)
which gives excellent results.
Also the other nice thing about multi-level glyph rendering is you can do
AA text even in 8bpp modes if you assume a solid background. Probably not
all that exciting these days, but is possible ;-)
Regards,
---
Kendall Bennett
Chief Executive Officer
SciTech Software, Inc.
Phone: (530) 894 8400
http://www.scitechsoft.com
~ SciTech SNAP - The future of device driver technology! ~
More information about the xorg
mailing list