1 /* ScummVM - Graphic Adventure Engine
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.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
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.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #ifndef GRAPHICS_IMAGEDEC_H
26 #define GRAPHICS_IMAGEDEC_H
28 #include "common/scummsys.h"
29 #include "common/str.h"
30 #include "common/stream.h"
32 #include "graphics/surface.h"
33 #include "graphics/pixelformat.h"
40 virtual ~ImageDecoder() {}
42 static Surface
*loadFile(const Common::String
&name
, const PixelFormat
&format
);
43 static Surface
*loadFile(Common::SeekableReadStream
&stream
, const PixelFormat
&format
);
46 * checks if the data can be decoded by this decoder
48 * @param stream memory read stream
49 * @return true if it can be decoded, otherwise false
51 virtual bool decodeable(Common::SeekableReadStream
&stream
) = 0;
54 * decodes the data and returns an pointer to the resulting surface.
55 * Surface::free() must be called by the user also it must be deleted
58 * @param stream the memory stream which should be decoded
59 * @param format the pixel format used to generate the surface
60 * @return returns a new surface if the image could be decoded, otherwise 0
62 virtual Surface
*decodeImage(Common::SeekableReadStream
&stream
, const PixelFormat
&format
) = 0;
64 } // end of namespace Graphics