3 * @author Shinichiro Nakamura
\r
4 * @brief BMPファイルを少ないメモリでI/Oできるモジュールの定義。
\r
8 * ===============================================================
\r
11 * ===============================================================
\r
12 * Copyright (c) 2010-2011 Shinichiro Nakamura
\r
14 * Permission is hereby granted, free of charge, to any person
\r
15 * obtaining a copy of this software and associated documentation
\r
16 * files (the "Software"), to deal in the Software without
\r
17 * restriction, including without limitation the rights to use,
\r
18 * copy, modify, merge, publish, distribute, sublicense, and/or
\r
19 * sell copies of the Software, and to permit persons to whom the
\r
20 * Software is furnished to do so, subject to the following
\r
23 * The above copyright notice and this permission notice shall be
\r
24 * included in all copies or substantial portions of the Software.
\r
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\r
27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
\r
28 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
\r
29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
\r
30 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
\r
31 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
\r
32 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
\r
33 * OTHER DEALINGS IN THE SOFTWARE.
\r
34 * ===============================================================
\r
41 #include <t_stdlib.h>
\r
43 #define BMP_FILE_MAGIC_TEXT (('B' << 0) | ('M' << 8))
\r
45 typedef struct bmp_file {
\r
48 uint16_t bfReserved1;
\r
49 uint16_t bfReserved2;
\r
53 typedef struct bmp_info {
\r
58 uint16_t biBitCount;
\r
59 uint32_t biCompression;
\r
60 uint32_t biSizeImage;
\r
61 uint32_t biXPelsPerMeter;
\r
62 uint32_t biYPelsPerMeter;
\r
64 uint32_t biClrImportant;
\r
67 typedef struct bmp_rgbquad {
\r
74 int bmplowio_header_init(
\r
75 bmp_file_t* filehead,
\r
76 bmp_info_t *infohead);
\r
78 int bmplowio_header_write(
\r
79 int (*func_putc)(uint8_t c),
\r
80 const bmp_file_t* filehead,
\r
81 const bmp_info_t *infohead);
\r
83 int bmplowio_palette_write(
\r
84 int (*func_putc)(uint8_t c),
\r
85 const bmp_rgbquad_t *rgbquad,
\r
88 int bmplowio_image_write(
\r
89 int (*func_putc)(uint8_t c),
\r
90 const bmp_file_t *filehead,
\r
91 const bmp_info_t *infohead,
\r
92 void(*func)(int x, int y, int *r, int *g, int *b));
\r
94 int bmplowio_header_read(
\r
95 int (*func_getc)(void),
\r
96 bmp_file_t *filehead,
\r
97 bmp_info_t *infohead);
\r
99 int bmplowio_palette_read(
\r
100 int (*func_getc)(void),
\r
101 bmp_rgbquad_t *rgbquad,
\r
104 int bmplowio_image_read(
\r
105 int (*func_getc)(void),
\r
106 const bmp_file_t *filehead,
\r
107 const bmp_info_t *infohead,
\r
108 void(*func)(int x, int y, int r, int g, int b));
\r
110 int have_palette(const bmp_info_t *infoh);
\r
112 int calc_framebytesize(const bmp_info_t *infoh);
\r