Iced: svg api explicit from bytes

Created on 25 Feb 2020  路  3Comments  路  Source: hecrj/iced

This ticket just some clarification about svg, and maybe more explicit api.

So backstory, I noticed svg render was empty sometimes; i then realized i was passing path with typo, and svg (presumbly) wasn't loaded, but no error.

Ideally, I handle loading raw bytes of svg once with regular file into vec<u8>, and pass this to svg api constructor. Maybe similar to #76 ?

I only see path api in svg though, unless I'm missing it? This also makes me wonder, is svg loaded from disk by iced and cached somewhere? I prefer to be in control of resource loading, so:

  1. can we have explicit from_bytes (or whatever) api for handling resource loading ourselves
  2. less ideal: can we add error (or panic at least) if file not found for svg api (probably error is harder because the actual loading is done by something else in iced?)

and thanks for great library :))))

feature

All 3 comments

Yes, we are currently failing silently when a file cannot be opened.

In the long run, the idea is to draw some kind of icon or error message, similar to what most browsers do. A lot of details like this are missing!

About (1), I think it could be useful indeed. Although we should also keep the current approach for convenience.

Yeah, I鈥檇 +1 being able to load SVG directly from bytes. This would be extremely useful for cases where the svg is generated in the program on the fly. Currently I鈥檇 have to save to file and reload from the known location which feels very hacky.

I just opened #247 to address this!

Please, let me know if you have any suggestions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pbspbsingh picture pbspbsingh  路  4Comments

johannesvollmer picture johannesvollmer  路  4Comments

twitchyliquid64 picture twitchyliquid64  路  4Comments

porglezomp picture porglezomp  路  3Comments

Plecra picture Plecra  路  4Comments