ScummVM API documentation
iff.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_IFF_H
23#define IMAGE_IFF_H
24
25#include "common/array.h"
26#include "common/endian.h"
27#include "graphics/palette.h"
28#include "graphics/surface.h"
29
30#include "image/image_decoder.h"
31
32namespace Common {
33class SeekableReadStream;
34}
35
36namespace Graphics {
37struct Surface;
38}
39
40namespace Image {
41
56class IFFDecoder : public ImageDecoder {
57public:
58 struct Header {
59 uint16 width, height;
60 uint16 x, y;
61 byte numPlanes;
62 byte masking;
63 byte compression;
64 byte flags;
65 uint16 transparentColor;
66 byte xAspect, yAspect;
67 uint16 pageWidth, pageHeight;
68 };
69
70 struct PaletteRange {
71 int16 timer, step, flags;
72 byte first, last;
73 };
74
75 enum Type {
76 TYPE_UNKNOWN = 0,
77 TYPE_ILBM,
78 TYPE_PBM
79 };
80
81 IFFDecoder();
82 virtual ~IFFDecoder();
83
84 // ImageDecoder API
85 void destroy() override;
86 bool loadStream(Common::SeekableReadStream &stream) override;
87 const Header *getHeader() const { return &_header; }
88 const Graphics::Surface *getSurface() const override { return _surface; }
89 const Graphics::Palette &getPalette() const override { return _palette; }
90 const Common::Array<PaletteRange> &getPaletteRanges() const { return _paletteRanges; }
91
98 void setNumRelevantPlanes(const uint8 numRelevantPlanes) { _numRelevantPlanes = numRelevantPlanes; }
99
109 void setPixelPacking(const bool pixelPacking) { _pixelPacking = pixelPacking; }
110private:
111
112 Header _header;
113 Graphics::Surface *_surface;
114 Graphics::Palette _palette;
115 Common::Array<PaletteRange> _paletteRanges;
116 Type _type;
117 uint8 _numRelevantPlanes;
118 bool _pixelPacking;
119
120 void loadHeader(Common::SeekableReadStream &stream);
121 void loadPalette(Common::SeekableReadStream &stream, const uint32 size);
122 void loadPaletteRange(Common::SeekableReadStream &stream, const uint32 size);
123 void loadBitmap(Common::SeekableReadStream &stream);
124 void packPixels(byte *scanlines, byte *data, const uint16 scanlinePitch, const uint16 outPitch);
125};
127} // End of namespace Image
128
129#endif
Definition: array.h:52
Definition: stream.h:745
Simple class for handling a palette data.
Definition: palette.h:61
Definition: iff.h:56
bool loadStream(Common::SeekableReadStream &stream) override
void setNumRelevantPlanes(const uint8 numRelevantPlanes)
Definition: iff.h:98
void setPixelPacking(const bool pixelPacking)
Definition: iff.h:109
const Graphics::Surface * getSurface() const override
Definition: iff.h:88
void destroy() override
const Graphics::Palette & getPalette() const override
Definition: iff.h:89
Definition: image_decoder.h:53
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: surface.h:67
Definition: iff.h:58