ScummVM API documentation
background.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 LASTEXPRESS_BACKGROUND_H
23 #define LASTEXPRESS_BACKGROUND_H
24 
25 /*
26  Background file format (.BG)
27 
28  header:
29  uint32 {4} - position X on screen
30  uint32 {4} - position Y on screen
31  uint32 {4} - image width
32  uint32 {4} - image height
33  uint32 {4} - red color channel data size
34  uint32 {4} - blue color channel data size
35  uint32 {4} - green color channel data size
36 
37  data:
38  byte {x} - red color channel data
39  byte {x} - blue color channel data
40  byte {x} - green color channel data
41 */
42 
43 #include "lastexpress/drawable.h"
44 
45 namespace Common {
46 class SeekableReadStream;
47 }
48 
49 namespace LastExpress {
50 
51 class Background : public Drawable {
52 public:
53  Background();
54  ~Background() override;
55 
56  bool load(Common::SeekableReadStream *stream);
57 
58  Common::Rect draw(Graphics::Surface *surface) override;
59 
60 private:
61  struct BackgroundHeader {
62  uint32 posX;
63  uint32 posY;
64  uint32 width;
65  uint32 height;
66  uint32 redSize;
67  uint32 blueSize;
68  uint32 greenSize;
69  };
70 
71  BackgroundHeader _header;
72  uint16 *_data;
73 
74  byte *decodeComponent(Common::SeekableReadStream *in, uint32 inSize, uint32 outSize) const;
75 };
76 
77 } // End of namespace LastExpress
78 
79 #endif // LASTEXPRESS_BACKGROUND_H
Definition: surface.h:67
Definition: rect.h:144
Definition: stream.h:745
Definition: animation.h:45
Definition: drawable.h:29
Definition: background.h:51
Definition: algorithm.h:29