17#define pixel_at(img, x, y) ((img).pixels + (x) + (y) * (img).width)
22#define foreach_pixel(img, expression) \
23 for (uint32_t i = 0; i < (img).width; ++i) { \
24 for (uint32_t j = 0; j < (img).height; ++j) { \
size_t calc_image_size(uint32_t width, uint32_t height)
Return required size for image pixels data.
MaybeImage create_image(uint32_t width, uint32_t height)
Create image structure with pre-allocated data. If memory cannot be allocated, image pixels are NULL.
struct __attribute__((packed))
Pixel with 1-byte color depth.
Definition image.h:32
void destroy_image(Image img)
Free image data.
#define Maybe(value_t)
Maybe result.
Definition result.h:62
RGB image.
Definition image.h:39
Pixel * pixels
Definition image.h:41
uint32_t height
Definition image.h:40