stroke

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: MIT, Unlicense Imports: 6 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, segments int) f32.Affine2D

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

func IsSolidLine

func IsSolidLine(sty DashOp) bool

Types

type DashOp

type DashOp struct {
	Phase  float32
	Dashes []float32
}

type QuadSegment

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

func SplitCubic

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

func (QuadSegment) Transform

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

type StrokeCap

type StrokeCap uint8
const (
	RoundCap StrokeCap = iota
	FlatCap
	SquareCap
)

type StrokeJoin

type StrokeJoin uint8
const (
	RoundJoin StrokeJoin = iota
	BevelJoin
)

type StrokeQuad

type StrokeQuad struct {
	Contour uint32
	Quad    QuadSegment
}

type StrokeQuads

type StrokeQuads []StrokeQuad

func StrokePathCommands

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

type StrokeStyle

type StrokeStyle struct {
	Width float32
	Miter float32
	Cap   StrokeCap
	Join  StrokeJoin
}

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