2012-08-26 18:46:47 +00:00
|
|
|
#ifedef _IMAGE_FILE_H_
|
|
|
|
#define _IMAGE_FILE_H_
|
|
|
|
|
2012-08-26 20:37:10 +00:00
|
|
|
enum EImageFileFormat {
|
|
|
|
eFileFormat_PNG,
|
|
|
|
|
|
|
|
kNumImageFileFormats
|
|
|
|
};
|
|
|
|
|
2012-08-26 18:46:47 +00:00
|
|
|
class ImageFile {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
ImageFile(const char *filename);
|
2012-08-26 20:37:10 +00:00
|
|
|
ImageFile(const char *filename, EImageFileFormat format);
|
2012-08-26 18:46:47 +00:00
|
|
|
~ImageFile();
|
|
|
|
|
|
|
|
void GetWidth() const { return m_Width; }
|
|
|
|
void GetHeight() const { return m_Height; }
|
2012-08-26 20:37:10 +00:00
|
|
|
const unsigned char *GetPixels() const { return m_PixelData; }
|
2012-08-26 18:46:47 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
unsigned int m_Handle;
|
|
|
|
unsigned int m_Width;
|
|
|
|
unsigned int m_Height;
|
2012-08-26 20:37:10 +00:00
|
|
|
unsigned char *m_PixelData;
|
|
|
|
const EImageFileFormat m_FileFormat;
|
|
|
|
|
|
|
|
static unsigned char *ReadFileData(const char *filename);
|
|
|
|
static EFileFormat DetectFileFormat(const char *filename);
|
|
|
|
|
|
|
|
bool LoadImage(const unsigned char *rawImageData);
|
|
|
|
bool LoadPNGImage(const unsigned char *rawImageData);
|
2012-08-26 18:46:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _IMAGE_FILE_H_
|