|
Author |
Topic: do points have color? (Read 271 times) |
|
kevinP
|
do points have color?
« on: May 25th, 2004, 6:35pm » |
|
Hi all, I noticed that points will be drawn with the stroke() color, but that alpha is not supported; I also noticed that using noStroke() has no effect on visibility of points. Is there a reason for this, or is it just that I am doing something strange? Code: color cl = color(50, 150, 50, 10); stroke(cl); noStroke(); noFill(); for (int i = 15; i < width-15; i++) { point(i, height/2); } |
| Also here with pixels[], shouldn't I see some transparency from the alpha value? Code: color cl = color(250, 150, 50, 10); stroke(cl); for (int i = 15; i < width-15; i++) { point(width/2, i); } for (int i=0; i<width*height/2; i++) { color clr = color(50, 190, 80, 20); pixels[i] = clr; } |
| -Kevin
|
Kevin Pfeiffer
|
|
|
TomC
|
Re: do points have color?
« Reply #1 on: May 25th, 2004, 10:10pm » |
|
That is a bit strange about point() - it happens with beginShape(POINTS) too. Not sure why. If you want alpha points, you can use line(x,y,x,y) instead though: Code: color cl = color(50, 150, 50, 10); stroke(cl); //noStroke(); noFill(); for (int i = 15; i < width-15; i++) { line(i, height/2, i, height/2); } |
| Regarding your pixels query, I think pixels[] is the actual array of values which will be written to the screen. So, if a pixel has an alpha value it will be ignored because there isn't a colour to blend it with. The alpha value in BImage.pixels[] will work, of course, so you could write to that and then draw the image on the screen to get the effect you want.
|
|
|
|
JohnG
|
Re: do points have color?
« Reply #2 on: May 26th, 2004, 12:09pm » |
|
pixels[] doesn't support alpha channel, because it contains the value which is actually drawn on the screen, e.g. if you have a white image, then draw a 50% transparent black pixel with set() or similar, the pixels[] value will be 50% grey, not black with 50% transparency. So if you want to use pixels[] and transparency, you'll have to do the alpha maths yourself. Or you could just use set(x,y,colour); where colour can include an alpha value, and it'll work it out for you.
|
|
|
|
|