Skip to content

Implement svg rendering for pd-vanilla and plugdata #74

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

timothyschoen
Copy link
Contributor

WIP implementation of svg rendering for pd-vanilla. Works decently well, but I need to clean up some things.

Implementation for purr-data and plugdata is also still needed, but that should be much easier.

@timothyschoen timothyschoen force-pushed the render_svg branch 3 times, most recently from ba2f7f5 to 3e280e3 Compare March 6, 2025 01:31
@timothyschoen timothyschoen changed the title Implement svg rendering for pd-vanilla Implement svg rendering for pd-vanilla and plugdata Mar 6, 2025
@timothyschoen
Copy link
Contributor Author

Also added support for plugdata, combined with some plugdata-side changes: https://github.com/plugdata-team/plugdata/tree/pdlua-svg

Works quite well!

Screenshot 2025-03-06 at 02 33 20

@timothyschoen
Copy link
Contributor Author

timothyschoen commented Mar 6, 2025

Screenshot 2025-03-06 at 13 28 01

More advanced demo: the SVG tiger in plugdata and pure-data. In terms of rendering capabilities, this is done now!

One caveat to be noted is that spng depends on zlib, so we need to link against that. I'm not very happy with that, so I'll look for a way to prevent it. Perhaps stbi_image can do it?

Something that's good to know, is that you can do escaped multi-line strings in lua like this:

local svg = [[
 ... svg here ...
]]

What's also nice, is that you can use svg rendering to circumvent any limitations of the rendering engine. If you want to have gradients or path intersections, you can just generate or write the svg for it. It won't be as performant on pd-vanilla, but at least you can pretty much draw everything this way.

@timothyschoen
Copy link
Contributor Author

timothyschoen commented Mar 6, 2025

Now:

  • Got rid of all sys_vgui in favour of pdgui_vmess
  • Make macros for plugdata/purr-data consistent
  • Got rid of zlib dependency by using stbi
  • Added a demo to the helpfile:
Screenshot 2025-03-06 at 16 03 00

I think that covers everything :)

@timothyschoen timothyschoen marked this pull request as ready for review March 6, 2025 15:03
@timothyschoen
Copy link
Contributor Author

Force pushed so we don't have the big spng header in the commit history

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

Successfully merging this pull request may close these issues.

1 participant