Documentation
¶
Overview ¶
Package svg is gowt's optional SVG rasterizer (the counterpart of SWT's org.eclipse.swt.svg fragment): importing it for its side effect makes swt.Image load SVG at every zoom. It draws with oksvg+rasterx (pure Go): paths, basic shapes, gradients, strokes; no text, filters or masks.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewImageDataProvider ¶
func NewImageDataProvider(svg []byte, width, height int32, color string) swt.ImageDataProvider
NewImageDataProvider is the zoom-aware source of an icon logically width x height: every zoom is drawn from the vector at width*zoom/100 pixels. For a new theme colour build a new provider.
Example ¶
A monochrome icon recolored for the current theme; the provider draws it at every zoom.
package main
import (
_ "embed"
"github.com/haiodo/gowt/svg"
)
//go:embed testdata/lucide-heart.svg
var icon []byte
// A monochrome icon recolored for the current theme; the provider draws it at every zoom.
func main() {
p := svg.NewImageDataProvider(icon, 16, 16, "#e0e0e0")
_ = p // pass to swt.NewImageDeviceImageDataProvider
}
Output:
Types ¶
This section is empty.