forked from dipsywong98/COMP4411-impressionist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBitmap.h
66 lines (55 loc) · 1.5 KB
/
Bitmap.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// bitmap.h
//
// header file for MS bitmap format
//
//
#ifndef BITMAP_H
#define BITMAP_H
#include <stdio.h>
#include <string.h>
#define BMP_BI_RGB 0L
typedef unsigned short BMP_WORD;
typedef unsigned int BMP_DWORD;
typedef int BMP_LONG;
typedef struct {
BMP_WORD bfType;
BMP_DWORD bfSize;
BMP_WORD bfReserved1;
BMP_WORD bfReserved2;
BMP_DWORD bfOffBits;
} BMP_BITMAPFILEHEADER;
typedef struct {
BMP_DWORD biSize;
BMP_LONG biWidth;
BMP_LONG biHeight;
BMP_WORD biPlanes;
BMP_WORD biBitCount;
BMP_DWORD biCompression;
BMP_DWORD biSizeImage;
BMP_LONG biXPelsPerMeter;
BMP_LONG biYPelsPerMeter;
BMP_DWORD biClrUsed;
BMP_DWORD biClrImportant;
} BMP_BITMAPINFOHEADER;
typedef struct
{
int pad;
int padWidth;
} PADDING;
typedef struct
{
unsigned int c0;
unsigned int c1;
unsigned int c2;
} DIB_COLOR_MAPPING;
// global I/O routines
extern unsigned char* readBMP(const char* fname, int& width, int& height );
extern unsigned char* mapColor(unsigned char* data, long int width, long int height, long int pad, DIB_COLOR_MAPPING map);
extern unsigned char* reverseMapColor(unsigned char* data, long int width, long int height, DIB_COLOR_MAPPING map);
extern unsigned char* repackBmp(unsigned char* data, long int width, long int height, long int pad);
extern PADDING calculatePadding(long width);
extern void writeBMP(const char* iname, int width, int height, unsigned char* data );
extern DIB_COLOR_MAPPING bmp_color_mapping;
extern DIB_COLOR_MAPPING cinepak_color_mapping;
#endif