Mask class

A Mask describes a geometric shape to show only a portion of a DisplayObject. Pixels inside of the shape are visible and pixels outside of the shape are invisible.

The mask is placed relative to the DisplayObject where it is applied to. However, you can set the relativeToParent property to true to placed the mask relativ to the DisplayObjects parent.

Example:

var rifleScope = new Sprite();
rifleScope.mask = new Mask.circle(0, 0, 50);
rifleScope.addChild(world);
Implemented types

Constructors

Mask()
Mask.circle(num x, num y, num radius)
Create a circular mask.
factory
Mask.custom(List<Point<num>> points)
Create a custom mask with a polygonal shape defined by points.
factory
Mask.graphics(Graphics graphics)
Create a custom mask defined by a Graphics object.
factory
Mask.rectangle(num x, num y, num width, num height)
Create a rectangular mask.
factory
Mask.shape(Shape shape)
Create a custom mask defined by a Shape object.
factory

Properties

border ↔ bool
read / write, override-getter
borderColor ↔ int
read / write, override-getter
borderWidth ↔ int
read / write, override-getter
relativeToParent ↔ bool
Set to true to place the Mask relative to the DisplayObjects parent. The default value is false and therefore the mask is placed relative to the DisplayObject where it is applied to.
read / write, override-getter
transformationMatrix Matrix
You can use the transformationMatrix to change the size, position, scale, rotation etc. from the Mask.
final
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

hitTest(num x, num y) → bool
renderMask(RenderState renderState) → void
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited