gioui.orggioui.org/internal/stroke Index | Files

package stroke

import "gioui.org/internal/stroke"

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

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.

Source Files

stroke.go

Version
v0.4.1
Published
Nov 30, 2023
Platform
windows/amd64
Imports
5 packages
Last checked
1 minute ago

Tools for package owners.