drawAnnotations static method Null safety

void drawAnnotations(
  1. Painter painter,
  2. List<Vertex> vertices,
  3. {String color = 'red',
  4. int thickness = 3}
)

Draw a box on the supplied Painter around the detected object using Vertex values.

Implementation

static void drawAnnotations(Painter painter, List<Vertex> vertices,
    {String color = 'red', int thickness = 3}) {
  final topLeft = vertices.first;

  final bottomRight = vertices[2];

  painter.drawRectangle(
    topLeft.x.toInt(),
    topLeft.y.toInt(),
    bottomRight.x.toInt(),
    bottomRight.y.toInt(),
    RgbColor.name(color),
  );
}