Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GSoC 2025: Marquee Selection Masking #2655

mTvare6 started this conversation in Student Project Reports
Discussion options

About:

I'm Austin, a statistics student in IITK and I will be working on my project titled marquee selection masking to implement various features related to masking and clipping into Graphite.

Synopsis

The goal of this project is to supplant the Mask node with a mask input to every graphical node, which takes in a general graphic input. This lays the foundation to build further nodes and operations such as one sided stroke alignment, gradient across strokes. Further a new "mask mode" will be introduced, which works at tooling level to enable a way to implement marquee selection masking, which unlike traditional mask tools(clipping) also supports gradient based operations(masking) and supporting much more than simple lasso, freeform or rectangle type selection present in other tools. Further, a system to show the types of nodes merged through the merge node will be implemented, along with their mask information.

Deliverables

  • Add a mask input to most graphical node which uses the mask in some form and remove the old mask node, which is then equivalent to merge with mask.
  • Implement the infrastructure to render the output of the mask node with SVGs and vello.
  • Add the MaskMode to the DocumentMode, with the live masking ants shader running then, which as expected for a DocumentMode affects tooling behaviour.
  • Add the system required to propagate nodes merged through the Merge node in the layer panel, along with masks of nodes if present.
  • Flood fill node which takes in a point, tolerance and color.
You must be logged in to vote

Replies: 9 comments

Comment options

mTvare6
May 19, 2025
Collaborator Author

Week 1

This week I've mostly been writing the infrastructure neccessary for clipping, as it would be simpler and act precursorial to masking. This involved using a SVG mask tag if any alpha change is involved and otherwise uses clipPath to simplify operations involved.

no clip clipped fill set to 0

The same works for groups, raster target and vector data.

fill set to 100 fill set to 0
You must be logged in to vote
0 replies
Comment options

mTvare6
May 26, 2025
Collaborator Author

Week 2

I started off this week by fixing new bugs and my old PR which didn't work over time.

Then into writing a system so that clipPath can be alternatively used instead of mask when possible, as it is faster and has lesser artifacts.

clipPath mask

Then, along with the help of @Keavon who wrote the frontend part, and assets, I implemented a indicator for clipped layers in Layer panel.

image

And finally I ended the week by fixing the logic used in clip and mask usage, to ignored layers with stroke.

before after
You must be logged in to vote
0 replies
Comment options

mTvare6
May 30, 2025
Collaborator Author

Week 3

I started off this week by working on part 6 of instance table refactor.

It mostly involved rewriting method to work with many rows across the table instead of the first, and a followup to an old PR

It allows #[range(x, y)] to act like soft_(min|max).

And I ended up implementing masking in vello, which looks exactly the same and also makes inverted masking a breeze compared to doing so with SVGs:

8xU5.mp4
normal inverted

Then, I worked on stroke alignment, by using the same technique used for masking, as neither vello nor svg have built-ins. I had also implemented paint-order for strokes and fills, which was now straight forward in svg and implemented in vello by changing the order of calling scene.fill and scene.stroke.
Like with other software, stroke align isn't implemented in open vector data for simplicity.

center inside outside

Paint Order:

stroke last fill last
You must be logged in to vote
0 replies
Comment options

mTvare6
Jun 19, 2025
Collaborator Author

You must be logged in to vote
0 replies
Comment options

mTvare6
Jun 19, 2025
Collaborator Author

Week 5

  • Fixed bug where Outside stroke alignment would ignore fill due to masking by instead using stroke order to get similiar behaviour if there is fill (otherwise continue with masking)
  • Fixed bug with edge case allowing gradients work messing with path's stroke alignment transform
  • Rewrote the mask node so that masks no longer rely on raster content but instead work with any content, and render the same with svg or vello, which will eventually allow some nodes to consume the mask and modify data in place if required, or is otherwise sent straight to renderer
You must be logged in to vote
0 replies
Comment options

mTvare6
Jun 30, 2025
Collaborator Author

Week 6

This week I focused on implementing the separate visualization of pivot and origin points as described in issue #2225.

The PR adds origin data to each layer, which establishes a foundational concept that was missing in Graphite. Origin is the (0,0) coordinate of a layer's internal space, separate from the temporary pivot used during transformations.

I implemented:

  • Added origin visualization (a dowel pin symbol)
  • Implemented three center of transformation modes similar to Blender's transform pivot point system, 2 pivot based and 2 origin,
    • Draft Pivot: a pivot which can be moved around or set using reference pivot
    • Average of Origins: Mean position of origins of selected layer
    • Active Object Origin: centered about last selected layer
    • Default: center of bounds covering the layers

Active Object Origin

active.mp4

Average of Origins

avg.mp4

Draft Pivot

pivot.mp4

Default

a.mp4

I also improved the pivot system by:

  • Removing the persistent per-layer storage of pivot positions to avoid user confusion
  • Making pivot positions reset when switching layers unless explicitly pinned
  • Revert to a ReferencePoint when switching layers
You must be logged in to vote
0 replies
Comment options

mTvare6
Jul 15, 2025
Collaborator Author

Week 7

This week I continued working on #2225

  • Added pin widget for pinning pivot reference input widget
  • Refactored pivots and "Dot" to work with path tool (and have all features in select_tool work for path_tool)
  • Added active origin, working pivot and average of origin types to path tool
  • Some final fixes to PivotGizmo before merging
You must be logged in to vote
0 replies
Comment options

mTvare6
Jul 15, 2025
Collaborator Author

Week 8

Before:

capture_61_.mp4

After:

8G0e.mp4
You must be logged in to vote
0 replies
Comment options

mTvare6
Jul 25, 2025
Collaborator Author

Week 7

This week started with updating Vello and wgpu to the latest version. This was a necessary step to allow forking the repositories and submitting our changes upstream.

With the update complete, I added luminance based clipping to Vello for use in #2808

Finally, I worked on optimising raster data rendering by moving image data to DOM by using js Reflect API, instead of base64 representation of png in SVG, with the intended goal of reducing data transferred.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /