ScummVM API documentation
nuvie_bmp_file.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef NUVIE_FILES_NUVIE_BMP_FILE_H
23#define NUVIE_FILES_NUVIE_BMP_FILE_H
24
25#include "common/str.h"
26
27#include "ultima/nuvie/files/nuvie_io_file.h"
28#include "ultima/nuvie/core/tile_manager.h"
29
30namespace Ultima {
31namespace Nuvie {
32
34private:
35 unsigned char *data;
36 uint32 palette[256];
37 sint32 prev_width;
38 sint32 prev_height;
39 uint16 prev_bits;
40 uint32 bmp_line_width;
41
42 struct {
43 uint16 type; /* Magic identifier */
44 uint32 size; /* File size in bytes */
45 uint16 reserved1, reserved2;
46 uint32 offset; /* Offset to image data, bytes */
47 } header;
48
49#define NUVIEBMP_HEADER_SIZE 14
50
51 struct {
52 uint32 size; /* Header size in bytes */
53 sint32 width, height; /* Width and height of image */
54 uint16 planes; /* Number of colour planes */
55 uint16 bits; /* Bits per pixel */
56 uint32 compression; /* Compression type */
57 uint32 imagesize; /* Image size in bytes */
58 sint32 xresolution, yresolution; /* Pixels per meter */
59 uint32 ncolours; /* Number of colours */
60 uint32 importantcolours; /* Important colours */
61 } infoHeader;
62
63#define NUVIEBMP_INFOHEADER_SIZE 40
64
65public:
66
69
70 bool initNewBlankImage(sint32 width, sint32 height, const unsigned char *palette);
71
72 bool load(const Common::Path &filename);
73 bool save(const Common::Path &filename);
74
75 uint16 getWidth() const {
76 return (uint16)infoHeader.width;
77 }
78 uint16 getHeight() const {
79 return (uint16)infoHeader.height;
80 }
81
82
83 Tile *getTile();
84 unsigned char *getRawIndexedData();
85 unsigned char *getRawIndexedDataCopy();
86 Graphics::ManagedSurface *getSdlSurface32();
87 Graphics::ManagedSurface *getSdlSurface32(const Common::Path &filename);
88
89private:
90 bool handleError(Common::String error);
91 void write8BitData(NuvieIOFileWrite *file);
92};
93
94} // End of namespace Nuvie
95} // End of namespace Ultima
96
97#endif
Definition: path.h:52
Definition: str.h:59
Definition: managed_surface.h:51
Definition: nuvie_bmp_file.h:33
Definition: nuvie_io_file.h:75
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: tile_manager.h:113