Hello,
I would like to draw a text on a transparent image (buffer). I can set the buffer transparent, but when rendering, every letter of my text has no-alpha (i.e. alpha = 1.0) background.
My code is like this:
Code:
PGraphics txtBuff;
PFont font;
void setup() {
size(400, 200);
font = loadFont("somefont.vlw");
txtBuff = createGraphics(width, height, P3D);
}
void draw() {
background(255, 0, 0); // Red
txtBuff.beginDraw();
txtBuff.background(0, 0); // Black background, transparent
txtBuff.textFont(font, 48);
txtBuff.fill(0, 255, 0); // Green text
txtBuff.text("Hello, World!", 100, 100);
txtBuff.textFont(font, 40);
txtBuff.fill(0, 0, 255); // Blue text
txtBuff.text("Hello, World!", 100, 120);
txtBuff.endDraw();
image(txtBuff, 0, 0);
}
The result is a red background with the two texts over it, but the two text (which are correctly rendered one over the other), have a black background.
How can I preserve background transparency under the letters?
Thanks
~Ale