summaryrefslogtreecommitdiff
path: root/RGBImage.h
blob: ba327856a67f2d14dfc30016a561eba145929f01 (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
35
#ifndef _RGBIMAGE
#define _RGBIMAGE

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

typedef uint8_t  byte;
typedef uint16_t byte2;
typedef uint32_t byte4;

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

void ARGB_set(ARGB* rgb, byte4 color);
void ARGB_merge(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 */