Graphite
Graphite copied to clipboard
Node to rasterize vector graphics
Using the arbitrary canvas targets for rendering introduced in #1256, we can easily repurpose that to render SVG content and read back the rendered canvas data. This lets us avoid needing to switch to Vello quite so soon.
@TrueDoctor In regards to the RenderNode you've discussed (which I'm not too privy to with its functionality), how does that pertain to the current status of this issue? Should this be closed, or modified to reflect some desired changes to the RenderNode to make it more useful/capable/general? Or should it be updated to talk about integrating Vello?
This is basically provided by the render node
Except it's not currently actually coded to do that, right? I would suggest we use web-sys for the moment since that should just be a few lines of code and ensures consistent rendering results, until we can fully switch to Vello.
The code exits, it is just not currently used but that can easily be changed when hooking it up to something. This is basically not a blocker
The rasterize node currently takes Footprint -> GraphicElement
data and returns a bitmap at the resolution of the footprint and thus, if manually hooked up, would be production-ready today? If so, what engine is it using to rasterize the content? I'm just clarifying since I recall hearing varying information about the readiness of that.
I originally implemented this using the web-sys apis (that implementation is still available as comment in the node source code but can be made into a fallback based on the vello
/resvg
feature flags). I then started to adopt vello
which is why the original code is currently commented out. For more info see wasm_application_io.rs
Nice. And were you able to get working rasterized image output from the web-sys implementation? I'd suggest keeping your Vello port fully behind a feature flag so we can keep the web-sys version in the editor until the Vello integration is completed and robust enough to land. Once that's the case and this node is usable for users to hook up if they wanted, the PR achieving that can close this issue. Meanwhile, even though I'm quite glad to hear it sounds trivial to implement this, it'll still be useful to keep this issue open to track that.
Yes, I was able to get proper images. iirc other issues are blocked on this one so keeping this open might not be the best approach