-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimage.h
41 lines (36 loc) · 855 Bytes
/
image.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
/*Compressions*/
#define BI_BITFIELDS 3
#define MAGIC_NUMBER 0x4D42
struct file_header
{
int MAGIC; /*Number at start of file 0x424D*/
int file_size; /*Size of BPM file*/
int res_1;
int res_2;
int offset; /*starting address of byte where pix array starts*/
};
struct dib_header
{
int header_size;
int width;
int height;
int planes;
int bits_per_pixel;
int compression;
int image_size;
int hor_res;
int vert_res;
int pallet;
int imp_colors;
};
struct image
{
struct file_header *file_header;
struct dib_header *dib_header;
int32_t *pixel_array;
};
void read_header(FILE *file, struct image *image);
void read_dib(FILE *file, struct image *image);
void create_pixel_array(FILE *file, struct image *image);
void print_pixel_array(struct image *image);
void write_image_to_file(struct image *image);