Support load .svg images
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
**What problem does this solve or what need does it fill?**
Allow bevy to load svg vector images
**Describe the solution would you like?**
Using [resvg](https://github.com/RazrFalcon/resvg) crate, bevy can easily support svg images
**Describe the alternative(s) you've considered?**
None
**Additional context**
I added a `SvgTextureLoader` and then rendered the image using resvg and now it works fine.
```rust
let texture_handle = asset_server.load("branding/bevy_logo_light.svg");
```

One troublesome question, since svg is vector, how do we determine the size of the image?
Before rendering the svg we have to determine the size
```rust
pub enum FitTo {
/// Keep original size.
Original,
/// Scale to width.
Width(u32),
/// Scale to height.
Height(u32),
/// Zoom by factor.
Zoom(f32),
}
```
Maybe we can?
```rust
// Default
asset_server.load("branding/bevy_logo_light.svg");
// Scale
asset_server.load("branding/bevy_logo_light.svg?10.0");
asset_server.load("branding/bevy_logo_light.svg#width=1000.");
```
Bad scenario:
Re-render at each zoom?
Contributor guide
Assessment
This issue has not been assessed yet.