ScummVM API documentation
png_loader.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 PSP_PNG_IMAGE_H
23#define PSP_PNG_IMAGE_H
24
25#include <png.h>
26
27class PngLoader {
28private:
29 bool basicImageLoad(); // common operation
30 bool findImageDimensions(); // find dimensions of a given PNG file
31 bool loadImageIntoBuffer();
32
33 static void warningFn(png_structp png_ptr, png_const_charp warning_msg);
34 static void errorFn(png_structp png_ptr, png_const_charp warning_msg);
35 static void libReadFunc(png_structp pngPtr, png_bytep data, png_size_t length);
36
38 Buffer *_buffer;
39 Palette *_palette;
40
41 uint32 _width;
42 uint32 _height;
43 uint32 _paletteSize;
44 Buffer::HowToSize _sizeBy;
45
46 // PNG lib values
47 int _bitDepth;
48 png_structp _pngPtr;
49 png_infop _infoPtr;
50 int _colorType;
51 uint32 _channels;
52
53public:
54 enum Status {
55 OK,
56 OUT_OF_MEMORY,
57 BAD_FILE
58 };
59
60 PngLoader(Common::SeekableReadStream &file, Buffer &buffer, Palette &palette,
61 Buffer::HowToSize sizeBy = Buffer::kSizeByTextureSize) :
62 _file(file), _buffer(&buffer), _palette(&palette),
63 _width(0), _height(0), _paletteSize(0),
64 _bitDepth(0), _sizeBy(sizeBy), _pngPtr(0),
65 _infoPtr(0), _colorType(0), _channels(0) {}
66 ~PngLoader();
67
68 PngLoader::Status allocate();
69 bool load();
70};
71
72#endif /* PSP_PNG_IMAGE_H */
Definition: display_client.h:113
Definition: stream.h:745
Definition: atari-screen.h:42
Definition: png_loader.h:27