2024-02-05 22:25:30 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ehs/EHS.h"
|
|
|
|
#include "ehs/Serializer.h"
|
|
|
|
#include "PNG_Chunk.h"
|
|
|
|
#include "Img.h"
|
|
|
|
|
|
|
|
namespace ehs
|
|
|
|
{
|
2024-07-24 01:36:20 -07:00
|
|
|
class EHS_LIB_IO PNG
|
2024-02-05 22:25:30 -08:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
Str_8 id;
|
|
|
|
UInt_64 hashId;
|
|
|
|
Array<PNG_Chunk> chunks;
|
|
|
|
|
|
|
|
public:
|
|
|
|
PNG();
|
|
|
|
|
|
|
|
PNG(const Str_8& filePath);
|
|
|
|
|
|
|
|
PNG(const Str_8& id, Serializer<UInt_64>& data);
|
|
|
|
|
|
|
|
PNG(const PNG& png);
|
|
|
|
|
|
|
|
PNG& operator=(const PNG& png);
|
|
|
|
|
|
|
|
bool HasChunk(const UInt_64 hashId) const;
|
|
|
|
|
|
|
|
bool HasChunk(const Str_8& id) const;
|
|
|
|
|
|
|
|
PNG_Chunk* GetChunk(const UInt_64 hashId);
|
|
|
|
|
|
|
|
PNG_Chunk* GetChunk(const Str_8& id);
|
|
|
|
|
|
|
|
static bool IsPNG(Serializer<UInt_32>& data);
|
|
|
|
|
|
|
|
static void FilterNone(const Byte* const in, Byte* const out, const UInt_8 bitDepth, const UInt_8 channels, const UInt_32 scanline);
|
|
|
|
|
|
|
|
static void FilterSub(const Byte* const in, Byte* const out, const UInt_8 bitDepth, const UInt_8 channels, const UInt_32 scanline);
|
|
|
|
|
|
|
|
static void FilterUp(const Byte* const in, Byte* const out, const UInt_8 bitDepth, const UInt_8 channels, const UInt_32 scanline);
|
|
|
|
|
|
|
|
static void FilterAverage(const Byte* const in, Byte* const out, const UInt_8 bitDepth, const UInt_8 channels, const UInt_32 scanline);
|
|
|
|
|
|
|
|
static void FilterPaeth(const Byte* const in, Byte* const out, const UInt_8 bitDepth, const UInt_8 channels, const UInt_32 scanline);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static Byte PaethPredictor(const Byte a, const Byte b, const Byte c);
|
|
|
|
};
|
|
|
|
}
|