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 /**
24  * @file
25  * Macintosh cursor decoding used in engines:
26  * - mohawk
27  * - sci
28  * - scumm
29  */
30 
31 #ifndef GRAPHICS_MACCURSOR_H
32 #define GRAPHICS_MACCURSOR_H
33 
34 #include "common/stream.h"
35 
36 #include "graphics/cursor.h"
37 
38 namespace Graphics {
39 
40 /**
41  * A Mac crsr or CURS cursor
42  */
43 class MacCursor : public Cursor {
44 public:
45 	MacCursor();
46 	~MacCursor();
47 
48 	/** Return the cursor's width. */
getWidth()49 	uint16 getWidth() const { return 16; }
50 	/** Return the cursor's height. */
getHeight()51 	uint16 getHeight() const { return 16; }
52 	/** Return the cursor's hotspot's x coordinate. */
getHotspotX()53 	uint16 getHotspotX() const { return _hotspotX; }
54 	/** Return the cursor's hotspot's y coordinate. */
getHotspotY()55 	uint16 getHotspotY() const { return _hotspotY; }
56 	/** Return the cursor's transparent key. */
getKeyColor()57 	byte getKeyColor() const { return 0xFF; }
58 
getSurface()59 	const byte *getSurface() const { return _surface; }
60 
getPalette()61 	const byte *getPalette() const { return _palette; }
getPaletteStartIndex()62 	byte getPaletteStartIndex() const { return 0; }
getPaletteCount()63 	uint16 getPaletteCount() const { return 256; }
64 
65 	/** Read the cursor's data out of a stream. */
66 	bool readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome = false);
67 
68 private:
69 	bool readFromCURS(Common::SeekableReadStream &stream);
70 	bool readFromCRSR(Common::SeekableReadStream &stream, bool forceMonochrome);
71 
72 	byte *_surface;
73 	byte _palette[256 * 3];
74 
75 	uint16 _hotspotX; ///< The cursor's hotspot's x coordinate.
76 	uint16 _hotspotY; ///< The cursor's hotspot's y coordinate.
77 
78 	/** Clear the cursor. */
79 	void clear();
80 };
81 
82 } // End of namespace Graphics
83 
84 #endif
85