svg

package
v0.0.0-...-5d2067b Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Circle

type Circle struct {
	Center geom.Point
	Radius float64
}

type ColorAttributes

type ColorAttributes struct {
	FillColor     *color.RGBA
	FillOpacity   *float64
	StrokeColor   *color.RGBA
	StrokeOpacity *float64
	StrokeWidth   *float64
}

type Ellipse

type Ellipse struct {
	Center geom.Point
	Radius geom.Point
}

type Image

type Image struct {
	ViewBox       geom.Rectangle
	Width, Height float64
	Shapes        []Shape
}

type Path

type Path struct {
	Commands []PathCommand
}

type PathCommand

type PathCommand struct {
	MoveTo                  *PathCommandMoveTo                  `json:",omitempty"` // Mm
	LineTo                  *PathCommandLineTo                  `json:",omitempty"` // Ll
	H                       *PathCommandH                       `json:",omitempty"` // Hh
	V                       *PathCommandV                       `json:",omitempty"` // Vv
	Z                       *PathCommandZ                       `json:",omitempty"` // Zz
	CubicBezier             *PathCommandCubicBezier             `json:",omitempty"` // Cc
	CubicBezierShortcut     *PathCommandCubicBezierShortcut     `json:",omitempty"` // Ss
	QuadraticBezier         *PathCommandQuadraticBezier         `json:",omitempty"` // Qq
	QuadraticBezierShortcut *PathCommandQuadraticBezierShortcut `json:",omitempty"` // Tt
	Arc                     *PathCommandArc                     `json:",omitempty"` // Aa
}

PathCommand is an SVG path command

func (*PathCommand) Kind

func (c *PathCommand) Kind() PathCommandKind

Kind returns the command's kind

type PathCommandArc

type PathCommandArc struct {
	Upper                                                bool
	Rx, Ry, XAxisRotation, LargeArcFlag, SweepFlag, X, Y float64
}

PathCommandArc is the A/a SVG path command

type PathCommandCubicBezier

type PathCommandCubicBezier struct {
	Upper                bool
	X1, Y1, X2, Y2, X, Y float64
}

PathCommandCubicBezier is the C/c SVG path command

type PathCommandCubicBezierShortcut

type PathCommandCubicBezierShortcut struct {
	Upper        bool
	X2, Y2, X, Y float64
}

PathCommandCubicBezierShortcut is the S/s SVG path command

type PathCommandH

type PathCommandH struct {
	Upper bool
	X     float64
}

PathCommandH is the H/h SVG path command

type PathCommandKind

type PathCommandKind commandKind

PathCommandKind is a SVG path command kind

const (
	PathCommandKindMoveTo                  PathCommandKind = "M"
	PathCommandKindLineTo                  PathCommandKind = "L"
	PathCommandKindH                       PathCommandKind = "H"
	PathCommandKindV                       PathCommandKind = "V"
	PathCommandKindZ                       PathCommandKind = "Z"
	PathCommandKindCubicBezier             PathCommandKind = "C"
	PathCommandKindCubicBezierShortcut     PathCommandKind = "S"
	PathCommandKindQuadraticBezier         PathCommandKind = "Q"
	PathCommandKindQuadraticBezierShortcut PathCommandKind = "T"
	PathCommandKindArc                     PathCommandKind = "A"
)

All supported command kinds

type PathCommandLineTo

type PathCommandLineTo struct {
	Upper bool
	X, Y  float64
}

PathCommandLineTo is the L/l SVG path command

type PathCommandMoveTo

type PathCommandMoveTo struct {
	Upper bool
	X, Y  float64
}

PathCommandMoveTo is the M/m SVG path command

type PathCommandQuadraticBezier

type PathCommandQuadraticBezier struct {
	Upper        bool
	X1, Y1, X, Y float64
}

PathCommandQuadraticBezier is the Q/q SVG path command

type PathCommandQuadraticBezierShortcut

type PathCommandQuadraticBezierShortcut struct {
	Upper bool
	X, Y  float64
}

PathCommandQuadraticBezierShortcut is the T/t SVG path command

type PathCommandV

type PathCommandV struct {
	Upper bool
	Y     float64
}

PathCommandV is the V/v SVG path command

type PathCommandZ

type PathCommandZ struct {
	Upper bool
}

PathCommandZ is the Z/z SVG path command

type PathState

type PathState struct {
	CurrentPosition geom.Point
	Positions       []geom.Point
	LastCommand     PathCommand
}

PathState is a path interpreter state

func (*PathState) Command

func (state *PathState) Command(c PathCommand) (upper PathCommand, pos geom.Point)

Command updates the state by executing the given command

type Shape

type Shape struct {
	Path      *Path
	Circle    *Circle
	Ellipse   *Ellipse
	Composite []Shape
	ColorAttributes
}

Jump to

Keyboard shortcuts

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