Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions core/src/processing/awt/PGraphicsJava2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -3001,9 +3001,24 @@ public void copy(int sx, int sy, int sw, int sh,
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);

if (src instanceof PGraphicsJava2D) {
// getNative() returns g2 for this class, need to use getImage() instead
g2.drawImage(src.getImage(),
dx, dy, dx + dw, dy + dh,
sx, sy, sx + sw, sy + sh, null);
} else {
// normally we can use getNative()
Object srcImage = src.getNative();
if (srcImage instanceof Image) {
g2.drawImage((Image) srcImage,
dx, dy, dx + dw, dy + dh,
sx, sy, sx + sw, sy + sh, null);
} else {
// fall back to using PImage.blend() with REPLACE mode
super.copy(src, sx, sy, sw, sh, dx, dy, dw, dh);
}
}
}


Expand Down