load bitmap from vector
This commit is contained in:
parent
f0316c3205
commit
237102965b
1 changed files with 12 additions and 4 deletions
|
@ -54,6 +54,17 @@ struct Bitmap final {
|
|||
return {.size = size, .data = {values...}};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief creates a bitmap from RGBA Values
|
||||
* @param[in] size extent of bitmap
|
||||
* @param[in] data vector of RGBA values
|
||||
* @return bitmap with data from this call
|
||||
*/
|
||||
static constexpr Bitmap from_data(Size size, std::vector<RGBA> data) noexcept {
|
||||
assert(data.size() == size.height * size.width);
|
||||
return {.size = size, .data = data};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief fills a bitmap uniformly
|
||||
* @param[in] color RGBA value of a color
|
||||
|
@ -87,10 +98,7 @@ struct Bitmap final {
|
|||
return data[y * size.width + x];
|
||||
}
|
||||
|
||||
constexpr void force_change() noexcept
|
||||
{
|
||||
change_count++;
|
||||
}
|
||||
constexpr void force_change() noexcept { change_count++; }
|
||||
|
||||
Size size{.width = 0, .height = 0}; //!< extent of bitmap
|
||||
std::vector<RGBA> data{}; //!< data storage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue