rotate90 method
void
rotate90()
Modifies this BitMatrix
to represent the same but rotated 90 degrees counterclockwise
Implementation
void rotate90() {
final newWidth = _height;
final newHeight = _width;
final newRowSize = (newWidth + 31) ~/ 32;
final newBits = Uint32List(newRowSize * newHeight);
for (int y = 0; y < _height; y++) {
for (int x = 0; x < _width; x++) {
final offset = y * _rowSize + (x ~/ 32);
if (((_bits[offset] >>> (x & 0x1f)) & 1) != 0) {
final newOffset = (newHeight - 1 - x) * newRowSize + (y ~/ 32);
newBits[newOffset] |= 1 << (y & 0x1f);
}
}
}
_width = newWidth;
_height = newHeight;
_rowSize = newRowSize;
_bits = newBits;
}