18 static inline u32
bytepos(u32 index) {
return index >> 3; }
19 static inline u8
bitpos(u32 index) {
return index & 7; }
21 template<
bool set,
bool toggle,
bool clear>
25 u8 mask = 1 <<
bitpos(index);
31 else if constexpr (clear)
62 std::fill(
data.begin(),
data.end(), value ? 0xff : 0);
65 inline bool get(u32
x, u32
y)
const
76 inline bool all()
const
79 return (assert(0),
true);
80 for (u32 i = 0; i <
data.size() - 1; i++) {
84 u8 last_byte =
data.back();
86 if (!(last_byte & (1 << i)))
Rudimentary header-only 2D bitmap class.
Definition bitmap.h:14
void set(u32 x, u32 y)
Definition bitmap.h:71
void reset(bool value)
Definition bitmap.h:60
u32 lines
Definition bitmap.h:15
void unset(u32 x, u32 y)
Definition bitmap.h:72
static u8 bitpos(u32 index)
Definition bitmap.h:19
bool all() const
Returns true if all bits in the bitmap are set.
Definition bitmap.h:76
u32 width() const
Definition bitmap.h:47
bool get(u32 x, u32 y) const
Definition bitmap.h:65
u32 linesize
Definition bitmap.h:15
u32 height() const
Definition bitmap.h:48
bool toggle(u32 x, u32 y)
Definition bitmap.h:73
Bitmap(u32 width, u32 height)
Create a new zero-filled bitmap.
Definition bitmap.h:42
Bitmap()
Create an empty bitmap.
Definition bitmap.h:39
static u32 bytepos(u32 index)
Definition bitmap.h:18
bool modify_(u32 x, u32 y)
Definition bitmap.h:22
void resize(u32 width, u32 height, bool initial_value=false)
Definition bitmap.h:50
std::vector< u8 > data
Definition bitmap.h:16
constexpr v3f x
Definition test_irr_matrix4.cpp:18
constexpr v3f y
Definition test_irr_matrix4.cpp:19