$applyMaskRect method
Applies the current mask to the provided Canvas.
Direct scissor rect masking, more optimized than using
object.mask = DisplayObject
.
You can assign the corners of the GRect
. Works on flutter web html
target.
For example:
myObject.maskRect = GRect(10, 10, 30, 30)..corners.allTo(4);
Will mask the object at the specified rectangle, and use a corner radius of 4 points on every corner. By default GRect has no corners, so is only implemented to make use of RRect clipping.
Implementation
void $applyMaskRect(Canvas? canvas) {
if (maskRect!.hasCorners) {
canvas!.clipRRect(
maskRect!.toRoundNative(),
);
} else {
canvas!.clipRect(
maskRect!.toNative(),
clipOp: maskRectInverted ? ClipOp.difference : ClipOp.intersect,
);
}
}