getClip method
Returns a description of the clip given that the render object being clipped is of the given size.
Implementation
@override
Path getClip(Size size) {
var h = size.height;
var w = size.width;
Path path = Path();
// Left or Horizontal
path.moveTo(0, 0);
double x = 0;
double y = 0;
double c = w - depth;
double i = h / points;
if (edge == Edge.left || edge == Edge.horizontal || edge == Edge.all) {
while (y < h) {
path.quadraticBezierTo(depth, y + i / 2, 0, y + i);
y += i;
}
}
// Bottom or Vertical
path.lineTo(0, h);
x = 0;
y = h;
c = h - depth;
i = w / points;
if (edge == Edge.bottom || edge == Edge.vertical || edge == Edge.all) {
while (x < w) {
path.quadraticBezierTo(x + i / 2, c, x + i, y);
x += i;
}
}
// Right or Horizontal
path.lineTo(w, h);
x = w;
y = h;
c = w - depth;
i = h / points;
if (edge == Edge.right || edge == Edge.horizontal || edge == Edge.all) {
while (y > 0) {
path.quadraticBezierTo(c, y - i / 2, w, y - i);
y -= i;
}
}
// Top or Vertical
path.lineTo(w, 0);
x = w;
y = 0;
c = h - depth;
i = w / points;
if (edge == Edge.top || edge == Edge.vertical || edge == Edge.all) {
while (x > 0) {
path.quadraticBezierTo(x - i / 2, depth, x - i, 0);
x -= i;
}
}
path.close();
return path;
}