Apply a mask onto and visual.rect stimuli


I would like to know if there is a simple way to apply a mask on a drawn circle ( or rectangle (visual.rect)…, similar as one can do with a grating (visual.GratingStim) with the GratingStim.mask attribute. There one can pass a 2D numpy array to choose any shape. However, that attribute does not exist for circles or rectangles.
Any ideas?

My alternative strategy is to draw other stimuli (setting the color to black for example) to act as a mask around my circle or rectangle, but this seems to be a not so elegant solution. Has someone tried something similar?

Thanks for any response in advance