From Gnash Project Wiki

Jump to: navigation, search

Flash does some sort of "pixel hinting" which aligns anchor and control points to full pixels. This avoids blurry hairlines due to anti-aliasing.


When pixel hinting is used

It is not exactly clear when pixel hinting is activated in Flash. Some things we observed:

  • Only "hairline" outlines use pixel hinting by default
  • Thick outlines are never drawn thinner than 1 pixel. In that case pixel hinting is activated too (you can say they become hairlines)
  • Pixel hinting is activated only when drawing straight perfect horizontal or vertical lines. For horizontal lines, only the Y coordinate is aligned, for vertical lines the X coordinate. It seems no pixel hinting is done for diagonal lines.
  • There's a "pixelHinting" flag introduced in Flash 8's lineStyle() method. Probably mainly because the pixel hinting leads to bad joins between curves and straight lines (rounded rect for example).

Selective pixel hinting?

The pixel hinting is built into Flash as a feature, but for a Gnash SWF developer (embedded system...) it may be a problem because it leads to undesired results with some graphics. Maybe Gnash should have a special option that disables pixel hinting.

Current Gnash implementation

It may be nice to have the Gnash core tell the renderer when to use pixel hinting, but this is difficult since only the renderer can tell when a outline would be drawn smaller than one pixel.

AGG renderer

At the time of this writing AGG has a special build_agg_paths_rounded() function that builds AGG paths with full pixel coordinates. However, it does this in any case (even with diagonal lines and even with thick lines).

other renderers

AFAIK other renderers do not implement any sort of pixel hinting.