Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svg api explicit from bytes #206

Closed
aentity opened this issue Feb 25, 2020 · 3 comments · Fixed by #247
Closed

svg api explicit from bytes #206

aentity opened this issue Feb 25, 2020 · 3 comments · Fixed by #247
Labels
feature New feature or request
Milestone

Comments

@aentity
Copy link
Contributor

aentity commented Feb 25, 2020

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 :))))

@hecrj
Copy link
Member

hecrj commented Feb 25, 2020

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.

@hecrj hecrj added the feature New feature or request label Feb 25, 2020
@hecrj hecrj added this to the 0.1.0 milestone Feb 25, 2020
@dyedgreen
Copy link

Yeah, I’d +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’d have to save to file and reload from the known location which feels very hacky.

@hecrj
Copy link
Member

hecrj commented Mar 30, 2020

I just opened #247 to address this!

Please, let me know if you have any suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants