clipPath method

void clipPath (
  1. Path path,
  2. {bool doAntiAlias: true}
)

Reduces the clip region to the intersection of the current clip and the given Path.

If doAntiAlias is true, then the clip will be anti-aliased.

If multiple draw commands intersect with the clip boundary, this can result multiple draw commands intersect with the clip boundary, this can result in incorrect blending at the clip boundary. See saveLayer for a discussion of how to address that.

Implementation

void clipPath(Path path, {bool doAntiAlias = true}) {
  // ignore: unnecessary_null_comparison
  assert(path != null); // path is checked on the engine side
  assert(doAntiAlias != null); // ignore: unnecessary_null_comparison
  _clipPath(path, doAntiAlias);
}