#ifndef _IMAGE_H
#define _IMAGE_H

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>

/**
 * Types
 **/
typedef struct s_pixel {
    uint8_t r;
    uint8_t v;
    uint8_t b;
} pixel;

typedef struct s_image {
    int haut;
    int larg;
    pixel* pixels;
} Image;

/**
 * Manipulation d'images
 **/
pixel getPix(Image* img, int i, int j);

void setPix(Image* img, int i, int j, pixel v);

Image* creerImage(int haut, int larg);

void detruireImage(Image* img);

/**
 *   Import / Export
 **/
// renvoie NULL en cas d'erreur
Image* importerImage(char* filename);

// renvoie false en cas d'erreur
bool exporterImage(Image* img, char* filename);

#endif