ScummVM API documentation
screen_decoder.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 MM1_GFX_SCREEN_DECODER_H
23 #define MM1_GFX_SCREEN_DECODER_H
24 
25 #include "image/image_decoder.h"
26 #include "graphics/managed_surface.h"
27 #include "graphics/palette.h"
28 
29 namespace MM {
30 namespace MM1 {
31 namespace Gfx {
32 
34 private:
35  Graphics::Surface _surface;
36  Graphics::Palette _palette;
37 public:
38  byte _indexes[4] = { 0 }; // EGA palete indexes used
39 public:
40  ScreenDecoder() : _palette(0) {}
41  ~ScreenDecoder() override;
42 
43  void destroy() override;
44  bool loadFile(const Common::Path &fname,
45  int16 w = 320, int16 h = 200);
46  bool loadStream(Common::SeekableReadStream &stream, int16 w, int16 h);
47  bool loadStream(Common::SeekableReadStream &stream) override {
48  return loadStream(stream, 320, 200);
49  }
50 
51  const Graphics::Surface *getSurface() const override {
52  return &_surface;
53  }
54  const Graphics::Palette &getPalette() const override { return _palette; }
55  void clear() { _surface.free(); }
56 };
57 
58 } // namespace Gfx
59 } // namespace MM1
60 } // namespace MM
61 
62 #endif
Definition: image_decoder.h:53
Definition: surface.h:67
Definition: path.h:52
Definition: stream.h:745
const Graphics::Surface * getSurface() const override
Definition: screen_decoder.h:51
Definition: detection.h:27
bool loadStream(Common::SeekableReadStream &stream) override
Definition: screen_decoder.h:47
const Graphics::Palette & getPalette() const override
Definition: screen_decoder.h:54
Simple class for handling a palette data.
Definition: palette.h:55
Definition: screen_decoder.h:33