Documentation
¶
Index ¶
Constants ¶
const SVG_NS = "http://www.w3.org/2000/svg"
Variables ¶
This section is empty.
Functions ¶
func Ftoa ¶
Ftoa formats v with the given decimal precision: 0 rounds to the nearest integer, N keeps N decimal places, and -1 emits the shortest string that round-trips. Rounding here — in serialization, not in the geometry — keeps SVG path data short without disturbing the sub-pixel points the raster layers draw, which is why precision lives on the SVG context, not on the scene.
Types ¶
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
Canvas
func (*Canvas) Circle ¶
func (c *Canvas) Circle() canvas.CirclePainter
func (*Canvas) Path ¶
func (c *Canvas) Path() canvas.PathPainter
func (*Canvas) Rect ¶
func (c *Canvas) Rect() canvas.RectPainter
func (*Canvas) Text ¶
func (c *Canvas) Text() canvas.TextPainter
type Context ¶
type Context struct {
// Precision is the decimal precision used when formatting coordinates into
// SVG attributes: 0 snaps to whole pixels, N keeps N decimal places, -1
// emits the shortest round-tripping string. It is read live at render time,
// so it may be set any time before Render. Defaults to 3.
Precision int
// contains filtered or unexported fields
}
Context
func NewContext ¶
NewContext creates a render context to the element with the specified 'elementId'. This element should be an 'svg' element.
type Element ¶
type Element struct {
*Dom
Namespace string
Tag string
ChildNodes []*Element
TextContent string
// contains filtered or unexported fields
}
Element
func (*Element) AppendChild ¶
func (*Element) ReplaceChild ¶
func (*Element) SetAttribute ¶
type HTML ¶
type HTML struct {
*Element
// contains filtered or unexported fields
}
HTML
type Rect ¶
type Rect struct {
*Styler
// contains filtered or unexported fields
}
Rect
func (*Rect) CornerRadius ¶
func (rect *Rect) CornerRadius(rx, ry float64) canvas.RectPainter
type SVG ¶
type SVG struct{ *Element }
SVG
func NewSVG ¶
NewSVG creates a simple document with just an svg element. <?xml version="1.0" standalone="yes"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="my-3d-svg" width="500" height="400"> </svg>