linebender / linebender/piet

Question: How to export piet-svg as File/dataUrl via the browser?

Open
#245 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.4k
Forks
98
PR merge metrics
No merged PRs in 30d

Description

Hello. Sorry if this is not the right place to ask for that, but I am currently using piet-web to draw on a canvas. I draw some elements I would like to export as PNG and SVG. I started with piet-svg but when you do:
`context.write(anybuff).unwrap();` we don't have access to the buffer anymore, right?

I suppose it would be nice to have some kind of callback which returns the SVG string or something to be able to have it as dataurl to force the download via the browser.

For a more real example, the app is currently deployed on https://beta.eukolia.design
For instance, if you select a smiley, I would like to be able to download it as SVG.

Thanks a lot for the help.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the piet-svg and piet-web APIs around context.write(anybuff), especially how the buffer is consumed. Determine whether the existing API can expose the generated SVG string or a data URL for browser downloads, and define the expected behavior using the smiley export example as the completion case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.