parse static method

BitMatrix parse(
  1. Object image, [
  2. String a = '',
  3. String b = ''
])

Interprets a 2D array of booleans as a BitMatrix, where "true" means an "on" bit.

@param image bits of the image, as a row-major 2D array. Elements are arrays representing rows @return BitMatrix representation of image

Implementation

static BitMatrix parse(Object image, [String a = '', String b = '']) {
  if (image is String) {
    return _parseString(image, a, b);
  }
  image = image as List<List<bool>>;
  final height = image.length;
  final width = image[0].length;
  final bits = BitMatrix(width, height);
  for (int i = 0; i < height; i++) {
    final imageI = image[i];
    for (int j = 0; j < width; j++) {
      if (imageI[j]) {
        bits.set(j, i);
      }
    }
  }
  return bits;
}