image.h 708 Bytes
#ifndef IMAGE_H
#define IMAGE_H

#include <stdint.h>

struct pixel {
    uint8_t r, g, b;
};

struct image {
    uint64_t width, height;
    struct pixel* data;
};

struct pixel_row {
    struct pixel* data;
    uint64_t size;
};

void create_image(struct image* image, uint64_t width, uint64_t height);

struct pixel get_image_pixel(const struct image* image, uint64_t x, uint64_t y);

void set_image_pixel(struct image* image, uint64_t x, uint64_t y, struct pixel new_pixel);

void get_image_row(const struct image* image, uint64_t x, struct pixel_row* pixel_row);

void set_image_row(struct image* image, uint64_t x, struct pixel_row* new_pixel_row);

void free_image_memory(struct image* image);

#endif