svg

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const SVG_NS = "http://www.w3.org/2000/svg"

Variables

This section is empty.

Functions

func Fjoin

func Fjoin(v ...float64) string

func Ftoa

func Ftoa(v float64) string

Types

type Canvas

type Canvas struct {
	// contains filtered or unexported fields
}

Canvas

func NewCanvas

func NewCanvas(group *Element) *Canvas

func (*Canvas) Circle

func (c *Canvas) Circle() canvas.CirclePainter

func (*Canvas) Cleanup

func (c *Canvas) Cleanup()

func (*Canvas) Path

func (c *Canvas) Path() canvas.PathPainter

func (*Canvas) Rect

func (c *Canvas) Rect() canvas.RectPainter

func (*Canvas) Reset

func (c *Canvas) Reset()

func (*Canvas) Text

func (c *Canvas) Text() canvas.TextPainter

type Circle

type Circle struct{ *Styler }

Circle

func (*Circle) Circle

func (circle *Circle) Circle(center point.Point, radius float64) canvas.CirclePainter

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context

func NewContext

func NewContext(element *Element, layers ...layer.Layer) *Context

NewContext creates a render context to the element with the specified 'elementId'. This element should be an 'svg' element.

func (*Context) Animate

func (c *Context) Animate() animation.Animator

func (*Context) Drag

func (c *Context) Drag(...drag.Option) drag.Dragger

func (*Context) Render

func (c *Context) Render()

func (*Context) SetLayers

func (c *Context) SetLayers(layers ...layer.Layer)

func (*Context) Zoom

func (c *Context) Zoom(...zoom.Option) zoom.Zoomer

type Dom

type Dom struct {
	ChildNodes map[string]*Element
}

func NewDom

func NewDom() *Dom

func (*Dom) CreateElementNS

func (d *Dom) CreateElementNS(namespace, tag string) *Element

func (*Dom) GetElementById

func (d *Dom) GetElementById(id string) *Element

func (*Dom) Reset

func (d *Dom) Reset()

func (*Dom) SetElementById

func (d *Dom) SetElementById(id string, e *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 (e *Element) AppendChild(child *Element)

func (*Element) Attribute

func (e *Element) Attribute(name string) (string, bool)

func (*Element) ReplaceChild

func (e *Element) ReplaceChild(newChild, oldChild *Element)

func (*Element) SetAttribute

func (e *Element) SetAttribute(name, value string)

func (*Element) WriteTo

func (e *Element) WriteTo(w io.Writer) (n int64, err error)

type HTML

type HTML struct {
	*Element
	// contains filtered or unexported fields
}

HTML

func NewHTML

func NewHTML() (*HTML, error)

NewHTML

func (*HTML) AddCanvas

func (html *HTML) AddCanvas(id string, width, height int) (*Element, error)

AddCanvas

func (*HTML) AddSVG

func (html *HTML) AddSVG(id string, width, height int) (*Element, error)

AddSVG

func (*HTML) SaveToFile

func (html *HTML) SaveToFile(filePath string) error

SaveToFile

type Path

type Path struct {
	*Styler
}

Path

func (*Path) Path

func (p *Path) Path(points []point.Point) canvas.PathPainter

type Rect

type Rect struct {
	*Styler
}

Rect

func (*Rect) CornerRadius

func (rect *Rect) CornerRadius(rx, ry float64) canvas.RectPainter

func (*Rect) Rect

func (rect *Rect) Rect(width, height float64) canvas.RectPainter

type SVG

type SVG struct{ *Element }

SVG

func NewSVG

func NewSVG(id string, width, height int) (*SVG, error)

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>

func (*SVG) SaveToFile

func (svg *SVG) SaveToFile(filePath string) error

SaveToFile

type Styler

type Styler struct {
	// contains filtered or unexported fields
}

Styler

func (*Styler) Clear

func (p *Styler) Clear()

func (*Styler) Fill

func (p *Styler) Fill(style canvas.Style)

func (*Styler) Paint

func (p *Styler) Paint(style canvas.Style)

func (*Styler) Stroke

func (p *Styler) Stroke(style canvas.Style)

type Text

type Text struct {
	// contains filtered or unexported fields
}

Text

func (*Text) FillText

func (p *Text) FillText(t affine.Matrix, text string, style canvas.Style)

Jump to

Keyboard shortcuts

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