-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbmp.h
More file actions
45 lines (35 loc) · 714 Bytes
/
bmp.h
File metadata and controls
45 lines (35 loc) · 714 Bytes
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
#ifndef __BMP_H__
#define __BMP_H__
#include <stdio.h>
#include <stdint.h>
#define BMP_MAGIC 0x4d42
typedef struct bmp_header
{
uint16_t magic;
uint32_t size;
uint32_t rsv0;
uint32_t offset;
} __attribute__((packed)) bmp_hdr_t;
typedef struct bmp_dib_header
{
uint32_t size;
uint32_t width;
uint32_t height;
uint16_t plane;
uint16_t bits;
uint32_t comp;
uint32_t img_sz;
uint32_t hres;
uint32_t vres;
uint32_t col;
uint32_t icol;
} __attribute__((packed)) bmp_dib_t;
typedef struct bmp_file
{
bmp_hdr_t hdr;
bmp_dib_t dib;
uint8_t pixels[0];
} __attribute__((packed)) bmp_t;
struct image;
void bmp_save(struct image*, FILE*);
#endif