How to paint fully transparent pixels/points in P2D mode?
- by netzwerg
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?