-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Support loading SVG images directly from usvg::Tree that is already in memory.
Is your feature request related to a problem? Please describe.
I cannot render SVG images in egui with an already existing usvg::Tree.
Describe the solution you'd like
Some additional method on the svg_loader in egui_extras named something like from_tree() that would accept a usvg::Tree. Not quite sure how this would work, as I am not familiar with the internals of the library. Would be nice to not have to specify a URI in this function as it already knows what datatype is incoming.
Describe alternatives you've considered
My current solution is to use egui::widgets::Image::from_bytes() and convert the tree to a bytes array using tree.to_string().into_bytes() which introduces several additional conversion steps.
Additional context
I am building a library that uses usvg::Tree internally to parse custom data out of SVGs. As I already have the SVG parsed into a tree, it would be ideal to pass that directly to rendering code without having to go through converting to string, then bytes, then reparsing the SVG.
This is partially related to #7797.