mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2024-11-24 21:45:46 +01:00
48 lines
1.0 KiB
C
48 lines
1.0 KiB
C
#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; }
|
|
uint32 GetRawFileDataSz() const { return m_RawFileDataSz; }
|
|
uint8 *GetRawFileData() const { return m_RawFileData; }
|
|
virtual bool WriteImage() = 0;
|
|
};
|
|
|
|
#ifndef PNG_FOUND
|
|
#cmakedefine PNG_FOUND
|
|
#endif // PNG_FOUND
|
|
|
|
#endif // _IMAGE_LOADER_H_
|