Skip to content
Merged
Changes from 1 commit
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
9 changes: 9 additions & 0 deletions core/src/processing/core/PImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,15 @@ public void mask(int[] maskArray) { // ignore
*/
public void mask(PImage img) {
img.loadPixels();
this.loadPixels();
if (this.pixelWidth != img.pixelWidth || this.pixelHeight != img.pixelHeight) {
if (this.pixelDensity != img.pixelDensity) {
throw new IllegalArgumentException("mask() requires the mask image to have the same pixel size after adjusting for pixelDensity.");
}
else if (this.width != img.width || this.height != img.height) {
throw new IllegalArgumentException("mask() requires the mask image to have the same width and height.");
}
}
mask(img.pixels);
}

Expand Down