FasTC/IO/include/ImageFile.h

48 lines
1.2 KiB
C
Raw Normal View History

#ifndef _IMAGE_FILE_H_
2012-08-26 20:46:47 +02:00
#define _IMAGE_FILE_H_
#include "TexCompTypes.h"
#include "ImageFileFormat.h"
// Forward declare
class Image;
class CompressedImage;
struct SCompressionSettings;
// Class definition
2012-08-26 20:46:47 +02:00
class ImageFile {
public:
ImageFile(const char *filename);
ImageFile(const char *filename, EImageFileFormat format);
ImageFile(const char *filename, EImageFileFormat format, const Image &);
2012-08-26 20:46:47 +02:00
~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; }
2012-08-26 20:46:47 +02:00
bool Load();
bool Write();
2012-08-26 20:46:47 +02:00
private:
static const unsigned int kMaxFilenameSz = 256;
char m_Filename[kMaxFilenameSz];
2012-08-26 20:46:47 +02:00
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);
2012-10-21 01:01:07 +02:00
static bool WriteImageDataToFile(const uint8 *data, const uint32 dataSz, const CHAR *filename);
static EImageFileFormat DetectFileFormat(const CHAR *filename);
Image *LoadImage(const unsigned char *rawImageData) const;
2012-08-26 20:46:47 +02:00
};
#endif // _IMAGE_FILE_H_