EG UK Theory and Practice of Computer Graphics (2007)
Ik Soo Lim, David Duce (Editors)
Scanline edge-flag algorithm for antialiasing
Kiia Kallio
Media Lab, University of Art and Design Helsinki UIAH
Abstract
In this paper, a novel algorithm for rendering antialiased 2D polygons is presented. Although such algorithms
do exist, they are inefficient when comparing to non-antialiased alternatives. This has lead to a situation where
the developers — and the end users of the applications — need to make a choice between high speed and high
quality. The algorithm presented here however equals the performance of an industry standard non-antialiased
polygon filling algorithm, while providing good antialiasing quality. Furthermore, the algorithm addresses the
requirements of a modern 2D rendering API by supporting features such as various fill rules. Most of the research
in antialiased 2D rendering has been proprietary work, and there is very little documentation about the algorithms
in the literature. This paper brings an update to the situation by providing a thorough explanation of one such
algorithm.
Categories and Subject Descriptors (according to ACM CCS): I.3.3 [Computer Graphics]: Picture/Image Generation;
1. Introduction
In the rendering of 2D vector shapes today — such as in
SVG [FFJ03] — the filling algorithm should be general (i.e.
support concave, self-intersecting polygons with holes), ef-
ficient, mathematically correct with subpixel accuracy, sup-
port even-odd and non-zero winding fill rules and high qual-
ity antialiasing, allow implementation also on mobile de-
vices with limited processing power [Cap03 ] and be suitable
for hardware implementation as well [Ric05].
The list of requirements is extensive, and the literature
lacks descriptions of such algorithms. Even if the importance
of antialiasing has been recognized years ago, lack of algo-
rithms that are efficient and simple to implement has lead to
the situation where antialiasing is considered as a costly ex-
tra feature. Even those applications that implement antialias-
ing need to sacrifice the quality for the sake of efficiency. In
this situation, antialiasing is not considered possible in low-
end graphics libraries, neither do developers — also on high-
end platforms — consider it feasible to implement on their
own.
2. Related work
The basis of the algorithm presented here is in the edge-flag
algorithm presented by Ackland et al. [AW81] in 1981. The
precise calculations required for subpixel accurate DDA im-
plementation are described by Hersch [Her88]. In addition
to the edge flag algorithm, there are other relevant polygon
filling algorithms described in the literature. Most notable is
the classic scan-line edge list algorithm [FvDFH90], a text
book example of polygon filling.
None of these algorithms directly handle various fill rules
required for rendering self-intersecting polygons. Neither
are they suitable for antialiased rendering, except when us-
ing regular supersampling, i.e. the image is rendered to a
bitmap with higher resolution and then scaled down with ap-
propriate filtering.
Antialiasing has been researched a lot in 3D graphics.
Typical solution for antialiasing in polygon-based 3D ren-
dering is full screen antialiasing, where basically the whole
frame buffer is rendered in higher resolution and then sam-
pled down. In practice this is more complex, for instance
multisampling is a method where the texturing and shading
is done only once per pixel while z-buffer operations are
done for each sample. With a suitable sampling pattern, a
relatively low amount of samples can provide adequate level
of antialiasing without sacrificing performance too much.
With the typical use cases of 2D vector graphics, for in-
stance text ren dering or user interfaces, the requirements for
antialiasing are high. With 3D graphics, a lot of the detail in
c
The Eurographics Association 2007.