A themed icon that can be dropped into any widget or layout. Sources:
- Glyph — a built-in
UIGlyphdrawn as a vector (no asset). UseUIIcon.fromGlyph(...)or assignglyph; takes precedence overassetwhen set. - SVG (preferred) when the optional
svghaxelib is present (-lib svgsets thesvgdefine automatically) — rasterized once per (asset, pixel size) into a shared static cache, so N icons of the same glyph cost one texture and batch as bitmaps. - Bitmap assets (png etc.) otherwise, scaled into the same cache.
Tinting forces every opaque pixel to a theme colour (tone ramp or colorOverride) via a
reused ColorTransform, so monochrome icon sets follow theme swaps with zero extra
bitmaps; set tinted = false for full-colour art. Missing assets render a placeholder
ring so layouts never break. Non-interactive and pointer-transparent — attach freely to
buttons, rows, rails (addChild + position).
Static methods
staticclearCache():Void
Drops all cached rasters and parsed SVG documents (e.g. after a UITheme.setScale
change made every old pixel size stale, or on state teardown). Live icons re-rasterize
on their next render. Cached BitmapData is left to the GC — it may still be
displayed by live Bitmaps.
staticfromGlyph(glyph:UIGlyph, size:Float = 16, tone:UITone = SECONDARY):UIIcon
Builds an icon that draws a built-in vector UIGlyph (no asset needed).
Parameters:
glyph | the glyph to draw |
|---|---|
size | base (unscaled) square edge length |
tone | theme text ramp tint ( |
Returns:
the configured icon
staticgetBitmap(asset:String, sizePx:Int):BitmapData
The shared rasterized bitmap for an asset at an exact pixel size (rendered/scaled and
cached on first request). Custom widgets can draw icons directly from this in their
own render() without a child UIIcon.
Parameters:
asset | the icon asset path |
|---|---|
sizePx | the exact square pixel size |
Returns:
the cached bitmap, or null when the asset is missing (or .svg without the lib)