topical media & game development

talk show tell print

graphic-processing-site-examples-Basics-Image-Alphamask-Alphamask.pde / pde



  
Alpha Mask. Loads a "mask" for an image to specify the transparency in different parts of the image. The two images are blended together using the mask() method of PImage.

  
   
  PImage img;
  PImage maskImg;
  
  void setup() 
  {
    size(200,200);
    img = loadImage("test.jpg");
    maskImg = loadImage("mask.jpg");
    img.mask(maskImg);
  }
  
  void draw() 
  {
    background((mouseX+mouseY)/1.5);
    image(img, 50, 50);
    image(img, mouseX-50, mouseY-50);
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.