ScummVM API documentation
xmg.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 STARK_XMG_H
23 #define STARK_XMG_H
24 
25 #include "common/stream.h"
26 
27 namespace Graphics {
28  struct Surface;
29 }
30 
31 namespace Stark {
32 namespace Formats {
33 
37 class XMGDecoder {
38 public:
39  static Graphics::Surface *decode(Common::ReadStream *stream);
40  static void readSize(Common::ReadStream *stream, uint &width, uint &height);
41 
42 private:
43  explicit XMGDecoder(Common::ReadStream *stream);
44 
45  struct Block {
46  uint32 a1, a2;
47  uint32 b1, b2;
48  };
49 
50  void readHeader();
51  Graphics::Surface *decodeImage();
52  Block decodeBlock(byte op);
53  void drawBlock(const Block &block, Graphics::Surface *surface);
54 
55  Block processYCrCb();
56  Block processTrans();
57  Block processRGB();
58 
59  uint32 _width;
60  uint32 _height;
61 
62  uint32 _currX;
63  uint32 _currY;
64 
65  Common::ReadStream *_stream;
66 
72  uint32 _transColor;
73 };
74 
75 } // End of namespace Formats
76 } // End of namespace Stark
77 
78 #endif // STARK_XMG_H
Definition: surface.h:67
Definition: xmg.h:37
Definition: console.h:27
Definition: formatinfo.h:28
Definition: stream.h:385