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 PGraphicsJava2D.copy() when src is of same class #6013

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thobbs
Copy link

@thobbs thobbs commented Mar 25, 2020

Using copy() a PGraphicsJava2D with a src that is also PGraphicsJava2D will produce the following error:

class sun.java2d.SunGraphics2D cannot be cast to class java.awt.Image

This is due to PGraphicsJava2D.native() returning g2 (a PGraphicsJava2D instance) rather than a java.awt.Image instance, which is what the cast here expects.

I've added specific handling for src being PGraphicsJava2D, as well as general handling of other non-Image results from src.getNative(). I built and tested this solution locally.

@thobbs
Copy link
Author

thobbs commented Mar 25, 2021

Friendly bump after one year - any chance this could be fixed?

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.

None yet

1 participant