21 static constexpr std::uint32_t bytes_per_pixel = 4u;
27 static_cast<void>(load(filesystem, asset_path));
30 explicit Bitmap(
const glm::uvec2& size)
32 static_cast<void>(resize(size));
35 Bitmap(
const glm::uvec2& size, std::vector<std::uint8_t> pixels)
37 static_cast<void>(replace_rgba8(size, std::move(pixels)));
44 [[nodiscard]]
bool write(
const std::filesystem::path& path)
const;
46 explicit operator bool()
const noexcept
48 return has_valid_storage();
51 [[nodiscard]] std::size_t byte_length()
const noexcept
56 void clear()
noexcept;
58 [[nodiscard]]
const std::string& filename()
const noexcept
63 [[nodiscard]]
const std::vector<std::uint8_t>& data()
const noexcept
68 [[nodiscard]] std::span<std::uint8_t> mutable_data()
noexcept
73 [[nodiscard]]
const glm::uvec2& size()
const noexcept
78 [[nodiscard]]
bool replace_rgba8(
const glm::uvec2& size, std::vector<std::uint8_t> pixels);
80 [[nodiscard]]
bool has_valid_storage()
const noexcept;
83 [[nodiscard]]
static bool checked_byte_length(
const glm::uvec2& size, std::size_t* byte_length)
noexcept;
85 [[nodiscard]]
bool resize(
const glm::uvec2& size);
87 void set_filename(std::string filename)
89 filename_ = std::move(filename);
93 std::string filename_;
94 std::vector<std::uint8_t> data_;
95 glm::uvec2 size_{ 0u, 0u };