Skip to content

How to ignore fill rule to fill entire path #2080

Open
@marcopaivaf

Description

@marcopaivaf

Description/Steps to reproduce

Hey guys, sorry if this is not the right place this question. I was wondering if someone with more PaperJS experience could help me with this. I'm trying to fill the an entire Path, including its holes and negative spaces.
I understand that I can call resolveCrossings to break the path at all self-intersections, but that doesn't seem to account for negative spaces between self-intersections.

For example, the below pathData produces this path:

var path = new Path("M284.16424,537l251.83576,-251.83576l251.83576,251.83576l-503.67153,-251.83576l251.83576,251.83576l251.83576,-251.83576z");

After calling resolveCrossings the resulted CompoundPath have 6 paths (one of each filled section).

Screenshot 2024-06-14 at 12 58 53

But what I'm looking to achieve is fill every everything, including those two negative spaces, resulting in something like this:

Screenshot 2024-06-14 at 12 57 27

Link to reproduction test-case

http://sketch.paperjs.org/#V/0.12.17/S/hVDLbsIwEPyVlS9QKTHNwwkCceJcqWqPuAeTLsSKWSOvS9VW/XecIrUckHqbHc3OzuyXIHNAsRDPA8auF5no/Os4n0yAo4k9rIDwHR4TnGrxUM5rWTR1WWeqal2pCjmvVNtk+S+8Iv+4XN1XsmkLVf2nvGX5qcXdUpOm2QyekL07IRj6AEa3yy1FDIxdtJ4YLEHs8Se5prFDQH5zMbUYKRku2+vgmS3teTr6XiRyZ51be+dDEk+2znTDJL1jG9AMR5+usFhsXr7P

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions