ScummVM API documentation
base_image.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/*
23 * This file is based on WME Lite.
24 * http://dead-code.org/redir.php?target=wmelite
25 * Copyright (c) 2011 Jan Nedoma
26 */
27
28#ifndef WINTERMUTE_BASE_IMAGE_H
29#define WINTERMUTE_BASE_IMAGE_H
30
31#include "graphics/surface.h"
32#include "graphics/pixelformat.h"
33
34#include "common/endian.h"
35#include "common/str.h"
36#include "common/stream.h"
37
38namespace Image {
39class ImageDecoder;
40}
41
42namespace Wintermute {
43class BaseSurface;
44class BaseFileManager;
45class BaseImage {
46
47public:
48 BaseImage();
49 ~BaseImage();
50
51 bool getImageInfo(const Common::String &filename, int32 &width, int32 &height);
52 bool loadFile(const Common::String &filename);
53 const Graphics::Surface *getSurface() const {
54 return _surface;
55 };
56 const byte *getPalette() const {
57 return _palette;
58 }
59 uint16 getPaletteCount() const {
60 return _paletteCount;
61 }
62 bool writeBMPToStream(Common::WriteStream *stream) const;
63 bool saveBMPFile(const char *filename) const;
64 void copyFrom(const Graphics::Surface *surface, int newWidth = 0, int newHeight = 0, byte flip = 0);
65private:
66 Common::String _filename;
67 Image::ImageDecoder *_decoder;
68 const Graphics::Surface *_surface;
69 Graphics::Surface *_deletableSurface;
70 const byte *_palette;
71 uint16 _paletteCount;
72 BaseFileManager *_fileManager;
73
74 bool getImageInfoBMP(const Common::String &filename, int32 &width, int32 &height);
75 bool getImageInfoTGA(const Common::String &filename, int32 &width, int32 &height);
76 bool getImageInfoPNG(const Common::String &filename, int32 &width, int32 &height);
77 bool getImageInfoJPG(const Common::String &filename, int32 &width, int32 &height);
78};
79
80} // End of namespace Wintermute
81
82#endif
Definition: str.h:59
Definition: stream.h:77
Definition: image_decoder.h:53
Definition: base_file_manager.h:39
Definition: base_image.h:45
Definition: surface.h:67