FasTC/IO/include/ImageFile.h

40 lines
931 B
C++

#ifndef _IMAGE_FILE_H_
#define _IMAGE_FILE_H_
#include "TexCompTypes.h"
#include "ImageFileFormat.h"
// Forward declare
class Image;
class CompressedImage;
struct SCompressionSettings;
// Class definition
class ImageFile {
public:
ImageFile(const char *filename);
ImageFile(const char *filename, EImageFileFormat format);
~ImageFile();
unsigned int GetWidth() const { return m_Width; }
unsigned int GetHeight() const { return m_Height; }
CompressedImage *Compress(const SCompressionSettings &) const;
Image *GetImage() const { return m_Image; }
private:
unsigned int m_Handle;
unsigned int m_Width;
unsigned int m_Height;
Image *m_Image;
const EImageFileFormat m_FileFormat;
static unsigned char *ReadFileData(const CHAR *filename);
static EImageFileFormat DetectFileFormat(const CHAR *filename);
Image *LoadImage(const unsigned char *rawImageData) const;
};
#endif // _IMAGE_FILE_H_