transposed property

BlurHash get transposed

Transposes the BlurHash.

Implementation

BlurHash get transposed {
  final numCompX = components[0].length;
  final numCompY = components.length;
  final transposedComponents = List.generate(
    numCompX,
    (i) => List<ColorTriplet>.filled(numCompY, ColorTriplet(0, 0, 0)),
  );
  for (var j = 0; j < numCompY; j++) {
    for (var i = 0; i < numCompX; i++) {
      transposedComponents[i][j] = components[j][i];
    }
  }
  return BlurHash.components(transposedComponents);
}