Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Constraints ¶
Constraints is the layout.Constraints with f32.Pt instead of image.Point. This is used to keep aspect ratio, and to keep the size of the icon within the constraints.
type Icon ¶
type Icon struct {
// contains filtered or unexported fields
}
Icon keeps a cache from the last frame and re-uses it if the size didn't change.
func NewIcon ¶
NewIcon creates the layout.Widget from the iconOp. Similar to widget.List, the Icon keeps the state from the last draw, and the drawing is used if the size remains unchanged. You should reuse the same Icon across multiples frames.
Make sure to not reuse the Icon with different sizes in the same frame, if the same Icon is used twice in the same frame you MUST create two Icon, for each one.
type Vector ¶
type Vector func(ops *op.Ops, constraints Constraints) layout.Dimensions
Vector hold the information from the XML/SVG file, in order to avoid decoding of the XML.
func NewVector ¶
NewVector creates an IconOp from the given data. The data is expected to be an SVG/XML
func NewVectorReader ¶
NewVectorReader creates an IconOp from the given io.Reader. The data is expected to be an SVG/XML
func (Vector) Layout ¶
func (v Vector) Layout(gtx layout.Context) layout.Dimensions
Layout implements layout.Widget, that renders the current vector without any cache. Consider using NewIcon instead.
You should avoid it, that functions only exists to simplify integration to custom cache implementations.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
example
module
|
|
internal
|
|
svgparser/simplexml
Package simplexml is used to parse the SVG xml file, but it avoids `encoding/xml`for JS, and it's compatible with TinyGo.
|
Package simplexml is used to parse the SVG xml file, but it avoids `encoding/xml`for JS, and it's compatible with TinyGo. |