linearPath static method

OpSet linearPath(
  1. List<PointD> points,
  2. bool close,
  3. DrawConfig config
)

Implementation

static OpSet linearPath(List<PointD> points, bool close, DrawConfig config) {
  final int len = (points).length;
  if (len > 2) {
    List<Op> ops = [];
    for (int i = 0; i < len - 1; i++) {
      ops += OpsGenerator.doubleLine(
          points[i].x, points[i].y, points[i + 1].x, points[i + 1].y, config);
    }
    if (close) {
      ops += OpsGenerator.doubleLine(points[len - 1].x, points[len - 1].y,
          points[0].x, points[0].y, config);
    }
    return OpSet(type: OpSetType.path, ops: ops);
  } else if (len == 2) {
    return buildLine(
        points[0].x, points[0].x, points[1].x, points[1].x, config);
  } else {
    return OpSet(type: OpSetType.path, ops: []);
  }
}