addMissingRows method
Implementation
BoundingBox addMissingRows(
int missingStartRows,
int missingEndRows,
bool isLeft,
) {
ResultPoint newTopLeft = _topLeft;
ResultPoint newBottomLeft = _bottomLeft;
ResultPoint newTopRight = _topRight;
ResultPoint newBottomRight = _bottomRight;
if (missingStartRows > 0) {
final top = isLeft ? _topLeft : _topRight;
int newMinY = top.y.toInt() - missingStartRows;
if (newMinY < 0) {
newMinY = 0;
}
final newTop = ResultPoint(top.x, newMinY.toDouble());
if (isLeft) {
newTopLeft = newTop;
} else {
newTopRight = newTop;
}
}
if (missingEndRows > 0) {
final bottom = isLeft ? _bottomLeft : _bottomRight;
int newMaxY = bottom.y.toInt() + missingEndRows;
if (newMaxY >= _image.height) {
newMaxY = _image.height - 1;
}
final newBottom = ResultPoint(bottom.x, newMaxY.toDouble());
if (isLeft) {
newBottomLeft = newBottom;
} else {
newBottomRight = newBottom;
}
}
return BoundingBox(
_image,
newTopLeft,
newBottomLeft,
newTopRight,
newBottomRight,
);
}