/** * Set alpha channel for an image using another image as the source. */ public void mask(PImage alpha) { if (alpha.pixels == null) { // if pixels haven't been loaded by the user, then only load them // temporarily to save memory when finished. alpha.loadPixels(); mask(alpha.pixels); alpha.pixels = null; } else { mask(alpha.pixels); } }
mask(img.pixels);
rgb.mask(mask); image(rgb, context.depthWidth() + 10, 0);
image(mask, 0, 0); PImage rgb = context.rgbImage(); rgb.mask(mask); image(mov, context.depthWidth() + 10, 0); image(rgb, context.depthWidth() + 10, 0);
redCasted.mask(mask);
temp.mask(mask);
temp.mask(mask);