svg

package
v0.0.0-...-59cea10 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2022 License: MIT Imports: 7 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 {
	CenterX float64 `xml:"cx,attr"`
	CenterY float64 `xml:"cy,attr"`
	Radius  float64 `xml:"r,attr"`
}

func (*Circle) Draw

func (c *Circle) Draw() (sdf.SDF2, error)

type ClosePath

type ClosePath struct{}

func NewClosePath

func NewClosePath() *ClosePath

func (*ClosePath) DrawTo

func (m *ClosePath) DrawTo(b *sdf.Bezier)

type CubicBezier

type CubicBezier struct {
	Start *Point2D
	Mid   *Point2D
	End   *Point2D
}

func NewCubicBezier

func NewCubicBezier(start *Point2D, mid *Point2D, end *Point2D) *CubicBezier

func (*CubicBezier) DrawTo

func (m *CubicBezier) DrawTo(b *sdf.Bezier)

type Drawable

type Drawable interface {
	DrawTo(b *sdf.Bezier)
}

type Graphic

type Graphic struct {
	ID      string    `xml:"id,attr"`
	Paths   []*Path   `xml:"path"`
	Rects   []*Rect   `xml:"rect"`
	Circles []*Circle `xml:"circle"`
}

func (*Graphic) Draw

func (g *Graphic) Draw() (sdf.SDF2, error)

type LineTo

type LineTo struct {
	Point *Point2D
}

func NewLineTo

func NewLineTo(p *Point2D) *LineTo

func (*LineTo) DrawTo

func (l *LineTo) DrawTo(b *sdf.Bezier)

type MoveTo

type MoveTo struct {
	Point *Point2D
}

func NewMoveTo

func NewMoveTo(p *Point2D) *MoveTo

func (*MoveTo) DrawTo

func (m *MoveTo) DrawTo(b *sdf.Bezier)

type Path

type Path struct {
	Draw           string `xml:"d,attr"`
	Stroke         string `xml:"stroke,attr"`
	StrokeLinecap  string `xml:"stroke-linecap,attr"`
	StrokeLineJoin string `xml:"stroke-linejoin,attr"`
}

func (*Path) ToBeziers

func (p *Path) ToBeziers() ([]*sdf.Bezier, error)

type Point2D

type Point2D struct {
	X float64
	Y float64
}

func NewPoint2D

func NewPoint2D(x float64, y float64) *Point2D

type Rect

type Rect struct {
	X      float64 `xml:"x,attr"`
	Y      float64 `xml:"y,attr"`
	Width  float64 `xml:"width,attr"`
	Height float64 `xml:"height,attr"`
}

func (*Rect) Draw

func (r *Rect) Draw() (sdf.SDF2, error)

type SVG

type SVG struct {
	Width    string     `xml:"width,attr"`
	Height   string     `xml:"height,attr"`
	ViewBox  string     `xml:"viewBox,attr"`
	Fill     string     `xml:"fill,attr"`
	XMLNS    string     `xml:"xmlns,attr"`
	Graphics []*Graphic `xml:"g"`
}

func NewSVG

func NewSVG(name string) (*SVG, error)

func (*SVG) Find

func (svg *SVG) Find(id string) *Graphic

Jump to

Keyboard shortcuts

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