Created by: hx2A
Description
For this code:
void setup() {
size(400, 400, P2D);
// create a simple image with only red pixels
PImage red_img = createImage(50, 50, RGB);
color red = color(255, 0, 0);
red_img.loadPixels();
for (int i = 0; i < red_img.pixels.length; i++) {
red_img.pixels[i] = red;
}
red_img.updatePixels();
// first red square
image(red_img, 50, 50);
// second red square, but only appears for P2D renderer
copy(red_img, 0, 0, 50, 50, 250, 250, 50, 50);
}
When using the P2D renderer I see two red squares. When using the default renderer I see one. The copy function does not work correctly when the first parameter is a PImage object and I use the JAVA2D renderer.
Expected Behavior
I expect the copy function to work the same for the JAVA2D and P2D renderers.
Current Behavior
This bug appears in 4.0a3 but not in 3.5.4.
Steps to Reproduce
- Run the above code
- Change the above code to use the default renderer
- Run code again, observing the difference
Your Environment
Possible Causes / Solutions
Not sure, the relevant code in PGraphicsJava2D did not change from 3.5.4 to 4.0a3:
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);
}
Created by: hx2A
Description
For this code:
When using the P2D renderer I see two red squares. When using the default renderer I see one. The
copyfunction does not work correctly when the first parameter is a PImage object and I use the JAVA2D renderer.Expected Behavior
I expect the copy function to work the same for the JAVA2D and P2D renderers.
Current Behavior
This bug appears in 4.0a3 but not in 3.5.4.
Steps to Reproduce
Your Environment
Linux main 5.10.9-201.fc33.x86_64 [PR] Java 11, OpenJDK, ANTLR 4, and Travis - [merged] #1 SMP Wed Jan 20 16:56:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Fedora release 33 (Thirty Three)
Possible Causes / Solutions
Not sure, the relevant code in PGraphicsJava2D did not change from 3.5.4 to 4.0a3: