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_
   Bugs
   Bug Fixes, Implemented Suggestions
(Moderator: fry)
   making color-objects with alpha (and the hack)
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: making color-objects with alpha (and the hack)  (Read 267 times)
mKoser

WWW Email
making color-objects with alpha (and the hack)
« on: Mar 31st, 2003, 9:19pm »

i have been playing a bit with alpha-values and colors, and have found a misbehavior of P5 (win2k - 0052):
 
consider the following code:
 
//////////////////////////////////////////////
// example : http://www.beyondthree.com/p5_dev/colorObj_bug/
 
color a;
color b;
int W = 300;
int H = 300;
 
void setup(){
  size(300, 300);
  a = color(255, 100, 0);
  
  // "Cannot find method color(int, int, int, int)"
  //b = color(255, 100, 0, 50);                  
}
 
void loop(){
  rect(50, 50, 200, 200);
 
  fill(a, 50);                                    
  rect(0, 0, mouseX, mouseY);
 
  fill(a);
  rect(W, H, mouseX-W, mouseY-H);
}
///////////////////////////////////////
 
when defining a new color, you have to use this syntax:
a = color(int, int, int);
 
you cannot define the alpha at this stage. but this can we worked around when assigning the color:
 
fill(a, 50);
 
but, the result of this is a 50% alpha grey - NOT orange (as in the example code above)... I guess this is a bug?
 
besides that, it would be nice to be able to define colors WITH alpha:
 
a = color(R, G, B, A);
 
cheers,
* mikkel *
« Last Edit: Mar 31st, 2003, 9:21pm by mKoser »  

mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
fry


WWW
Re: making color-objects with alpha (and the hack)
« Reply #1 on: Apr 2nd, 2003, 3:25am »

fill() with two params is for grayscale with an alpha level, thus the gray, so that's not a bug, 'cept that it's too bad that isn't more obvious.
 
color(r, g, b, a) will be in the next rev. it was an oversight for this one (that's what we mean when we said the alpha stuff was inconsistent )
 
mKoser

WWW Email
Re: making color-objects with alpha (and the hack)
« Reply #2 on: Apr 2nd, 2003, 11:51am »

ahh i see - i knew that alpha was in (duh!) alpha-stage so i didn't count on everything being implemented yet... but the greyscale stuff makes sense now!
 

mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
fry


WWW
Re: making color-objects with alpha (and the hack)
« Reply #3 on: Apr 4th, 2003, 5:02pm »

alright, color(r, g, b, a) is now in rev 53, available soon.
 
Pages: 1 

« Previous topic | Next topic »