summaryrefslogtreecommitdiff
path: root/RGBImage.h
blob: d3e5642409052b23f20bceb85517ac0747999fd4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#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);

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 */