-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheasyppm.h
49 lines (40 loc) · 1.04 KB
/
easyppm.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef EASYPPM_H_
#define EASYPPM_H_
#ifdef __cplusplus
extern "C" {
#endif
#define EASYPPM_NUM_CHANNELS 3
#define EASYPPM_MAX_CHANNEL_VALUE 255
#define PPMBYTE unsigned char
typedef struct {
PPMBYTE r;
PPMBYTE g;
PPMBYTE b;
} ppmcolor;
typedef enum {
IMAGETYPE_PBM,
IMAGETYPE_PGM,
IMAGETYPE_PPM
} imagetype;
typedef struct {
int width;
int height;
PPMBYTE* image;
imagetype itype;
} PPM;
PPM easyppm_create(int width, int height, imagetype itype);
void easyppm_clear(PPM* ppm, ppmcolor c);
void easyppm_set(PPM* ppm, int x, int y, ppmcolor c);
ppmcolor easyppm_get(PPM* ppm, int x, int y);
ppmcolor easyppm_rgb(PPMBYTE r, PPMBYTE g, PPMBYTE b);
ppmcolor easyppm_grey(PPMBYTE gr);
ppmcolor easyppm_black_white(int bw);
void easyppm_gamma_correct(PPM* ppm, float gamma);
void easyppm_invert_y(PPM* ppm);
void easyppm_read(PPM* ppm, const char* path);
void easyppm_write(PPM* ppm, const char* path);
void easyppm_destroy(PPM* ppm);
#ifdef __cplusplus
}
#endif
#endif