Documentation
¶
Overview ¶
Package iconoir provides idiomatic, pure-Go (CGO=0) access to the Iconoir icon set (https://iconoir.com). Every icon is a 24×24 SVG that this package rasterizes to an anti-aliased alpha coverage mask with a small self-contained SVG-path renderer (no third-party SVG library), then blits through the go-widgets painter or any *image.RGBA.
The Iconoir artwork is MIT-licensed (see LICENSE-ICONOIR); the Go code in this package is BSD-3-Clause (see LICENSE).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Draw ¶
Draw looks the Regular icon up by name and blits it via DrawIcon. It reports whether the icon exists; an unknown name draws nothing.
func DrawIcon ¶
DrawIcon rasterizes ic at r's (square, centered) size and blits it through the painter, modulating ink's alpha by each pixel's coverage. Its signature matches the icon-drawing callback that go-widgets/toolkit widgets (Banner.Icon, IconButton.Icon, …) expect, so it composes directly as one of those callbacks.
func SolidNames ¶
func SolidNames() []string
SolidNames returns the sorted names of every Solid icon.
Types ¶
type Icon ¶
type Icon struct {
// contains filtered or unexported fields
}
Icon is a single, lazily-parsed Iconoir glyph. Rasterized masks are cached per (size, stroke) key; an Icon is safe for concurrent use.
func MustGet ¶
MustGet is Get but panics if the icon does not exist. Handy for package-level icon references that must exist.
func (*Icon) DrawInto ¶
DrawInto composites the icon into dst, fitted (centered) inside r and tinted with col. Coverage from the anti-aliased mask modulates col's alpha, and the result is src-over blended onto dst.
func (*Icon) Rasterize ¶
Rasterize returns the icon's anti-aliased coverage mask at sizePx×sizePx using the icon's own stroke width(s). The result is cached and must not be mutated by the caller.
func (*Icon) RasterizeStroke ¶
RasterizeStroke is like Rasterize but forces every stroke to strokePx device pixels wide (ignored for Solid icons, which are filled).