forked from Hartmut/paradiso
we can see a quad
This commit is contained in:
parent
612677c52d
commit
ddc0f85805
10 changed files with 261 additions and 140 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue