I just committed a (hopefully!) exciting new feature to the GitHub repository: Stencil Masks!
How better to describe masks than with a quick source code sample? 😉
import starling.display.Canvas; // NEW!
var mask:Canvas = new Canvas();
mask.drawCircle(0, 0, 120);
var myContent:DisplayObject = ...;
myContent.mask = mask;
As you can see, that's rather easy to use. The new "Canvas" class allows you to draw simple geometric shapes like circles, ellipses, rectangles or custom polygons. (There's also a new "Polygon" class for the pure mathematical representation of such polygons.)
[BTW, the watchful reader might have noticed that the Canvas class lays the foundation for more vector features in the future. 😉]
You can use any object as a mask, including e.g. Quads and Images. However, beware that the color and alpha value of the mask object is *not* taken into account, so an image with lots of transparency will still yield a rectangular mask.
The advantage of stencil masks is that they are very lightweight; e.g. they do not require any additional texture memory. You need two draw-calls per mask (one to draw the mask to the stencil buffer and one to erase it).
The disadvantage: a stencil mask is strictly binary, i.e. a pixel is either drawn or it's not. For soft masking, you still need the "Pixelmask" extension (or something similar).
I'd be happy if some of you could try out that new feature and tell me what you think about it! If you've got any suggestions or find a bug, please let me know.
Have fun! 😃
EDIT: one more thing - in order for masks to show up in an AIR application, you have to enable the 'depthAndStencil' flag in the application descriptor.
EDIT: I renamed the "Shape" class to "Canvas", and updated the sample and text above accordingly.