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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef STARTREK_BITMAP_H
24 #define STARTREK_BITMAP_H
25 
26 #include "common/ptr.h"
27 #include "common/stream.h"
28 #include "common/memstream.h"
29 
30 namespace StarTrek {
31 
32 // FIXME: Eventually get rid of Common::SharedPtr and dispose of file streams properly
33 typedef Common::SharedPtr<Common::MemoryReadStreamEndian> FileStream;
34 
35 struct Bitmap {
36 	int16 xoffset;
37 	int16 yoffset;
38 	int16 width;
39 	int16 height;
40 	byte *pixels;
41 
42 	Bitmap(FileStream stream);
43 	Bitmap(Common::MemoryReadStreamEndian *stream);
44 	Bitmap(const Bitmap &bitmap);
45 	Bitmap(int w, int h);
46 	~Bitmap();
47 
48 protected:
49 	int32 pixelsArraySize;
BitmapBitmap50 	Bitmap() : xoffset(0), yoffset(0), width(0), height(0), pixels(nullptr), pixelsArraySize(0) {}
51 };
52 
53 
54 /**
55  * TextBitmap is the same as Bitmap, except it stores character indices in its "pixels"
56  * array instead of actual pixels.
57  * A consequence of this is that the pixels array is smaller than otherwise expected
58  * (since width/height still reflect the actual size when drawn).
59  */
60 struct TextBitmap : Bitmap {
61 	TextBitmap(int w, int h);
62 };
63 
64 
65 /**
66  * StubBitmap is a bitmap without any actual pixel data. Used as a stub for the
67  * "starfield" sprite, which is always in draw mode 1 (invisible), so it never gets drawn;
68  * however, it does trigger refreshes on the background in that area, so the game can draw
69  * on the background layer manually.
70  */
71 struct StubBitmap : Bitmap {
72 	StubBitmap(int w, int h);
73 };
74 
75 } // End of namespace StarTrek
76 
77 #endif
78