Vixen
02b45cc4
csharp
public static class PathTessellator

Turns flattened contours into triangles.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Emits loose triangles — every three vertices is one — rather than vertices and indices. That is not a shortcut: the fill decomposition below produces trapezoids that share no vertex with their neighbours, so an index buffer over it would be the identity permutation and cost a second array to say so. The caller turns the vertices into whatever its shader reads, which is also where the colour comes from.

⚠ The edge is antialiased by a fringe, not by the shader. A rounded box gets a perfect edge because the shader evaluates a distance field, and a glyph gets one for the same reason; a triangle has no such function, so the outline is drawn twice — once as the interior, and once as a half-pixel strip whose coverage runs from one on the inside to zero on the outside. Multisampling the pass is the other answer and remains the compositor's to choose; this one costs a strip of geometry and works under any pass.

Fields and properties (1)

  • public const float DefaultMiterLimit

    The default miter limit, which is CSS's and SVG's.

Methods (3)

  • public static void Fill(IReadOnlyList<Vector2> points, IReadOnlyList<Contour> contours, PathFillRule rule, List<PathVertex> triangles)

    Fills contours, honouring the fill rule.

  • public static void FillFringe(IReadOnlyList<Vector2> points, IReadOnlyList<Contour> contours, PathFillRule rule, float width, List<PathVertex> triangles)

    Feathers a fill's outline, so its edge is not whatever the rasteriser gives it.

  • public static void Stroke(IReadOnlyList<Vector2> points, IReadOnlyList<Contour> contours, float width, LineJoin join, LineCap cap, float tolerance, List<PathVertex> triangles, float miterLimit = 4, float fringe = 0)

    Strokes contours.

Used by (2)

  • PathTessellatorTestsVixen.Ui.Tests
  • UiGeometryBuilderVixen.Ui