clipStart method

int clipStart(
  1. Slot slot,
  2. ClippingAttachment clip
)

Implementation

int clipStart(Slot slot, ClippingAttachment clip) {
  if (clipAttachment != null) return 0;
  clipAttachment = clip;

  final int n = clip.worldVerticesLength;
  final Float32List vertices = ArrayUtils.copyWithNewArraySize(
      this.clippingPolygon, n, double.infinity) as Float32List;
  clip.computeWorldVertices(slot, 0, n, vertices, 0, 2);
  final Float32List clippingPolygon = this.clippingPolygon as Float32List;
  SkeletonClipping.makeClockwise(clippingPolygon);
  final List<Float32List> clippingPolygons = this.clippingPolygons =
      triangulator.decompose(
          clippingPolygon, triangulator.triangulate(clippingPolygon));

  final int nn = clippingPolygons.length;
  for (int i = 0; i < nn; i++) {
    final Float32List polygon = clippingPolygons[i];
    SkeletonClipping.makeClockwise(polygon);
    polygon
      ..add(polygon[0])
      ..add(polygon[1]);
  }

  return clippingPolygons.length;
}