mask()
Image / PixelsDescription
Applies a mask to a PImage. The mask image is a grayscale image where white pixels are opaque and black pixels are transparent.
Syntax
img.mask(const PImage& m)
Parameters
| Name | Type | Description |
|---|---|---|
| m | PImage | grayscale image to use as mask |
Returns
voidRelated
Under the Hood
From Processing.h:
void mask(const PImage& m) {
for (int i=0; i<width*height && i<(int)m.pixels.size(); i++) {
int a = (m.pixels[i]>>16)&0xFF;
pixels[i] = (pixels[i]&0x00FFFFFF)|(a<<24);
}
dirty = true;
}
void mask(const PImage* m) { if (m) mask(*m); }
void mask(const PImage* m) { if (m) mask(*m);