mirroredHorizontally property
BlurHash
get
mirroredHorizontally
Mirrors the BlurHash horizontally.
Implementation
BlurHash get mirroredHorizontally {
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] * (i % 2 == 0 ? 1 : -1);
}
}
return BlurHash.components(mirroredComponents);
}