FasTC/IO/config/ImageWriter.h.in

48 lines
1.0 KiB
C
Raw Normal View History

2012-10-21 00:22:29 +02:00
#ifndef _IMAGE_WRITER_H_
#define _IMAGE_WRITER_H_
#include "ImageFileFormat.h"
#include "TexCompTypes.h"
class ImageWriter {
protected:
uint32 m_Width;
uint32 m_Height;
const uint8 *m_PixelData;
uint32 m_RawFileDataSz;
uint8 *m_RawFileData;
ImageWriter(const int width, const int height, const uint8 *rawData)
: m_PixelData(rawData)
, m_Width(width), m_Height(height)
, m_RawFileDataSz(256)
, m_RawFileData(new uint8[m_RawFileDataSz])
{ }
uint32 GetChannelForPixel(uint32 x, uint32 y, uint32 ch);
public:
virtual ~ImageWriter() {
if(m_RawFileData) {
delete m_RawFileData;
m_RawFileData = 0;
}
}
uint32 GetWidth() const { return m_Width; }
uint32 GetHeight() const { return m_Height; }
uint32 GetImageDataSz() const { return m_Width * m_Height * 4; }
2012-10-21 01:01:07 +02:00
uint32 GetRawFileDataSz() const { return m_RawFileDataSz; }
uint8 *GetRawFileData() const { return m_RawFileData; }
2012-10-21 00:22:29 +02:00
virtual bool WriteImage() = 0;
};
2012-10-21 01:01:07 +02:00
#ifndef PNG_FOUND
2012-10-21 00:22:29 +02:00
#cmakedefine PNG_FOUND
2012-10-21 01:01:07 +02:00
#endif // PNG_FOUND
2012-10-21 00:22:29 +02:00
#endif // _IMAGE_LOADER_H_