openOp method

void openOp(
  1. Uint8List newByte,
  2. int width,
  3. Rect rect,
  4. int offset,
)

Implementation

void openOp(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 avage = 0;
      int min = 256;
      for (int y_ = stepH; y_ < stepH + stepY; y_++) {
        for (int x_ = stepW; x_ < stepW + stepX; x_++) {
          if (newByte[y_ * width + x_] < 150) count++;
          //avage += newByte[y_ * width + x_];
          if (newByte[y_ * width + x_] < min) {
            min = newByte[y_ * width + x_];
          }
        }
      }
      if (count == 0) {
        continue;
      }
      //avage ~/= stepY * stepX;
      for (int y_ = stepH; y_ < stepH + stepY; y_++) {
        for (int x_ = stepW; x_ < stepW + stepX; x_++) {
          newByte[y_ * width + x_] = (min ~/ 5 * 4);
        }
      }
    }
  }
}