ScummVM API documentation
animationdecoder.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 MUTATIONOFJB_ANIMATIONDECODER_H
23#define MUTATIONOFJB_ANIMATIONDECODER_H
24
25#include "common/rect.h"
26#include "common/path.h"
27#include "common/scummsys.h"
28
29#include "graphics/surface.h"
30#include "mutationofjb/encryptedfile.h"
31
32namespace Common {
33class SeekableReadStream;
34}
35
36namespace MutationOfJB {
37
38enum {
39 PALETTE_COLORS = 256,
40 PALETTE_SIZE = PALETTE_COLORS * 3,
41 IMAGE_WIDTH = 320,
42 IMAGE_HEIGHT = 200
43};
44
46public:
47 virtual void onFrame(int frameNo, Graphics::Surface &surface) = 0;
48 virtual void onPaletteUpdated(byte palette[PALETTE_SIZE]) = 0;
49 virtual ~AnimationDecoderCallback() {}
50};
51
53public:
54 AnimationDecoder(const Common::Path &fileName);
55 AnimationDecoder(const Common::Path &fileName, const Graphics::Surface &outSurface);
57 bool decode(AnimationDecoderCallback *callback);
58
67 void setPartialMode(int fromFrame, int toFrame, const Common::Rect &area = Common::Rect(), uint8 threshold = 0xFF);
68
69private:
70 void loadPalette(Common::SeekableReadStream &stream);
71 void loadFullFrame(EncryptedFile &file, uint32 size);
72 void loadDiffFrame(EncryptedFile &file, uint32 size);
73
74 Common::Path _fileName;
75 Graphics::Surface _surface;
76 bool _owningSurface;
77 byte _palette[PALETTE_SIZE];
78 int _fromFrame;
79 int _toFrame;
80 Common::Rect _area;
81 uint8 _threshold;
82};
83
84}
85
86#endif
Definition: path.h:52
Definition: stream.h:745
Definition: animationdecoder.h:45
Definition: animationdecoder.h:52
void setPartialMode(int fromFrame, int toFrame, const Common::Rect &area=Common::Rect(), uint8 threshold=0xFF)
Definition: encryptedfile.h:29
Definition: algorithm.h:29
Definition: rect.h:536
Definition: surface.h:67