We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d7717e2 commit a201a71Copy full SHA for a201a71
core/src/processing/core/PImage.java
@@ -840,6 +840,15 @@ public void mask(int[] maskArray) { // ignore
840
*/
841
public void mask(PImage img) {
842
img.loadPixels();
843
+ this.loadPixels();
844
+ if (this.pixelWidth != img.pixelWidth || this.pixelHeight != img.pixelHeight) {
845
+ if (this.pixelDensity != img.pixelDensity) {
846
+ throw new IllegalArgumentException("mask() requires the mask image to have the same pixel size after adjusting for pixelDensity.");
847
+ }
848
+ else if (this.width != img.width || this.height != img.height) {
849
+ throw new IllegalArgumentException("mask() requires the mask image to have the same width and height.");
850
851
852
mask(img.pixels);
853
}
854
0 commit comments