vector

package
Version: v2.3.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: Apache-2.0 Imports: 2 Imported by: 8

Documentation

Overview

Package vector provides functions for vector graphics rendering.

This package is under experiments and the API might be changed with breaking backward compatibility.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Direction added in v2.2.0

type Direction int

Direction represents clockwise or counterclockwise.

const (
	Clockwise Direction = iota
	CounterClockwise
)

type Path

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

Path represents a collection of path segments.

func (*Path) AppendVerticesAndIndicesForFilling added in v2.2.0

func (p *Path) AppendVerticesAndIndicesForFilling(vertices []ebiten.Vertex, indices []uint16) ([]ebiten.Vertex, []uint16)

AppendVerticesAndIndicesForFilling appends vertices and indices to fill this path and returns them. AppendVerticesAndIndicesForFilling works in a similar way to the built-in append function. If the arguments are nils, AppendVerticesAndIndices returns new slices.

The returned vertice's SrcX and SrcY are 0, and ColorR, ColorG, ColorB, and ColorA are 1.

The returned values are intended to be passed to DrawTriangles or DrawTrianglesShader with EvenOdd fill mode in order to render a complex polygon like a concave polygon, a polygon with holes, or a self-intersecting polygon.

func (*Path) Arc added in v2.2.0

func (p *Path) Arc(x, y, radius, startAngle, endAngle float32, dir Direction)

Arc adds an arc to the path. (x, y) is the center of the arc.

Arc updates the current position to the end of the arc.

func (*Path) ArcTo added in v2.2.0

func (p *Path) ArcTo(x1, y1, x2, y2, radius float32)

ArcTo adds an arc curve to the path. (x1, y1) is the control point, and (x2, y2) is the destination.

ArcTo updates the current position to (x2, y2).

func (*Path) CubicTo

func (p *Path) CubicTo(x1, y1, x2, y2, x3, y3 float32)

CubicTo adds a cubic Bézier curve to the path. (x1, y1) and (x2, y2) are the control points, and (x3, y3) is the destination.

CubicTo updates the current position to (x3, y3).

func (*Path) LineTo

func (p *Path) LineTo(x, y float32)

LineTo adds a line segument to the path, which starts from the current position and ends to the given position (x, y).

LineTo updates the current position to (x, y).

func (*Path) MoveTo

func (p *Path) MoveTo(x, y float32)

MoveTo skips the current position of the path to the given position (x, y) without adding any strokes.

func (*Path) QuadTo

func (p *Path) QuadTo(x1, y1, x2, y2 float32)

QuadTo adds a quadratic Bézier curve to the path. (x1, y1) is the control point, and (x2, y2) is the destination.

QuadTo updates the current position to (x2, y2).

Source Files

Jump to

Keyboard shortcuts

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