vec

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package vec rasterizes vector paths (lines, quadratic and cubic Bézier curves) into anti-aliased coverage masks, with the signed area accumulation of font-rs: every edge adds the area it covers to the cells it crosses, and a running sum along each row gives the coverage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rasterizer

type Rasterizer struct {
	// contains filtered or unexported fields
}

Rasterizer accumulates the area of a path's edges. Reuse it with Reset.

func (*Rasterizer) ClosePath

func (z *Rasterizer) ClosePath()

ClosePath draws a line back to the start of the contour.

func (*Rasterizer) CubeTo

func (z *Rasterizer) CubeTo(bx, by, cx, cy, dx, dy float32)

CubeTo draws a cubic Bézier curve with control points (bx, by) and (cx, cy).

func (*Rasterizer) LineTo

func (z *Rasterizer) LineTo(bx, by float32)

LineTo draws a line from the pen.

func (*Rasterizer) Mask

func (z *Rasterizer) Mask(dst []byte, stride int)

Mask writes the coverage of the accumulated path (non-zero winding) as one byte per pixel into dst, rows of stride bytes.

func (*Rasterizer) MaskEvenOdd

func (z *Rasterizer) MaskEvenOdd(dst []byte, stride int)

MaskEvenOdd is Mask with the even-odd rule: what the path's contours cover an odd number of times is inside it.

func (*Rasterizer) MoveTo

func (z *Rasterizer) MoveTo(x, y float32)

MoveTo starts a contour, closing the previous one.

func (*Rasterizer) QuadTo

func (z *Rasterizer) QuadTo(bx, by, cx, cy float32)

QuadTo draws a quadratic Bézier curve with control point (bx, by).

func (*Rasterizer) Reset

func (z *Rasterizer) Reset(w, h int)

Reset prepares the rasterizer for a w×h mask.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL