FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   Double mask
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Double mask  (Read 287 times)
gabon

WWW
Double mask
« on: Jul 12th, 2004, 3:22pm »

Does someone know how to emulate a double mask? With this sintax instead to add the second one it takes just the last one:
 
Code:

  size(400, 150);
  BImage img = loadImage("numeri.jpg");
  BImage alphaImg = loadImage("numeri_mask.jpg");
  img.alpha(alphaImg);
  BImage alphaImg_1 = loadImage("mask_1.jpg");
  img.alpha(alphaImg_1);
  image(img, 0, 0);

 
Thx, chr
 
narain


Re: Double mask
« Reply #1 on: Jul 12th, 2004, 6:15pm »

I think using two masks is the same as multiplying the masks (Photoshop's Multiply layer mode) and masking with the result.
Maybe blend() will help, though I have no idea how to call it with all those arguments. If all else fails, you can always multiply the blends yourself, pixel-by-pixel (and divide by 255 to bring the result back into range).
 
toxi_
Guest
Email
Re: Double mask
« Reply #2 on: Jul 13th, 2004, 4:14pm »

as it has been already pointed out, using blend() is probably the most convenient way to go for merging several alpha channels into one. you'll always need to do that before applying the finished mask to an image as the alpha() function will totally overwrite the image's alpha channel and wipe any previous alpha information.
 
http://www.toxi.co.uk/p5/masks/
 
this little demo shows how to some basic boolean operations (eg. add and subtract) on two separate masks. use the mouse to change the background colour for better understanding...
 
hth!
 
Pages: 1 

« Previous topic | Next topic »