-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbmp.h
More file actions
72 lines (58 loc) · 1.48 KB
/
bmp.h
File metadata and controls
72 lines (58 loc) · 1.48 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//--------------------------------------------------------------
//
// 4190.308 Computer Architecture (Spring 2019)
//
// Project #3: Drawing diagonal lines in an image
//
// April 24, 2019.
//
// Jin-Soo Kim (jinsoo.kim@snu.ac.kr)
// Systems Software & Architecture Laboratory
// Dept. of Computer Science and Engineering
// Seoul National University
//
//--------------------------------------------------------------
#define BMP_MAGIC ((unsigned short) 0x4d42)
#define BITMAPCOREHEADER (12)
#define BITMAPCOREHEADER2 (64)
#define BITMAPINFOHEADER (40)
#define BITMAPV4HEADER (108)
#define BITMAPV5HEADER (124)
#define BI_RGB 0
#define BI_RLE8 1
#define BI_RLE4 2
#define BI_BITFIELDS 3
#define BI_JPEG 4
#define BI_PNG 5
typedef struct {
unsigned short magic;
unsigned short length_low;
unsigned short length_high;
unsigned short pad1;
unsigned short pad2;
unsigned short offset_low;
unsigned short offset_high;
} bmp_header;
typedef struct {
unsigned int size;
int width;
int height;
unsigned short planes;
unsigned short bitcount;
unsigned int compression;
unsigned int size_image;
int xpixels_per_meter;
int ypixels_per_meter;
unsigned int colors_used;
unsigned int colors_important;
} bi_header;
struct bmp_info {
unsigned char *memptr;
unsigned char *imgptr;
int filesize;
int offset;
long long width;
long long height;
long long gap;
};
void bmp_diag (unsigned char *imgptr, long long width, long long height, long long gap);