stroke

package
v0.0.0-...-a9b3df6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT, Unlicense Imports: 5 Imported by: 0

Documentation

Overview

Package stroke implements conversion of strokes to filled outlines. It is used as a fallback for stroke configurations not natively supported by the renderer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArcTransform

func ArcTransform(p, f1, f2 f32.Point, angle float32) (transform f32.Affine2D, segments int)

ArcTransform computes a transformation that can be used for generating quadratic bézier curve approximations for an arc.

The math is extracted from the following paper:

"Drawing an elliptical arc using polylines, quadratic or
 cubic Bezier curves", L. Maisonobe

An electronic version may be found at:

http://spaceroots.org/documents/ellipse/elliptical-arc.pdf

Types

type QuadSegment

type QuadSegment struct {
	From, Ctrl, To f32.Point
}

func SplitCubic

func SplitCubic(from, ctrl0, ctrl1, to f32.Point, quads []QuadSegment) []QuadSegment

func (QuadSegment) Transform

func (q QuadSegment) Transform(t f32.Affine2D) QuadSegment

type StrokeQuad

type StrokeQuad struct {
	Contour uint32
	Quad    QuadSegment
}

type StrokeQuads

type StrokeQuads []StrokeQuad

func StrokePathCommands

func StrokePathCommands(style StrokeStyle, scene []byte) StrokeQuads

type StrokeStyle

type StrokeStyle struct {
	Width float32
}

The following are copies of types from op/clip to avoid a circular import of that package. TODO: when the old renderer is gone, this package can be merged with op/clip, eliminating the duplicate types.

Jump to

Keyboard shortcuts

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