Table of Contents
Fetching ...

Polar Stroking: New Theory and Methods for Stroking Paths

Mark J. Kilgard

Abstract

Stroking and filling are the two basic rendering operations on paths in vector graphics. The theory of filling a path is well-understood in terms of contour integrals and winding numbers, but when path rendering standards specify stroking, they resort to the analogy of painting pixels with a brush that traces the outline of the path. This means important standards such as PDF, SVG, and PostScript lack a rigorous way to say what samples are inside or outside a stroked path. Our work fills this gap with a principled theory of stroking. Guided by our theory, we develop a novel polar stroking method to render stroked paths robustly with an intuitive way to bound the tessellation error without needing recursion. Because polar stroking guarantees small uniform steps in tangent angle, it provides an efficient way to accumulate arc length along a path for texturing or dashing. While this paper focuses on developing the theory of our polar stroking method, we have successfully implemented our methods on modern programmable GPUs.

Polar Stroking: New Theory and Methods for Stroking Paths

Abstract

Stroking and filling are the two basic rendering operations on paths in vector graphics. The theory of filling a path is well-understood in terms of contour integrals and winding numbers, but when path rendering standards specify stroking, they resort to the analogy of painting pixels with a brush that traces the outline of the path. This means important standards such as PDF, SVG, and PostScript lack a rigorous way to say what samples are inside or outside a stroked path. Our work fills this gap with a principled theory of stroking. Guided by our theory, we develop a novel polar stroking method to render stroked paths robustly with an intuitive way to bound the tessellation error without needing recursion. Because polar stroking guarantees small uniform steps in tangent angle, it provides an efficient way to accumulate arc length along a path for texturing or dashing. While this paper focuses on developing the theory of our polar stroking method, we have successfully implemented our methods on modern programmable GPUs.

Paper Structure

This paper contains 49 sections, 37 equations, 18 figures, 2 tables.

Figures (18)

  • Figure 1: Geometric interpretation of Equations \ref{['eq:NaiveStroking']} and \ref{['eq:ConventionalStroking']} for stroking path segments shown applied to three example Bézier segments: quadratic ( upper left), serpentine cubic ( upper right), and exact cusp cubic ( bottom). The pink region is the stroked region according to Equation \ref{['eq:NaiveStroking']} that fails to include the cusp's double semicircle. The black curve within each pink stroked region is each segment's generator curve. The pink+blue regions correspond to the stroked region according to Equations \ref{['eq:ConventionalStroking']} and \ref{['eq:polar-stroking']}. Green double arrows show the stroke widening term of Equation \ref{['eq:NaiveStroking']}. The red double arrows show the cusp semicircle term of Equation \ref{['eq:ConventionalStroking']}.
  • Figure 2: Cubic Bézier segment in loop configuration with its hodograph.
  • Figure 3: Cubic Bézier segment in serpentine configuration (1 inflection in $[0,1]$) with its hodograph.
  • Figure 4: Cubic Bézier segment in serpentine configuration (2 inflections in $[0,1]$) with its hodograph.
  • Figure 5: Cubic Bézier segment in cusp configuration with its hodograph.
  • ...and 13 more figures