Skip to content

Fix the Draw Canvas internal node and make it run automatically #2669

Closed as not planned

Description

@Keavon

Also investigate why, even when rendering Vello, we don't have fast raster drawing like we used to.


The general idea behind the Draw Canvas node is this: right now, we render to an SVG string that gets stuffed into the DOM. SVG has a <foreignObject><foreignObject> tag that lets you stuff HTML into SVG. The Draw Canvas node, I believe, tells our SVG renderer (string generator) to instead create a <foreignObject><canvas /><foreignObject> so we have a canvas to draw to, instead of producing a <image src="..." /> with a base64 PNG (which is super slow because of compressed PNG encoding, base64 encoding, transfer to DOM, insertion into DOM, and decoding and rendering by the browser). In some way I'm not familiar with, this node also runs the necessary JS to target and draw to that <canvas /> element.

This node also had to be inserted manually, back when it worked. We need this to be done automatically so the user doesn't have to think about it. But only when rendering to the viewport, not when rendering to produce an SVG for export as a file. That, specifically, is controlled by the RenderParams struct's for_export field: https://github.com/GraphiteEditor/Graphite/blob/master/node-graph/gcore/src/graphic_element/renderer.rs#L228

I'm still of the opinion that perhaps the renderer should be in charge of generating and writing to the <canvas /> instead of that being the responsibility of the Render Canvas node, though. But @TrueDoctor seemed to strongly prefer this route, despite it requiring a lot of infrastructure that we have so far lacked. I'd still encourage us to explore the option of simply making this a part of the renderer, though.

Activity

  1. added theissue type on May 25, 2025
  2. added
    PerformanceSpeed and efficiency improvements
    GrapheneInvolves the node graph system/engine used by Graphite
    on May 25, 2025
  3. self-assigned this
    on May 30, 2025
  4. moved this from Short-Term to Completed This Milestone in Task Boardon Jun 7, 2025
  5. Keavon commented on Jun 7, 2025

    @Keavon
    MemberAuthor

    @0HyperCube we may discuss this in a call and I'd be happy to clear up and form consensus with your concerns, but that is better done privately than in the venue of closing an issue under ongoing development by one of our active GSoC contributors, whom I must imagine is confused seeing this closed without prior discussion. I encourage you to still assist with issue triage/management but we need to make sure we're on the same page and in agreement before closing issues in order to run a smooth ship. Thank you.

  6. reopened this on Jun 7, 2025
  7. moved this from Completed This Milestone to Short-Term in Task Boardon Jun 7, 2025
  8. Keavon commented on Jul 25, 2025

    @Keavon
    MemberAuthor

    Made obsolete by #2903.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrapheneInvolves the node graph system/engine used by GraphitePerformanceSpeed and efficiency improvements

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions