closeOp method
Implementation
void closeOp(Uint8List newByte, int width, Rect rect, int offset) {
for (int stepH = rect.top + offset;
stepH + stepY < rect.bottom;
stepH += stepY) {
for (int stepW = rect.left + offset;
stepW + stepX < rect.right;
stepW += stepX) {
int count = 0;
int max = 0;
for (int y_ = stepH; y_ < stepH + stepY; y_++) {
for (int x_ = stepW; x_ < stepW + stepX; x_++) {
if (newByte[y_ * width + x_] < 150) count++;
if (newByte[y_ * width + x_] > max) {
max = newByte[y_ * width + x_];
}
}
}
if (count > stepX * stepY / 2) {
continue;
}
for (int y_ = stepH; y_ < stepH + stepY; y_++) {
for (int x_ = stepW; x_ < stepW + stepX; x_++) {
newByte[y_ * width + x_] = max;
}
}
}
}
}