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

JAVA2D copy is broken (ClassCastException) #624

Closed
processing-bot opened this issue Dec 17, 2022 · 2 comments
Closed

JAVA2D copy is broken (ClassCastException) #624

processing-bot opened this issue Dec 17, 2022 · 2 comments

Comments

@processing-bot
Copy link
Collaborator

Created by: clankill3r

OSX 10.15.7
Processing 4.1.1

void setup() {
  size(600, 600, JAVA2D);
  PGraphics pg1 = createGraphics(600, 600, JAVA2D);
  pg1.beginDraw();
  pg1.background(0);
  pg1.endDraw();
  
  PGraphics pg2 = createGraphics(600, 600, JAVA2D);
  pg2.beginDraw();
  pg2.background(255);
  pg2.copy(pg1, 0, 0, width/2, height/2, 0, 0, width/2, height/2);
  pg2.endDraw();
}

In PGraphicsJava2D we have:

@Override
public void copy(PImage src,
                 int sx, int sy, int sw, int sh,
                 int dx, int dy, int dw, int dh) {
  g2.drawImage((Image) src.getNative(),
               dx, dy, dx + dw, dy + dh,
               sx, sy, sx + sw, sy + sh, null);
}

The cast happens there, (but a fix seems to be more complex then changing the cast there).

@processing-bot
Copy link
Collaborator Author

Created by: benfry

Added a fix for 4.1.2.

@processing-bot
Copy link
Collaborator Author

Created by: github-actions[bot]

This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 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

No branches or pull requests

1 participant