ScummVM API documentation
rle_compress.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 QDENGINE_SYSTEM_GRAPHICS_RLE_COMPRESS_H
23#define QDENGINE_SYSTEM_GRAPHICS_RLE_COMPRESS_H
24
25
26namespace QDEngine {
27
29class RLEBuffer {
30public:
31 RLEBuffer();
32 RLEBuffer(const RLEBuffer &buf);
33 ~RLEBuffer();
34
35 RLEBuffer &operator = (const RLEBuffer &buf);
36
37 bool encode(int sx, int sy, const byte *buf);
38
39 bool decode_line(int y, byte *out_buf) const;
40
41 bool decode_line(int y, int buffer_id = 0) const;
42
43 bool decode_pixel(int x, int y, uint32 &pixel);
44
45 static const byte *get_buffer(int buffer_id);
46
47 void resize_buffers();
48
49 uint32 size();
50 int line_length();
51 int line_header_length(int line_num) const;
52
53 uint32 header_size() const {
54 return _header.size();
55 }
56 uint32 data_size() const {
57 return _data.size();
58 }
59
60 const int8 *header_ptr(int y = 0) const {
61 return &*(_header.begin() + _header_offset[y]);
62 }
63 const uint32 *data_ptr(int y = 0) const {
64 return &*(_data.begin() + _data_offset[y]);
65 }
66
67 bool load(Common::SeekableReadStream *fh);
68
69 bool convert_data(int bits_per_pixel = 16);
70
71 static void releaseBuffers();
72
73private:
74 Std::vector<uint32> _header_offset;
75 Std::vector<uint32> _data_offset;
76
77 Std::vector<int8> _header;
79
80 int _bits_per_pixel;
81
82 friend bool operator == (const RLEBuffer &buf1, const RLEBuffer &buf2);
83};
84
85} // namespace QDEngine
86
87#endif // QDENGINE_SYSTEM_GRAPHICS_RLE_COMPRESS_H
size_type size() const
Definition: array.h:316
iterator begin()
Definition: array.h:375
Definition: stream.h:745
Массив, сжатый методом RLE.
Definition: rle_compress.h:29
Базовый класс для игровых ресурсов.
Definition: console.h:28