build method

  1. @override
void build(
  1. PdfPage page,
  2. PdfObject<PdfDataType> object,
  3. PdfDict<PdfDataType> params
)
override

Implementation

@override
void build(
  PdfPage page,
  PdfObject object,
  PdfDict params,
) {
  super.build(page, object, params);

  final vertices = List<List<num>>.filled(points.length, <num>[]);
  for (var listIndex = 0; listIndex < points.length; listIndex++) {
    // Flip the points on the Y axis.
    final flippedPoints = points[listIndex]
        .map((e) => PdfPoint(e.x, rect.height - e.y))
        .toList();
    for (var i = 0; i < flippedPoints.length; i++) {
      vertices[listIndex].add(flippedPoints[i].x);
      vertices[listIndex].add(flippedPoints[i].y);
    }
  }

  params['/InkList'] =
      PdfArray(vertices.map((v) => PdfArray.fromNum(v)).toList());
}