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 #643 - PShape.beginContour() bug #776

Merged
merged 1 commit into from
Sep 15, 2023
Merged

fix #643 - PShape.beginContour() bug #776

merged 1 commit into from
Sep 15, 2023

Conversation

hx2A
Copy link
Contributor

@hx2A hx2A commented Aug 27, 2023

Fix for bug #643.

I tested this with the default JAVA2D and FX2D renderers in the PDE using the PShape.beginContour() example code as well as some code in the #643 thread. Happy to do more testing as needed.

@hx2A hx2A changed the title fix #643 fix #643 - PShape.beginContour() bug Aug 27, 2023
@benfry benfry merged commit 97fd524 into benfry:main Sep 15, 2023
@benfry
Copy link
Owner

benfry commented Sep 15, 2023

Excellent, thanks for the fix.

If you'd be up for doing a PR for JavaFX as well, that would also be super helpful.

Thanks again.

@hx2A
Copy link
Contributor Author

hx2A commented Sep 15, 2023

Excellent, thanks for the fix.

You are welcome! This is my first contribution to the Processing code.

If you'd be up for doing a PR for JavaFX as well, that would also be super helpful.

I am, but does this PR not fix the issue for FX2D as well? When I try to reproduce the bug in the PDE with FX2D and with my updated core.jar, I see the contour works correctly.

import processing.javafx.*;

PShape s;
void setup() {
  size(400, 200, FX2D);
  fill(255, 0, 0);
  noLoop();
}
void draw() {
  translate(50, 50);
  s = createShape();
  s.beginShape();
  s.fill(255, 0, 0);
  s.vertex(  0, 0);
  s.vertex(100, 0);
  s.vertex(100, 100);
  s.vertex(  0, 100);
  s.beginContour();
  s.vertex( 25, 25);
  s.vertex( 25, 75);
  s.vertex( 75, 75);
  s.vertex( 75, 25);
  s.endContour();
  s.endShape(CLOSE);
  shape(s, 0, 0);

  translate(200, 0);

  beginShape();
  fill(255, 0, 0);
  vertex( 0, 0);
  vertex(100, 0);
  vertex(100, 100);
  vertex(0, 100);
  beginContour();
  vertex(25, 25);
  vertex(25, 75);
  vertex(75, 75);
  vertex(75, 25);
  endContour();
  endShape(CLOSE);
}

image

The JavaFX renderer doesn't have a PShape class of its own, so doesn't it use the same PShape that the Java2D renderer uses?

@benfry
Copy link
Owner

benfry commented Sep 15, 2023

Ah, I misunderstood what you'd written about it working with both Java2D and JavaFX. Yes, we should be set for JavaFX as well.

Thanks again!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants