That’s a great question!
You could install from the IDE the Geomerative library that can do SVG and “RShape” clipping and intersections. (RShape is a vector object for the lib).
shp1 = RG.loadShape("Toucan.svg");
shp2 = RShape.createStar(0, 0, 100.0, 80.0, 20);
cursorShape = new RShape(shp2);
cursorShape.translate(mouseX - width/2, mouseY - height/2);
// Only intersection() does not work for shapes with more than one path
shp3 = RG.intersection( shp1, cursorShape );
strokeWeight( 3 );
fill( 0 , 220 , 0 , 30 );
stroke( 0 , 120 , 0 );
fill( 220 , 0 , 0 , 30 );
stroke( 120 , 0 , 0 );
fill( 220 );
stroke( 120 );
I really wish there would be a simpler way. I have found some poly clipping libraries I thought I could adapt, but they are horribly broken (watch me crash here Boolean operation in polygons)