linebender / linebender/piet

Looking to accomplish "reverse" clip

Open
#532 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Rust
Stars
1.4k
Forks
98
PR merge metrics
No merged PRs in 30d

Description

In skia for instance, it's possible to accomplish a reverse clip meaning that the clip area is not used as an intersection, but as a subtraction instead. This is useful when trying to accomplish more graphical features such as rendering strokes with outside alignment (default is centered, inner alignment can be accomplished by doubling the stroke width and using the shape as clip shape, but outer alignment requires inverse clipping). I have tried without success to accomplish this in piet. Is this something we can add? Can this be done by allowing the clip shape to use an even-odd fill rule? I am using druid on windows so I assume I am using the d2d backend. It specifies nonzero as fill rule which seems wrong.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing piet's clip API and the d2d backend used by Druid on Windows, then compare its nonzero fill-rule handling with Skia's reverse clip behavior. Check whether an even-odd fill rule is exposed and how clipping is represented across backends. Done means inverse clipping supports the requested outside-aligned stroke use case without breaking existing clipping behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.