-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBMPLoad256.h
83 lines (69 loc) · 1.83 KB
/
BMPLoad256.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// -*- tab-width : 4 ; mode : C ; encode : ShiftJIS -*-
// Written by Pirota Pirozou, 2023/04
// BMPLoad256.h
//
// このコードは、256色BMPローダーのヘッダファイル である。
// GCC真里子版 環境で動作するように作られている。
//
// BMPLoad256.c / BMPLoad256.h は、自由に改変して自分のプログラムに組み込むことが可能。
// 著作権表記も必要ない。
// ただし、このコードを使用したことによるいかなる損害についても、作者は一切の責任を負わない。
#pragma once
#ifndef ____BMPLOAD256_H____
#define ____BMPLOAD256_H____
#include <stdio.h>
#include <stdlib.h>
typedef unsigned short WORD_t;
typedef unsigned int DWORD_t;
typedef unsigned char BYTE_t;
#define BI_RGB 0L
#define BI_BITFIELDS 3L
//typedef const char * LPSTR;
//typedef unsigned char u_char;
/// @brief ビットマップファイルヘッダー
typedef struct
{
WORD_t bfType;
DWORD_t bfSize;
WORD_t bfReserved1;
WORD_t bfReserved2;
DWORD_t bfOffBits;
} BITMAPFILEHEADER, *LPBITMAPFILEHEADER;
/// @brief ビットマップ情報ヘッダー
typedef struct
{
DWORD_t biSize;
DWORD_t biWidth;
DWORD_t biHeight;
WORD_t biPlanes;
WORD_t biBitCount;
DWORD_t biCompression;
DWORD_t biSizeImage;
DWORD_t biXPelsPerMeter;
DWORD_t biYPelsPerMeter;
DWORD_t biClrUsed;
DWORD_t biClrImportant;
} BITMAPINFOHEADER, *LPBITMAPINFOHEADER;
/// @brief カラーパレット
typedef struct
{
BYTE_t rgbBlue;
BYTE_t rgbGreen;
BYTE_t rgbRed;
BYTE_t rgbReserved;
} RGBQUAD, *LPRGBQUAD;
/// @brief ビットマップ情報
typedef struct _tagBITMAPINFO
{
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[1];
} BITMAPINFO, *LPBITMAPINFO, *PBITMAPINFO;
#ifdef __cplusplus
extern "C" {
#endif
// プロトタイプ宣言
int LoadBMP256(const char *fname);
#ifdef __cplusplus
}
#endif
#endif // __BMPLOAD256_H__