Skip to main content

SvgService

Trait SvgService 

Source
pub trait SvgService {
    // Required methods
    fn register_svg(&mut self, bytes: &[u8]) -> SvgId;
    fn unregister_svg(&mut self, svg: SvgId) -> bool;
}
Expand description

SVG asset registration service.

This keeps SceneOp cheap (it stores SvgId, not raw bytes) while allowing renderers to rasterize/cache SVGs at paint time using their GPU context.

Required Methods§

Source

fn register_svg(&mut self, bytes: &[u8]) -> SvgId

Register SVG bytes and return a stable SvgId.

Implementations may deduplicate repeated registrations.

Source

fn unregister_svg(&mut self, svg: SvgId) -> bool

Release a previously registered SVG.

This is a ref-counted release: each successful register_svg increments a reference count (including deduplicated registrations that return an existing SvgId), and unregister_svg decrements it. Implementations should only drop the underlying bytes and any cached rasterizations when the count reaches zero.

Implementors§