6#include <aegis2d/render/export.hpp>
17class AEGIS2D_RENDER_EXPORT
ImageError :
public std::runtime_error {
19 using std::runtime_error::runtime_error;
25struct AEGIS2D_RENDER_EXPORT
Image {
39 [[nodiscard]]
static Image load(
const std::filesystem::path& path);
48 [[nodiscard]]
static Image from_pixels(
int width,
int height, std::vector<std::uint8_t> pixels);
54 void save_png(
const std::filesystem::path& path)
const;
58 [[nodiscard]]
bool empty() const noexcept;
65 [[nodiscard]]
Color pixel(
int x,
int y) const;
Thrown when an image cannot be read, decoded or written.
Definition image.hpp:17
RGBA color used by the renderer.
OpenGL renderer: sprites, text and camera (client only).
Definition bitmap_font.hpp:16
RGBA color with components in [0, 1].
Definition color.hpp:10
RGBA image with 8 bits per channel, ready to become a texture.
Definition image.hpp:25
std::vector< std::uint8_t > pixels
width * height * 4 bytes.
Definition image.hpp:31
void save_png(const std::filesystem::path &path) const
Writes the image as a PNG file, creating its folder.
static Image from_pixels(int width, int height, std::vector< std::uint8_t > pixels)
Wraps pixels generated in memory, such as marker_image().
static Image load(const std::filesystem::path &path)
Reads an image file.
bool empty() const noexcept
Tells whether the image has no pixel.