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 ¶
- type Rasterizer
- func (z *Rasterizer) ClosePath()
- func (z *Rasterizer) CubeTo(bx, by, cx, cy, dx, dy float32)
- func (z *Rasterizer) LineTo(bx, by float32)
- func (z *Rasterizer) Mask(dst []byte, stride int)
- func (z *Rasterizer) MaskEvenOdd(dst []byte, stride int)
- func (z *Rasterizer) MoveTo(x, y float32)
- func (z *Rasterizer) QuadTo(bx, by, cx, cy float32)
- func (z *Rasterizer) Reset(w, h int)
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.