package svg
import "github.com/jphsd/xml/svg"
Index ¶
- func ParseColor(str string) stdcol.Color
- func ParseStyle(str string, attrs map[string]string)
- func ParseTransform(str string) *g2d.Aff3
- func ParseUrlId(str string) string
- func ParseValue(str string) float64
- func ParseValueUnit(str string) (float64, string)
- func ParseViewBox(str string) [][]float64
- func PathsFromDescription(desc string) []*g2d.Path
- type SVG
- func Draw(dst draw.Image, dom *xml.Element) *SVG
- func Image(dom *xml.Element) (*stdimg.RGBA, *SVG)
- func NewSVG() *SVG
- func (svg *SVG) CircleElt(elt *xml.Element)
- func (svg *SVG) ClipPathElt(elt *xml.Element)
- func (svg *SVG) Copy() *SVG
- func (svg *SVG) DefsElt(elt *xml.Element)
- func (svg *SVG) EllipseElt(elt *xml.Element)
- func (svg *SVG) FillStroke(elt *xml.Element, bb [][]float64) (*g2d.Pen, *g2d.Pen)
- func (svg *SVG) GroupElt(elt *xml.Element)
- func (svg *SVG) LineElt(elt *xml.Element)
- func (svg *SVG) PathElt(elt *xml.Element)
- func (svg *SVG) PolygonElt(elt *xml.Element)
- func (svg *SVG) PolylineElt(elt *xml.Element)
- func (svg *SVG) Process(elt *xml.Element)
- func (svg *SVG) RectElt(elt *xml.Element)
- func (svg *SVG) SVGElt(elt *xml.Element)
- func (svg *SVG) Transform(elt *xml.Element) *g2d.Aff3
- func (svg *SVG) UseElt(elt *xml.Element)
Functions ¶
func ParseColor ¶
func ParseStyle ¶
func ParseTransform ¶
func ParseUrlId ¶
func ParseValue ¶
func ParseValueUnit ¶
func ParseViewBox ¶
func PathsFromDescription ¶
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 ¶
Draw is a convenience function to render the svg dom into an image. The svg is scaled to the image size.
func Image ¶
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) ClipPathElt ¶
func (*SVG) Copy ¶
func (*SVG) DefsElt ¶
func (*SVG) EllipseElt ¶
func (*SVG) FillStroke ¶
func (*SVG) GroupElt ¶
func (*SVG) LineElt ¶
func (*SVG) PathElt ¶
func (*SVG) PolygonElt ¶
func (*SVG) PolylineElt ¶
func (*SVG) Process ¶
func (*SVG) RectElt ¶
func (*SVG) SVGElt ¶
func (*SVG) Transform ¶
func (*SVG) UseElt ¶
Source Files ¶
- Version
- v0.0.0-20240110053338-c96282f4e145 (latest)
- Published
- Jan 10, 2024
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 1 hour ago –
Tools for package owners.