How to paint fully transparent pixels/points in P2D mode?
Posted
by netzwerg
on Stack Overflow
See other posts from Stack Overflow
or by netzwerg
Published on 2010-02-25T11:48:02Z
Indexed on
2010/06/11
0:02 UTC
Read the original article
Hit count: 480
According to the Processing Reference, stroke(gray, alpha)
allows to set the color and opacity of the stroke. With the default color mode, an alpha value of 255 denotes full opacity, while a value of 0 should correspond to complete transparency. While this works with the (default) JAVA2D renderer, I can't seem to paint fully transparent points in P2D mode.
This code clearly renders a pixel at the center of the canvas, even though the alpha value is set to 0 (fully transparent):
public class Transparency extends PApplet {
@Override
public void setup() {
size(200, 200, P2D);
}
@Override
public void draw() {
stroke(0, 0);
point(width / 2, height / 2);
}
public static void main(String[] args) {
PApplet.main(new String[] { Transparency.class.getSimpleName() });
}
}
What's wrong here?
© Stack Overflow or respective owner