we can see a quad

This commit is contained in:
Hartmut Seichter 2023-06-30 22:05:23 +02:00
parent 612677c52d
commit ddc0f85805
10 changed files with 261 additions and 140 deletions

View file

@ -7,13 +7,24 @@
#include <type_traits>
#include <vector>
#include <cassert>
namespace paradiso {
struct Bitmap final {
constexpr static Bitmap create(Size size) noexcept {
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;