forked from spoutn1k/mcmap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pngreader.h
46 lines (40 loc) · 810 Bytes
/
pngreader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* PngReader.h
*
* Created on: 04.11.2010
* Author: Zahl
*/
#ifndef _PNGREADER_H_
#define _PNGREADER_H_
#include <stdint.h>
#include <cstdlib>
class PngReader
{
public:
enum PngColorType {
RGB,
RGBA,
GrayScale,
GrayScaleAlpha,
Palette,
Unknown
};
private:
uint8_t *_imageData;
uint32_t _width;
uint32_t _height;
PngColorType _chans;
int _bitDepth;
int _bytesPerPixel;
public:
PngReader(const char* filename);
virtual ~PngReader();
uint32_t getWidth() { return _width; }
uint32_t getHeight() { return _height; }
PngColorType getColorType() { return _chans; }
int getBitsPerChannel() { return _bitDepth; }
bool isValidImage() { return _imageData != NULL; }
uint8_t *getImageData() { return _imageData; }
int getBytesPerPixel() { return _bytesPerPixel; }
};
#endif