netatmo-algo/src/mask.cpp

35 lines
626 B
C++

#include "mask.h"
#include <cassert>
#include <cstring>
namespace freling {
Mask::Mask(uint32_t width, uint32_t height) : width(width), height(height) {
data.resize(width * height, true);
}
void Mask::fill(bool value) {
for (int i = 0, size = data.size(); i < size; ++i) {
data[i] = value;
}
}
void Mask::set(int x, int y, bool value) {
assert(x < width);
assert(y < height);
const int i = x + y * width;
data[i] = value;
}
bool Mask::get(int x, int y) {
assert(x < width);
assert(y < height);
const int i = x + y * width;
return data[i];
}
} // namespace freling