svg

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: EPL-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 int, 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
}

func Recolor

func Recolor(svg []byte, color string) []byte

Recolor sets what currentColor means in a monochrome icon (Lucide, Tabler); color is #rrggbb.

Types

This section is empty.

Jump to

Keyboard shortcuts

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