ScummVM API documentation
icocur.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 IMAGE_ICOCUR_H
23 #define IMAGE_ICOCUR_H
24 
25 #include "common/array.h"
26 #include "common/types.h"
27 
28 namespace Common {
29 
30 class SeekableReadStream;
31 
32 } // End of namespace Common
33 
34 namespace Graphics {
35 
36 class Cursor;
37 struct Surface;
38 
39 } // End of namespace Graphics
40 
41 namespace Image {
42 
44 public:
45  enum Type {
46  kTypeInvalid,
47 
48  kTypeICO,
49  kTypeCUR,
50  };
51 
52  struct Item {
53  struct IconData {
54  uint16 numPlanes;
55  uint16 bitsPerPixel;
56  };
57 
58  struct CursorData {
59  uint16 hotspotX;
60  uint16 hotspotY;
61  };
62 
63  union DataUnion {
64  IconData ico;
65  CursorData cur;
66  };
67 
68  uint16 width;
69  uint16 height;
70  uint8 numColors; // May be 0
71  DataUnion data;
72  uint32 dataSize;
73  uint32 dataOffset;
74  };
75 
76  IcoCurDecoder();
77  ~IcoCurDecoder();
78 
79  bool open(Common::SeekableReadStream &stream, DisposeAfterUse::Flag = DisposeAfterUse::NO);
80  void close();
81 
82  Type getType() const;
83  uint numItems() const;
84  const Item &getItem(uint itemIndex) const;
85 
92  Graphics::Cursor *loadItemAsCursor(uint itemIndex) const;
93 
94 private:
95  bool load();
96 
97  Type _type;
98  Common::Array<Item> _items;
99 
101  DisposeAfterUse::Flag _disposeAfterUse;
102 };
103 
104 } // End of namespace Image
105 
106 #endif
Definition: stream.h:745
Definition: atari-cursor.h:38
Definition: cursor.h:42
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: icocur.h:52
Definition: movie_decoder.h:32
Definition: icocur.h:43