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.
bool is_transparent() const
Checks if this entire ShapeMask is transparent.
ShapeMask flip(bool h, bool v) const
Returns a flipped version of this mask.
void unset(std::size_t row, std::size_t col)
Sets the bit at the specified row and column to 0.
bool get(std::size_t row, std::size_t col) const
Gets the bit value at the specified row and column.
void set(std::size_t row, std::size_t col)
Sets the bit at the specified row and column to 1.
constexpr uint8_t reverse_bits(uint8_t b)
Reverses the bits in a byte.