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);

  // Flip the points on the Y axis.
  final flippedPoints =
      points.map((e) => PdfPoint(e.x, rect.height - e.y)).toList();

  final vertices = <num>[];
  for (var i = 0; i < flippedPoints.length; i++) {
    vertices.add(flippedPoints[i].x);
    vertices.add(flippedPoints[i].y);
  }

  params['/Vertices'] = PdfArray.fromNum(vertices);

  if (interiorColor != null) {
    params['/IC'] = PdfArray.fromColor(interiorColor!);
  }
}