1 | /* --------------- */ |
---|
2 | /* --- bmpNR.h --- */ |
---|
3 | /* --------------- */ |
---|
4 | |
---|
5 | /* |
---|
6 | * Gestion des bmp |
---|
7 | */ |
---|
8 | /* |
---|
9 | * Copyright (c) 1997 Lionel Lacassagne EIA |
---|
10 | * Copyright (c) 2001 Lionel Lacassagne PARC-LIS-UPMC (Paris 6) |
---|
11 | * Init 97-09-30 |
---|
12 | * Modif : 97-09-30 |
---|
13 | * modif : 01-01-30 : integration into Foundation |
---|
14 | * Note that return code have been added without testing (right now) |
---|
15 | * modif : 03-05-05 : windows independant, stand-alone version ready for linux |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef __BMP_NR_H__ |
---|
19 | #define __BMP_NR_H__ |
---|
20 | |
---|
21 | #ifdef __cplusplus |
---|
22 | #ifdef PRAGMA_VERBOSE |
---|
23 | #pragma message ("C++") |
---|
24 | #endif |
---|
25 | extern "C" { |
---|
26 | #endif |
---|
27 | |
---|
28 | #define Warning |
---|
29 | #define Error |
---|
30 | |
---|
31 | #ifdef PRAGMA_VERBOSE |
---|
32 | //#pragma message ("- include bmpio.h") |
---|
33 | //#pragma message (" MARCHE MEME POUR LES NON MULTIPLES DE 4") |
---|
34 | #endif |
---|
35 | /* |
---|
36 | * La structure RGBQuad est definie dans palette.h, donc a inclure |
---|
37 | * structure analogue a RGBQUAD, mais permet d'etre independant de windows |
---|
38 | */ |
---|
39 | |
---|
40 | |
---|
41 | /* |
---|
42 | * Windows definition |
---|
43 | * WORD = unsigned short = uint16 |
---|
44 | * DWORD = unsigned long = uint32 |
---|
45 | * LONG = unsigned long = uint32 |
---|
46 | */ |
---|
47 | |
---|
48 | //#include <windows.h> |
---|
49 | //#include <wingdi.h> |
---|
50 | |
---|
51 | #pragma pack(1) |
---|
52 | |
---|
53 | #ifndef WIN32 |
---|
54 | typedef unsigned short WORD; |
---|
55 | typedef unsigned long DWORD; |
---|
56 | typedef unsigned long LONG; |
---|
57 | #endif |
---|
58 | |
---|
59 | #ifndef WIN32 |
---|
60 | typedef struct { |
---|
61 | WORD bfType; |
---|
62 | DWORD bfSize; |
---|
63 | WORD bfReserved1; |
---|
64 | WORD bfReserved2; |
---|
65 | DWORD bfOffBits; |
---|
66 | } BITMAPFILEHEADER; |
---|
67 | #endif |
---|
68 | |
---|
69 | #ifndef WIN32 |
---|
70 | typedef struct { |
---|
71 | DWORD biSize; |
---|
72 | LONG biWidth; |
---|
73 | LONG biHeight; |
---|
74 | WORD biPlanes; |
---|
75 | WORD biBitCount; |
---|
76 | DWORD biCompression; |
---|
77 | DWORD biSizeImage; |
---|
78 | LONG biXPelsPerMeter; |
---|
79 | LONG biYPelsPerMeter; |
---|
80 | DWORD biClrUsed; |
---|
81 | DWORD biClrImportant; |
---|
82 | } BITMAPINFOHEADER; |
---|
83 | #endif |
---|
84 | |
---|
85 | typedef struct { |
---|
86 | uint16 bfType; // WORD |
---|
87 | uint32 bfSize; // DWORD |
---|
88 | uint16 bfReserved1; // WORD |
---|
89 | uint16 bfReserved2; // WORD |
---|
90 | uint32 bfOffBits; // DWORD |
---|
91 | } BitmapFileHeader; |
---|
92 | |
---|
93 | typedef struct { |
---|
94 | uint32 biSize; // DWORD |
---|
95 | uint32 biWidth; // LONG |
---|
96 | uint32 biHeight; // LONG |
---|
97 | uint16 biPlanes; // WORD |
---|
98 | uint16 biBitCount; // WORD |
---|
99 | uint32 biCompression; // DWORD |
---|
100 | uint32 biSizeImage; // DWORD |
---|
101 | uint32 biXPelsPerMeter; // LONG |
---|
102 | uint32 biYPelsPerMeter; // LONG |
---|
103 | uint32 biClrUsed; // DWORD |
---|
104 | uint32 biClrImportant; // DWORD |
---|
105 | } BitmapInfoHeader; |
---|
106 | |
---|
107 | #pragma pack() |
---|
108 | |
---|
109 | //IMAGE_EXPORT(int) SaveBMP0(Image *image, RGBQuad *palette_RGBQuad, char *filename); // windows dependant |
---|
110 | IMAGE_EXPORT(int) SaveBMP2_ui8matrix (uint8 **m, int width, int height, RGBQuad *palette_RGBQuad, char *filename); // linux stand-alone |
---|
111 | |
---|
112 | //IMAGE_EXPORT(int) LoadBMP(char *filename, Image **image); |
---|
113 | |
---|
114 | //IMAGE_EXPORT(int) MLoadBMP (char *filename, Image *image); |
---|
115 | //IMAGE_EXPORT(int) MLoadNextBMP (char *path, char *filename, int k, Image *Buff); |
---|
116 | //IMAGE_EXPORT(int) MSaveNextBMP (Image *image, RGBQuad *palette, char *path, char *filename, int k); |
---|
117 | //IMAGE_EXPORT(int) MSaveNextBMP2(Image *image, RGBQuad *palette, char *path, char *filename, int k, int l); |
---|
118 | |
---|
119 | //IMAGE_EXPORT(int) MSaveNextBMP_ndigit (Image *image, RGBQuad *palette, char *path, char *filename, int k, int ndigit); |
---|
120 | //IMAGE_EXPORT(int) MSaveNextBMP2_ndigit(Image *image, RGBQuad *palette, char *path, char *filename, int k, int l, int ndigit); |
---|
121 | |
---|
122 | |
---|
123 | #ifdef __cplusplus |
---|
124 | } |
---|
125 | #endif |
---|
126 | |
---|
127 | #endif /* __BMP_NR_H__ */ |
---|