Blendmode transparency

Hello. I was trying to make a custome blendMode so that things are only draw if there is something underneath, so for example in this code:

ellipse(200, 200, 50)
blendMode(custom)
text("something long-ish")

the text that goes off the ellipse would not show at all.

I have played a bit with the custom parameters, but could not find a working arrangement.

Does anyone know if there is a possible way?

You could only do this on an image, I think, because on the screen then there is always something underneath.

try this

function setup()
end
function draw()
    background(0,0)
    fill(255, 0, 0, 255)
    ellipse(300,300,200,100)
    blendMode( DST_ALPHA, ONE_MINUS_SRC_ALPHA )
    fill(53, 255, 0, 255)
    fontSize(40)
    text("HELLO WORLD",300,300)
    blendMode(NORMAL)
end

Note the background must have alpha 0 and be black

I stand (sit) corrected! Nice detective work.

@Jmv38, this is incredible, thank you so much.

:wink: :smiley: