ScummVM API documentation
ani.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_ANI_H
23#define IMAGE_ANI_H
24
25#include "common/array.h"
26#include "common/types.h"
27#include "common/func.h"
28
29namespace Common {
30
31class SeekableReadStream;
32struct IFFChunk;
33
34} // End of namespace Common
35
36namespace Graphics {
37
38class Cursor;
39struct Surface;
40
41} // End of namespace Graphics
42
43namespace Image {
44
46public:
47 struct Metadata {
48 Metadata();
49
50 uint32 numFrames; // Number of images
51 uint32 numSteps; // Number of frames (use the FrameDef to determine which frame)
52 uint32 width;
53 uint32 height;
54 uint32 bitCount;
55 uint32 numPlanes;
56 uint32 perFrameDelay;
57 bool haveSeqData;
58 bool isCURFormat;
59 };
60
61 struct FrameDef {
62 FrameDef();
63
64 uint32 imageIndex;
65 uint32 delay; // In 1/60 sec
66 };
67
68 AniDecoder();
70
71 bool open(Common::SeekableReadStream &stream, DisposeAfterUse::Flag = DisposeAfterUse::NO);
72 void close();
73
74 const Metadata &getMetadata() const;
75 FrameDef getSequenceFrame(uint sequenceIndex) const;
76
88
89private:
90 struct RIFFContainerDef {
91 uint32 id;
92 uint32 size;
93 };
94
95 struct RIFFChunkDef {
96 uint32 id;
97 uint32 size;
98 };
99
100 struct FrameDataRange {
101 uint32 pos;
102 uint32 size;
103 };
104
107
108 bool load();
109
110 static bool parseRIFFChunks(Common::SeekableReadStream &stream, const RIFFChunkParseFunc_t &callback);
111 static bool parseRIFFContainer(Common::SeekableReadStream &stream, const RIFFChunkDef &chunkDef, const RIFFContainerParseFunc_t &callback);
112
113 bool parseTopLevelChunk(const RIFFChunkDef &chunk, Common::SeekableReadStream &stream);
114 bool parseTopLevelContainer(const RIFFContainerDef &container, Common::SeekableReadStream &stream);
115
116 bool parseSecondLevelChunk(const RIFFChunkDef &chunk, Common::SeekableReadStream &stream);
117
118 bool parseListContainer(const RIFFContainerDef &container, Common::SeekableReadStream &stream);
119
120 bool parseAnimHeaderChunk(const RIFFChunkDef &chunk, Common::SeekableReadStream &stream);
121 bool parseSeqChunk(const RIFFChunkDef &chunk, Common::SeekableReadStream &stream);
122 bool parseRateChunk(const RIFFChunkDef &chunk, Common::SeekableReadStream &stream);
123 bool parseIconChunk(const RIFFChunkDef &chunk, Common::SeekableReadStream &stream);
124
125 Metadata _metadata;
126 Common::Array<uint32> _rateData;
127 Common::Array<uint32> _seqData;
128 Common::Array<FrameDataRange> _frameDataLocations;
129
131 DisposeAfterUse::Flag _disposeAfterUse;
132};
133
134} // End of namespace Image
135
136#endif
Definition: stream.h:745
Definition: ani.h:45
Common::SeekableReadStream * openImageStream(uint imageIndex) const
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: func.h:473
Definition: atari-cursor.h:35
Definition: ani.h:61
Definition: ani.h:47