Skip to content
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

Fix endShape() to Properly Close Paths and Prevent Shape Merging #7601

Merged
merged 2 commits into from
Mar 5, 2025

Conversation

Forchapeatl
Copy link
Contributor

@Forchapeatl Forchapeatl commented Mar 4, 2025

Resolves #7532

Changes:
Ensures this.clipPath.closePath happens on drawShape() before any new shape starts.

Screenshots of the change:

before:

Screenshot from 2025-03-04 20-44-57

after:

Screenshot from 2025-03-04 20-46-07

snippet:

var myImg;


async function setup() {
  createCanvas(400, 400);
  noSmooth();
  myImg = await loadImage("Stone_Retaining_wall.jpg");

}

function draw() {
  background(220);
  
  beginClip();
  beginShape();
  vertex(100,100);
  vertex(200,100);
  vertex(200,200);
  vertex(100,200);
  endShape();
  beginShape();
  vertex(200,150);
  vertex(300,150);
  vertex(300,250);
  vertex(200,250);
  endShape();
  
  circle(200,250,50);
  
  endClip();
  
  image(myImg,0,0);
}

PR Checklist

Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Forchapeatl!

@davepagurek davepagurek merged commit e37bfa6 into processing:dev-2.0 Mar 5, 2025
2 checks passed
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.

2 participants