Documentation ¶
Index ¶
- Constants
- func MakeStartElement(name string, am AttrMap) xml.StartElement
- func Marshal(r *Root, pretty bool) ([]byte, error)
- func RegisterNodeCreator(n string, c nodeCreator)
- func SavePathString(sps []SubPath) string
- type AttrMap
- type Circle
- func (n *Circle) AddChild(c Node)
- func (n *Circle) Attrs() AttrMap
- func (n *Circle) Children() *[]Node
- func (n *Circle) GetText() string
- func (n *Circle) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (n *Circle) Name() string
- func (n *Circle) SetText(t string)
- func (n *Circle) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Node
- type Path
- func (n *Path) AddChild(c Node)
- func (n *Path) Attrs() AttrMap
- func (n *Path) Children() *[]Node
- func (n *Path) GetText() string
- func (n *Path) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (n *Path) Name() string
- func (n *Path) SetText(t string)
- func (n *Path) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type PathCommand
- type Polyshape
- func (n *Polyshape) AddChild(c Node)
- func (n *Polyshape) Attrs() AttrMap
- func (n *Polyshape) Children() *[]Node
- func (n *Polyshape) GetText() string
- func (n *Polyshape) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (n *Polyshape) Name() string
- func (n *Polyshape) SetText(t string)
- func (n *Polyshape) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Rect
- func (n *Rect) AddChild(c Node)
- func (n *Rect) Attrs() AttrMap
- func (n *Rect) Children() *[]Node
- func (n *Rect) GetText() string
- func (n *Rect) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (n *Rect) Name() string
- func (n *Rect) SetText(t string)
- func (n *Rect) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Root
- func (n *Root) AddChild(c Node)
- func (n *Root) Attrs() AttrMap
- func (n *Root) Children() *[]Node
- func (n *Root) GetText() string
- func (n *Root) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (n *Root) Name() string
- func (n *Root) SetText(t string)
- func (n *Root) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type SubPath
- type Unknown
- func (n *Unknown) AddChild(c Node)
- func (n *Unknown) Attrs() AttrMap
- func (n *Unknown) Children() *[]Node
- func (n *Unknown) GetText() string
- func (n *Unknown) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (n *Unknown) Name() string
- func (n *Unknown) SetText(t string)
- func (n *Unknown) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
Constants ¶
const (
SvgNs = "http://www.w3.org/2000/svg"
)
Variables ¶
This section is empty.
Functions ¶
func MakeStartElement ¶
func MakeStartElement(name string, am AttrMap) xml.StartElement
func RegisterNodeCreator ¶
func RegisterNodeCreator(n string, c nodeCreator)
func SavePathString ¶
Types ¶
type AttrMap ¶
func (AttrMap) ExtractValue ¶
ExtractValue will pull a value out of the AttrMap. It will convert it to a float and delete it from the map. If it is not in the map 0.0 will be returned. An error will be returned if this is not a parsable value.
func (AttrMap) ExtractValueNoDefault ¶
ExtractValue will pull a value out of the AttrMap. It will convert it to a float and delete it from the map. If it is not in the map an error will be returned. An error will be returned if this is not a parsable value.
type Circle ¶
Circle is an SVG element that has no specialized code or representation.
func (*Circle) MarshalXML ¶
func (n *Circle) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*Circle) UnmarshalXML ¶
func (n *Circle) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Node ¶
type Node interface { xml.Unmarshaler xml.Marshaler Name() string Attrs() AttrMap Children() *[]Node AddChild(n Node) GetText() string SetText(t string) }
func CreateNodeFromName ¶
func CreatePolygon ¶
func CreatePolygon() Node
func CreatePolyline ¶
func CreatePolyline() Node
type Path ¶
type Path struct { SubPaths []SubPath // contains filtered or unexported fields }
func (*Path) MarshalXML ¶
func (n *Path) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*Path) UnmarshalXML ¶
func (n *Path) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type PathCommand ¶
type Polyshape ¶
type Polyshape struct { // TODO: Handle Points Points []geom.Coord // contains filtered or unexported fields }
Polyshape is an SVG element is a shape specified with a list of straight lines.
func (*Polyshape) MarshalXML ¶
func (n *Polyshape) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*Polyshape) UnmarshalXML ¶
func (n *Polyshape) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Rect ¶
Circle is an SVG element that has no specialized code or representation.
func NewRectXYWH ¶
func (*Rect) MarshalXML ¶
func (n *Rect) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*Rect) UnmarshalXML ¶
func (n *Rect) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Root ¶
type Root struct {
// contains filtered or unexported fields
}
Root represents the root <svg> element.
func CreateRoot ¶
func CreateRoot() *Root
func (*Root) MarshalXML ¶
func (n *Root) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*Root) UnmarshalXML ¶
func (n *Root) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type SubPath ¶
type SubPath struct { Commands []PathCommand // contains filtered or unexported fields }
func ParsePathString ¶
ParsePathString parses an SVG path string. Each command represents a single instance of the command. This is to enable easier further processing.
type Unknown ¶
type Unknown struct {
// contains filtered or unexported fields
}
Unknown is an SVG element that has no specialized code or representation.
func (*Unknown) MarshalXML ¶
func (n *Unknown) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*Unknown) UnmarshalXML ¶
func (n *Unknown) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error