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)
   alpha()?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: alpha()?  (Read 249 times)
madmerv
Guest
Email
alpha()?
« on: Dec 18th, 2003, 4:01pm »

Hey -- is there an alpha() function in proce55ing that is undocumented?
 
toxi

WWW
Re: alpha()?
« Reply #1 on: Dec 18th, 2003, 7:57pm »

alpha() is a (still) undocumented method of the BImage object to set the alpha channel of an image. a very basic demo of it is here:
 
http://www.toxi.co.uk/p5/imagePatterns/
 
note, that all the syntax is not yet finalised and undocumented. source should work with rev.66 or newer...
 
now, back into lurker mode...
 

http://toxi.co.uk/
michael05

WWW
Re: alpha()?
« Reply #2 on: Dec 25th, 2003, 9:30pm »

hi
 
isn t there a more simple way to use alpha channels?
 
i tried to mask an image this way:
 
--------
  lego = loadImage("lego.jpg");
  legoAlpha = new BImage (lego.pixels, lego.width, lego.height, ALPHA);
  legoAlpha.format = ALPHA;
   
  for (int i=0; i<lego.pixels.length-1; i++)
  {
    if (red(lego.pixels[i]) < 5)
    {
 legoAlpha.pixels[i] = 255;
    }
  }
  lego.alpha(legoAlpha);
 
  hintergrund = loadImage("hintergrund.jpg");
   
  background(hintergrund);
  image(lego, 0, 0);
  image(legoAlpha, 0, 0);
 
it does not really work. the unmasked park shows up distorted. when i uncomment "image(legoAlpha, 0, 0);" only the mask is showing up.
 

°°°°°°°°°°°°°°°°°°°°
http://www.m05.de
toxi

WWW
Re: alpha()?
« Reply #3 on: Dec 29th, 2003, 12:34pm »

okay, in this case that means the latest version of the BImage class was not yet in CVS when rev67 was built. you can manually fix the format of the "lego" image by inserting the following line after calling the alpha() function:
 
lego.format=RGBA;
 
but again, this is only a temporarily needed fix for a still undocumented function
 

http://toxi.co.uk/
Pages: 1 

« Previous topic | Next topic »