How to mask ofGraphics with ofGraphics

How to mask ofGraphics with ofGraphics?

I’m really confused about it… so I post.

In the alphaMaskingShaderExample, it mask image with image.
But I wanna mask ofGraphics (like ofDraw~) with ofGraphics (ex. filled rect but some part of it has alpha)

You can use ofFbo. Draw whatever you want inside the ofFbo, the same for the second ofFbo as a mask. Then you can use something like this:

    ofFbo fbo1;
	// draw fbo1
	
	ofFbo fbo2;
	// draw fbo2
	
	fbo1.getTexture().setAlphaMask(fbo2.getTexture());

Thank you for your reply.
But I’d like to subtract the graphic from the graphic (ex. like framed rectangle, donuts).