Expand description
An application’s own icons: SVG files registered by name, drawn like
egui-pop’s own (Icon::Custom) and nameable by a kit’s glyphs
(glyph.<role>: "<name>").
An icon is single-colour (Paint::Mono, tinted at draw with the
colour a widget gives, like the built-in icons) or full-colour
(Paint::Colour, an application’s logo, drawn as it is).
An application’s names may stay bare (play-circle); a plugin’s are
prefixed by its id (my-plugin:mask-circle, register_for) so two
plugins never clash. phosphor: names belong to the Phosphor set.
A contributor’s removal cleans its icons: unregister_owner (the
application calls it when a plugin is disconnected) or unregister
for one name.
install (run with the theme, theme::install_tokens) rasterises
every registered icon at the icon sizes of the theme (size.icon.*)
and the window’s pixels per point, as textures; drawing paints one
image. An icon drawn at another size (a kit’s indicator-size, an
application’s 15 points) is rasterised at that size the first time it
is drawn, then kept: scaling a texture would blur it.
A single-colour icon is a white mask, so one texture serves every
colour. Rasterising needs the svg feature (resvg); without it,
register refuses.
Structs§
- Custom
Icon - An icon an application registered.
- Registered
- A registered icon, as agents read it.
Enums§
Functions§
- by_name
- A registered icon by name.
- install
- Rasterises every registered icon at the theme’s icon sizes and the
context’s pixels per point. Called by
theme::install_tokens, between frames; a no-op when nothing is registered. - names
- Every registered icon’s name, in registration order.
- register
- Registers an SVG icon under a name (kebab case, like
play-circle), or replaces the one registered under it. In use from the next theme install. A name keeps its id for the whole process, even unregistered (unregister) and registered again. A name<owner>:<name>is owned byowner(seeregister_for); egui-pop’s names and thephosphor:ones are refused. - register_
for - Registers a plugin’s SVG icon under
<owner>:<name>(the plugin’s id asowner:my-plugin:mask-circle), asregisterdoes. - registered
- Every registered icon, in registration order.
- unregister
- Unregisters the icon registered under
name: the name stops resolving at once, and its textures go at the next theme install. Returns whether it was registered. - unregister_
owner - Unregisters every icon of an owner (
<owner>:<name>, seeregister_for), asunregisterdoes: a contributor’s removal cleans its registrations. The application API calls it when a plugin is disconnected or fails to connect. Returns how many were removed.