mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
52 lines
1 KiB
C++
52 lines
1 KiB
C++
#ifndef __nDraw_plugin_png__
|
|
#define __nDraw_plugin_png__
|
|
|
|
#include <Draw/Draw.h>
|
|
|
|
namespace Upp {
|
|
|
|
INITIALIZE(PNGRaster);
|
|
|
|
class PNGRaster : public StreamRaster {
|
|
class Data;
|
|
One<Data> data;
|
|
|
|
public:
|
|
PNGRaster();
|
|
~PNGRaster();
|
|
|
|
virtual bool Create();
|
|
virtual Size GetSize();
|
|
virtual Info GetInfo();
|
|
virtual Line GetLine(int line);
|
|
virtual const RGBA *GetPalette();
|
|
virtual const RasterFormat *GetFormat();
|
|
|
|
private:
|
|
bool Init();
|
|
};
|
|
|
|
class PNGEncoder : public StreamRasterEncoder {
|
|
class Data;
|
|
One<Data> data;
|
|
|
|
public:
|
|
PNGEncoder(int bpp = 32, ImageKind kind = IMAGE_UNKNOWN, bool interlace = false);
|
|
~PNGEncoder();
|
|
|
|
virtual int GetPaletteCount();
|
|
virtual void Start(Size sz);
|
|
virtual void WriteLineRaw(const byte *data);
|
|
|
|
PNGEncoder& Bpp(int b) { bpp = b; return *this; }
|
|
PNGEncoder& Interlace(int b = true) { interlace = b; return *this; }
|
|
|
|
private:
|
|
int bpp;
|
|
ImageKind kind;
|
|
bool interlace;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|