Documentation ¶
Index ¶
- func DrawLine(img *image.RGBA, p1, p2 image.Point, clr color.Color)
- func GetColor(colorStr string) color.Color
- func GetSVGDimensions(filename string) (int, int, error)
- func NewColoredImage(width, height int, clr color.Color) *image.RGBA
- func ParseCoordinates(coords string) (int, int, error)
- func Render(elements []SvgElement, img *image.RGBA)
- func RenderAndSaveSVG(elements []SvgElement, filename string, bgColor color.Color) error
- func SavePNG(img *image.RGBA, filename string) error
- type PathCommand
- type SVG
- type SvgCircle
- type SvgElement
- type SvgGroup
- type SvgLine
- type SvgPath
- type SvgRectangle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSVGDimensions ¶
GetSVGDimensions reads the specified TinySVG 1.2 file and returns its width and height if declared
func NewColoredImage ¶
Create new colored image
func ParseCoordinates ¶
ParseCoordinates tries to parse a TinySVG 1.2 path attribute coordinate
func Render ¶
func Render(elements []SvgElement, img *image.RGBA)
Render function takes SVG elements and an image, and renders the elements onto the image
func RenderAndSaveSVG ¶
func RenderAndSaveSVG(elements []SvgElement, filename string, bgColor color.Color) error
RenderAndSaveSVG takes SVG elements and a background color, creates an image, renders the elements onto the image and saves it as PNG
Types ¶
type PathCommand ¶
type SVG ¶
type SVG struct { XMLName xml.Name `xml:"svg"` Width string `xml:"width,attr"` Height string `xml:"height,attr"` }
SVG represents the structure of the SVG file
type SvgElement ¶
func ParseFile ¶
func ParseFile(filename string) ([]SvgElement, error)
ParseFile will try to parse the given TinySVG 1.2 file into a slice of SvgElements
type SvgGroup ¶
type SvgGroup struct { Elements []SvgElement Fill color.Color }
New structure for SvgGroup
Click to show internal directories.
Click to hide internal directories.