#ifndef _RGBIMAGE
#define _RGBIMAGE

#include "../global.h"
#include <stdio.h>

typedef uint8_t  byte;
typedef uint32_t color;

typedef struct ARGB {
	byte a;
	byte r;
	byte g;
	byte b;
} ARGB;

void ARGB_merge(ARGB* bottom, color top);
void ARGB_mergeARGB(ARGB* bottom, ARGB top);
void ARGB_set(ARGB* rgb, color color);

typedef struct RGBImage {
	u32 width;
	u32 height;
	ARGB* img;
} RGBImage;

RGBImage RGBImage_new(u32 width, u32 height);
void RGBImage_free(RGBImage img);
void RGBImage_delete(RGBImage* img);
ARGB* RGBImage_at(RGBImage img, int row, int col);

int ppm6_write(FILE* f, RGBImage img);
RGBImage ppm_read(FILE* f);

#endif /* _RGBIMAGE */
