17 const int8_t v_inc = v ? -1 : 1;
18 const int8_t v_start = v ? 7 : 0;
20 for (
int y = 0; y < 8; ++y) {
21 const int ry = y * v_inc + v_start;
22 result.rows_[y] = h ?
reverse_bits(rows_[ry]) : rows_[ry];
29 rows_[row] |= (1 << (7 - col));
34 rows_[row] &= ~(1 << (7 - col));
39 return (rows_[row] & (1 << (7 - col))) != 0;
44 return std::ranges::all_of(rows_, [](uint8_t
byte) {
return byte == 0; });
Represents which pixels in an 8x8 tile are non-transparent.
void unset(int row, int col)
Sets the bit at the specified row and column to 0.
ShapeMask flip(bool h, bool v) const
Returns a flipped version of this mask.
bool get(int row, int col) const
Gets the bit value at the specified row and column.
void set(int row, int col)
Sets the bit at the specified row and column to 1.
bool is_transparent() const
Checks if this entire ShapeMask is transparent.
constexpr uint8_t reverse_bits(uint8_t b)
Reverses the bits in a byte.