Restricts rendering area within the [width, height]
rectangle.
For more advanced masking, see h2d.filter.AbstractMask
.
Rotation of the mask does not rotate the masked area and instead causes it to cover the bounding box of the mask.
The Mask.maskWidth
and Mask.unmask
can be used to mask out rendering area without direct usage of Mask instance in-between.
Static methods
staticmaskWith(ctx:RenderContext, object:Object, width:Int, height:Int, scrollX:Float = 0, scrollY:Float = 0):Void
Masks render zone based off object position and given dimensions.
Should call Mask.unmask()
afterwards.
Parameters:
ctx | The render context to mask. |
---|---|
object | An Object which transform will be used as mask origin. |
width | The width of the mask in scene coordinate space. |
height | The height of the mask in scene coordinate space. |
scrollX | Additional horizontal offset of the masked area. |
scrollY | Additional vertical offset of the masked area. |
staticunmask(ctx:RenderContext):Void
Constructor
new(width:Int, height:Int, ?parent:Object)
Create a new Mask instance.
Parameters:
width | The width of the masked area. |
---|---|
height | The height of the masked area. |
parent | An optional parent |
Variables
scrollX:Float = 0
Horizontal scroll offset of the Mask content in pixels. Can be clamped by Mask.scrollBounds
.
scrollY:Float = 0
Vertical scroll offset of the Mask content in pixels. Can be clamped by Mask.scrollBounds
.
Methods
scrollBy(x:Float, y:Float):Void
Scroll the Mask content by the specified offset relative to the current scroll offset.