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 
38 namespace Image {
39 class ImageDecoder;
40 }
41 
42 namespace Wintermute {
43 class BaseSurface;
44 class BaseFileManager;
45 class BaseImage {
46 
47 public:
48  BaseImage();
49  ~BaseImage();
50 
51  bool loadFile(const Common::String &filename);
52  const Graphics::Surface *getSurface() const {
53  return _surface;
54  };
55  const byte *getPalette() const {
56  return _palette;
57  }
58  uint16 getPaletteCount() const {
59  return _paletteCount;
60  }
61  byte getAlphaAt(int x, int y) const;
62  bool writeBMPToStream(Common::WriteStream *stream) const;
63  bool resize(int newWidth, int newHeight);
64  bool saveBMPFile(const Common::String &filename) const;
65  bool copyFrom(BaseImage *origImage, int newWidth = 0, int newHeight = 0);
66  void copyFrom(const Graphics::Surface *surface);
67 private:
68  Common::String _filename;
69  Image::ImageDecoder *_decoder;
70  const Graphics::Surface *_surface;
71  Graphics::Surface *_deletableSurface;
72  const byte *_palette;
73  byte *_paletteTga;
74  uint16 _paletteCount;
75  BaseFileManager *_fileManager;
76 };
77 
78 } // End of namespace Wintermute
79 
80 #endif
Definition: image_decoder.h:52
Definition: str.h:59
Definition: surface.h:67
Definition: base_image.h:45
Definition: stream.h:77
Definition: base_file_manager.h:39
Definition: movie_decoder.h:32
Definition: achievements_tables.h:27