ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gfx_chunks.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 GOT_GFX_GFX_CHUNKS_H
23 #define GOT_GFX_GFX_CHUNKS_H
24 
25 #include "common/stream.h"
26 #include "got/gfx/palette.h"
27 #include "graphics/managed_surface.h"
28 
29 namespace Got {
30 namespace Gfx {
31 
32 class GfxChunks;
33 
34 enum CompressMode { UNCOMPRESSED = 0,
35  LZSS = 1,
36  RLE = 2 };
37 
38 struct GraphicChunk {
39 private:
40  Common::Array<byte> _decompressedData;
41 
42 public:
43  int _compressMode = UNCOMPRESSED;
44  uint32 _offset = 0;
45  uint16 _uncompressedSize = 0;
46  uint16 _compressedSize = 0;
47  uint16 _width = 0;
48  uint16 _height = 0;
49 
50  const byte *_data = nullptr;
51 
55  void load(Common::SeekableReadStream *src, const byte *data);
56 
60  void enable();
61 
65  operator const Graphics::ManagedSurface() const;
66 
70  operator const Gfx::Palette63() const;
71 };
72 
80 class GfxChunks {
81 private:
83  byte *_data = nullptr;
84 
88  Common::SeekableReadStream *getStream() const;
89 
90 public:
91  ~GfxChunks() {
92  delete[] _data;
93  }
94 
98  void load();
99 
103  GraphicChunk &operator[](uint idx);
104 };
105 
106 } // namespace Gfx
107 } // namespace Got
108 
109 #endif
Definition: managed_surface.h:51
Definition: gfx_chunks.h:80
void load(Common::SeekableReadStream *src, const byte *data)
Definition: stream.h:745
Definition: palette.h:30
Definition: gfx_chunks.h:38
Definition: console.h:28