ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

iff.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00032 #ifndef IMAGE_IFF_H
00033 #define IMAGE_IFF_H
00034 
00035 #include "common/array.h"
00036 #include "common/endian.h"
00037 #include "graphics/surface.h"
00038 
00039 #include "image/image_decoder.h"
00040 
00041 namespace Common {
00042 class SeekableReadStream;
00043 }
00044 
00045 namespace Graphics {
00046 struct Surface;
00047 }
00048 
00049 namespace Image {
00050 
00051 class IFFDecoder : public ImageDecoder {
00052 public:
00053     struct Header {
00054         uint16 width, height;
00055         uint16 x, y;
00056         byte numPlanes;
00057         byte masking;
00058         byte compression;
00059         byte flags;
00060         uint16 transparentColor;
00061         byte xAspect, yAspect;
00062         uint16 pageWidth, pageHeight;
00063     };
00064 
00065     struct PaletteRange {
00066         int16  timer, step, flags;
00067         byte first, last;
00068     };
00069 
00070     enum Type {
00071         TYPE_UNKNOWN = 0,
00072         TYPE_ILBM,
00073         TYPE_PBM
00074     };
00075 
00076     IFFDecoder();
00077     virtual ~IFFDecoder();
00078 
00079     // ImageDecoder API
00080     void destroy();
00081     bool loadStream(Common::SeekableReadStream &stream);
00082     const Header *getHeader() const { return &_header; }
00083     const Graphics::Surface *getSurface() const { return _surface; }
00084     const byte *getPalette() const { return _palette; }
00085     const Common::Array<PaletteRange> &getPaletteRanges() const { return _paletteRanges; }
00086     uint16 getPaletteColorCount() const { return _paletteColorCount; }
00087 
00094     void setNumRelevantPlanes(const uint8 numRelevantPlanes) { _numRelevantPlanes = numRelevantPlanes; }
00095 
00105     void setPixelPacking(const bool pixelPacking) { _pixelPacking = pixelPacking; }
00106 private:
00107 
00108     Header _header;
00109     Graphics::Surface *_surface;
00110     byte *_palette;
00111     Common::Array<PaletteRange> _paletteRanges;
00112     Type _type;
00113     uint16 _paletteColorCount;
00114     uint8 _numRelevantPlanes;
00115     bool _pixelPacking;
00116 
00117     void loadHeader(Common::SeekableReadStream &stream);
00118     void loadPalette(Common::SeekableReadStream &stream, const uint32 size);
00119     void loadPaletteRange(Common::SeekableReadStream &stream, const uint32 size);
00120     void loadBitmap(Common::SeekableReadStream &stream);
00121     void packPixels(byte *scanlines, byte *data, const uint16 scanlinePitch, const uint16 outPitch);
00122 };
00123 
00124 } // End of namespace Image
00125 
00126 #endif


Generated on Sat Jun 15 2019 05:01:22 for ResidualVM by doxygen 1.7.1
curved edge   curved edge