Suppose we have a vector Graphics
object, along with an arbitrary shape to use as a mask.
drawing =Graphics[{Point@RandomReal[{0,10},{5000,2}]}];
mask = Graphics[{Gray,Polygon[{{0, 5}, {4, 8}, {7, 8}, {9, 4}, {5, 5}, {1, 2}}]}];
Is it possible to use the mask to apply an opacity change or even an opacity gradient while maintaining the vector output of the initial drawing?
This is possible using SetAlphaChannel
, but creates a raster image in the process.
SetAlphaChannel[drawing, mask]