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