svg

package
v0.0.0-...-c96282f Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseColor

func ParseColor(str string) stdcol.Color

func ParseStyle

func ParseStyle(str string, attrs map[string]string)

func ParseTransform

func ParseTransform(str string) *g2d.Aff3

func ParseUrlId

func ParseUrlId(str string) string

func ParseValue

func ParseValue(str string) float64

func ParseValueUnit

func ParseValueUnit(str string) (float64, string)

func ParseViewBox

func ParseViewBox(str string) [][]float64

func PathsFromDescription

func PathsFromDescription(desc string) []*g2d.Path

Types

type SVG

type SVG struct {
	Xfm  *g2d.Aff3               // Path transform
	Clip map[string]*g2d.Shape   // Clip path ids to clip shapes
	Defs map[string]*xml.Element // Element ids to elements
	Rend *g2d.Renderable         // Renderable paths and fillers
}

SVG contains the current context - the image being drawn into, the style and view transforms, and the defined clip paths and shapes.

func Draw

func Draw(dst draw.Image, dom *xml.Element) *SVG

Draw is a convenience function to render the svg dom into an image. The svg is scaled to the image size.

func Image

func Image(dom *xml.Element) (*stdimg.RGBA, *SVG)

Image renders the svg dom into an empty image with the same bounds as the dom.

func NewSVG

func NewSVG() *SVG

func (*SVG) CircleElt

func (svg *SVG) CircleElt(elt *xml.Element)

func (*SVG) ClipPathElt

func (svg *SVG) ClipPathElt(elt *xml.Element)

func (*SVG) Copy

func (svg *SVG) Copy() *SVG

func (*SVG) DefsElt

func (svg *SVG) DefsElt(elt *xml.Element)

func (*SVG) EllipseElt

func (svg *SVG) EllipseElt(elt *xml.Element)

func (*SVG) FillStroke

func (svg *SVG) FillStroke(elt *xml.Element, bb [][]float64) (*g2d.Pen, *g2d.Pen)

func (*SVG) GroupElt

func (svg *SVG) GroupElt(elt *xml.Element)

func (*SVG) LineElt

func (svg *SVG) LineElt(elt *xml.Element)

func (*SVG) PathElt

func (svg *SVG) PathElt(elt *xml.Element)

func (*SVG) PolygonElt

func (svg *SVG) PolygonElt(elt *xml.Element)

func (*SVG) PolylineElt

func (svg *SVG) PolylineElt(elt *xml.Element)

func (*SVG) Process

func (svg *SVG) Process(elt *xml.Element)

func (*SVG) RectElt

func (svg *SVG) RectElt(elt *xml.Element)

func (*SVG) SVGElt

func (svg *SVG) SVGElt(elt *xml.Element)

func (*SVG) Transform

func (svg *SVG) Transform(elt *xml.Element) *g2d.Aff3

func (*SVG) UseElt

func (svg *SVG) UseElt(elt *xml.Element)

Jump to

Keyboard shortcuts

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