Command is a representation of an SVG path command and its parameters.
type Command struct {
Symbol string
Params []float64
}
GraphicSVG element represents SVG instances.
type GraphicSVG struct {
// ViewBox represents viewBox value of element.
ViewBox struct{ X, Y, W, H float64 }
// Name of element.
Name string
// Attributes of element.
Attributes map[string]string
// Children elements.
Children []*GraphicSVG
// Content contains text value of element.
Content string
// Style element style attribute.
Style *GraphicSVGStyle
// Width of element.
Width float64
// Height of element.
Height float64
// contains filtered or unexported fields
}
func ParseFromFile(path string) (*GraphicSVG, error)
ParseFromFile creates a GraphicSVG instance from file.
func ParseFromStream(source io.Reader) (*GraphicSVG, error)
ParseFromStream creates a GraphicSVG instance from SVG stream input.
func ParseFromString(svgStr string) (*GraphicSVG, error)
ParseFromString creates a GraphicSVG instance from string SVG.
func (g *GraphicSVG) Decode(decoder *xml.Decoder) error
Decode decodes the child elements of element.
func (g *GraphicSVG) SetScaling(xFactor, yFactor float64)
SetScaling sets scaling value for graphic SVG and maintain the aspect ratio.
func (g *GraphicSVG) ToContentCreator(cc *contentstream.ContentCreator) *contentstream.ContentCreator
ToContentCreator convert SVG and add elements contentstream then returns `contentstream.ContentCreator`.
GraphicSVGStyle represents style attributes for `GraphicSVG`.
type GraphicSVGStyle struct {
FillColor string
StrokeColor string
StrokeWidth float64
}
Path is a collection of all the subpaths in 'd' attribute.
type Path struct {
Subpaths []*Subpath
}
Subpath is a collection of Commands, beginning with moveto command and usually ending with closepath command.
type Subpath struct {
Commands []*Command
}