forked from Hartmut/paradiso
reorganized repo to show clear module boundaries
This commit is contained in:
parent
8e00b668ea
commit
536a639bfd
396 changed files with 355 additions and 391 deletions
|
@ -1,47 +0,0 @@
|
|||
#ifndef PARADISO_BITMAP_HPP
|
||||
#define PARADISO_BITMAP_HPP
|
||||
|
||||
#include "geometry.hpp"
|
||||
#include "globals.hpp"
|
||||
#include "rgba.hpp"
|
||||
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
||||
namespace paradiso {
|
||||
struct Bitmap final {
|
||||
|
||||
constexpr static Bitmap empty(Size size) noexcept {
|
||||
return {.size = size, .data = std::vector<RGBA>{size.area()}};
|
||||
}
|
||||
|
||||
template <typename... Arguments>
|
||||
static constexpr Bitmap from_data(Size size, Arguments... values) noexcept {
|
||||
assert(sizeof...(Arguments) == size.height * size.width);
|
||||
return {
|
||||
.size = size,
|
||||
.data = {values...}
|
||||
};
|
||||
}
|
||||
|
||||
constexpr auto fill(const RGBA& color) noexcept {
|
||||
std::fill(data.begin(), data.end(), color);
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr RGBA& pixel(std::integral auto x, std::integral auto y) {
|
||||
return data[y * size.width + x];
|
||||
}
|
||||
|
||||
constexpr const RGBA& pixel(std::integral auto x,
|
||||
std::integral auto y) const {
|
||||
return data[y * size.width + x];
|
||||
}
|
||||
|
||||
Size size{.width = 0, .height = 0};
|
||||
std::vector<RGBA> data{};
|
||||
};
|
||||
} // namespace paradiso
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue