Skip to content

Implement clipping masks, stroke align, and stroke paint order #2644

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

Merged
merged 47 commits into from
Jun 18, 2025
Merged

Conversation

mTvare6
Copy link
Collaborator

@mTvare6 mTvare6 commented May 13, 2025

Closes #1920, closes #2268

@Keavon Keavon changed the title Implement clipping. Implement clipping masks May 16, 2025
@Keavon
Copy link
Member

Keavon commented Jun 9, 2025

A few things about stroke align:

  1. If I just open a new canvas and draw an ellipse, increase its stroke weight so t's more easy to see, and change the stroke align, we end up with it not seeming to work.
  2. And when it's set to Outside, in addition to it not working, it also crops off the edges in a rectangle https://files.keavon.com/-/UnsightlyNovelCub/capture.png
  3. If I instead go to Valley of Spires, it seems to work, although Outside mode makes it no longer have a fill https://files.keavon.com/-/OptimisticScrawnyAnura/capture_11_.mp4

@Keavon Keavon changed the title Implement clipping masks Implement clipping masks, stroke alignment, and stroke paint order Jun 15, 2025
@Keavon Keavon changed the title Implement clipping masks, stroke alignment, and stroke paint order Implement clipping masks, stroke align, and stroke paint order Jun 18, 2025
@github-actions github-actions bot requested a deployment to graphite-dev (Preview) June 18, 2025 05:03 Abandoned
@Keavon Keavon enabled auto-merge (squash) June 18, 2025 05:08
@Keavon Keavon merged commit eb72792 into master Jun 18, 2025
5 of 6 checks passed
@Keavon Keavon deleted the clipping branch June 18, 2025 05:36
Keavon added a commit that referenced this pull request Jun 20, 2025
* refactor: opacity + blend_mode -> blend_style

* Add code for clipping

* Add alt-click masking

* Clip to all colors. Fill option

* Fix undo not working. Fix strokes not being white

* Allow clipped to be grouped or raster

* Switch to alpha mode in mask-type

* add plumbing to know if clipped in frontend and add fill slider

* Attempt at document upgrade code

* Fix fill slider

* Add clipped styling and Alt-click layer border

* Use mask attr judiciously by using clip when possible

* Fix breaking documents and upgrade code

* Fix fixes

* No-op toggle if last child of parent and don't show clip UI if last element

* Fix mouse styles by plumbing clippable to frontend

* Fix Clip detection by disallowed groups as clipPath according to SVG spec doesn't allow <g>

* Add opacity to clippers can_use_clip check

* Fix issue with clipping not working nicely with strokes by using masks

* Add vello code

* cleanup

* Add stroke alignment hacks to SVG renderer

* svg: Fix mask bounds in vector data

* vello: Implement mask hacks to support stroke alignment

* Move around alignment and doc upgrade code

* rename Line X -> X

* An attempt at fixing names not updating

* svg: add stroke order with svg

* vello: add stroke order with by calling one before the other explicitly

* fix merge

* fix svg renderer messing up transform det

* Code review; reorder and rename parameters (TODO: fix tools)

* Fixes to previous

* Formatting

* fix bug 3

* some moving around (not fixed)

* fix issue 1

* fix vello

* Final code review

---------

Co-authored-by: Keavon Chambers <[email protected]>
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.

Stroke alignment Clipping masks
2 participants