drawAnnotationsNormalized method Null safety
- Painter painter,
- List<
NormalizedVertex> vertices, - {String color = 'red',
- int thickness = 3}
Draw a box on the supplied Painter around detected object using NormalizedVertex values.
Implementation
static void drawAnnotationsNormalized(
Painter painter, List<NormalizedVertex> vertices,
{String color = 'red', int thickness = 3}) {
for (var index = 0; index < vertices.length - 1; index++) {
final vStart = vertices[index];
final vStop = vertices[index + 1];
painter.drawLine(
(vStart.x * painter.width).toInt(),
(vStart.y * painter.height).toInt(),
(vStop.x * painter.width).toInt(),
(vStop.y * painter.height).toInt(),
RgbColor.name(color),
thickness: thickness);
}
painter.drawLine(
(vertices.last.x * painter.width).toInt(),
(vertices.last.y * painter.height).toInt(),
(vertices.first.x * painter.width).toInt(),
(vertices.first.y * painter.height).toInt(),
RgbColor.name(color),
thickness: thickness);
}