mirroredVertically property

BlurHash get mirroredVertically

Mirrors the BlurHash vertically.

Implementation

BlurHash get mirroredVertically {
  final numCompX = components[0].length;
  final numCompY = components.length;
  final mirroredComponents = List.generate(
    numCompY,
    (i) => List<ColorTriplet>.filled(numCompX, ColorTriplet(0, 0, 0)),
  );
  for (var j = 0; j < numCompY; j++) {
    for (var i = 0; i < numCompX; i++) {
      mirroredComponents[j][i] = components[j][i] * (j % 2 == 0 ? 1 : -1);
    }
  }
  return BlurHash.components(mirroredComponents);
}