svg

package module
v0.0.0-...-b99aad8 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2017 License: MIT Imports: 6 Imported by: 0

README

svg

Build Status Go Report Card Coverage Status GoDoc

Library for working with SVG.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element struct {
	Name       string
	Attributes map[string]string
	Children   []*Element
	Content    string
}

Element is a representation of an SVG element.

func New

func New(source io.Reader) (*Element, error)

New creates an Element instance from an SVG input.

func (*Element) Equal

func (e *Element) Equal(o *Element) bool

Equal checks if two elements are equivalent.

func (*Element) Render

func (e *Element) Render(w io.Writer) error

Render creates an SVG output from the element. Returns an error if the element is empty.

type Path

type Path struct {
	Commands []*PathCommand
}

Path is a collection of all the subpaths in path data attribute.

func NewPath

func NewPath(raw string) (*Path, error)

NewPath takes value of a path data attribute transforms it into a series of commands containing the appropriate parameters.

func (*Path) Equal

func (p *Path) Equal(o *Path) bool

Equal compares two paths.

func (*Path) Subpaths

func (p *Path) Subpaths() []*Path

Subpaths computes all subpaths from a given path. 'Z' command is excluded from the resulting paths.

type PathCommand

type PathCommand struct {
	Symbol string
	Params []float64
}

PathCommand is a representation of an SVG path command. It contains the operator symbol and the command's parameters.

func (*PathCommand) Equal

func (c *PathCommand) Equal(o *PathCommand) bool

Equal compares two commands.

func (*PathCommand) IsAbsolute

func (c *PathCommand) IsAbsolute() bool

IsAbsolute returns true is the SVG path command is absolute.

Jump to

Keyboard shortcuts

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