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.
2 parents 6b906c2 + bf58dc1 commit 2de754aCopy full SHA for 2de754a
core/src/processing/core/PImage.java
@@ -866,6 +866,14 @@ public void mask(int[] maskArray) { // ignore
866
*/
867
public void mask(PImage img) {
868
img.loadPixels();
869
+ if (this.pixelWidth != img.pixelWidth || this.pixelHeight != img.pixelHeight) {
870
+ if (this.pixelDensity != img.pixelDensity) {
871
+ throw new IllegalArgumentException("mask() requires the mask image to have the same pixel size after adjusting for pixelDensity.");
872
+ }
873
+ else if (this.width != img.width || this.height != img.height) {
874
+ throw new IllegalArgumentException("mask() requires the mask image to have the same width and height.");
875
876
877
mask(img.pixels);
878
}
879
0 commit comments