Restructured Img and FontAtlas.

This commit is contained in:
2024-01-23 17:26:27 -08:00
parent 039ab8cc0f
commit 897d3b9120
13 changed files with 502 additions and 452 deletions

View File

@@ -21,10 +21,9 @@ namespace ehs
protected:
UInt_64 hashId;
Str_8 id;
UInt_8 bitDepth;
UInt_8 byteDepth;
UInt_8 channels;
UInt_64 width;
UInt_64 height;
Vec2_u64 resolution;
UInt_64 size;
Byte* data;
@@ -39,15 +38,15 @@ namespace ehs
static const ImgCodec* GetCodec(const Str_8& ext);
~Img();
~Img() override;
Img();
Img(Str_8 id);
Img(Str_8 id, UInt_8 bitDepth, UInt_8 channels, UInt_64 width, UInt_64 height, const Byte* data);
Img(Str_8 id, UInt_8 byteDepth, UInt_8 channels, const Vec2_u64& resolution, const Byte* data);
Img(Str_8 id, UInt_8 bitDepth, UInt_8 channels, UInt_64 width, UInt_64 height);
Img(Str_8 id, UInt_8 byteDepth, UInt_8 channels, const Vec2_u64& resolution);
Img(Img&& img) noexcept;
@@ -69,15 +68,15 @@ namespace ehs
Str_8 GetId() const;
UInt_8 BitDepth() const;
UInt_8 GetByteDepth() const;
UInt_8 Channels() const;
UInt_8 GetBitDepth() const;
UInt_64 Width() const;
UInt_8 GetChannels() const;
UInt_64 Height() const;
Vec2_u64 GetResolution() const;
UInt_64 Size() const;
UInt_64 GetSize() const;
void SetPixel(UInt_64 index, const Byte* pixel);
@@ -87,9 +86,9 @@ namespace ehs
void GetPixel(UInt_64 x, UInt_64 y, Byte* pixel) const;
void Resize(Resampling method, UInt_64 newWidth, UInt_64 newHeight);
void Resize(Resampling method, const Vec2_u64& newResolution);
Img GetResized(Resampling method, UInt_64 newWidth, UInt_64 newHeight) const;
Img GetResized(Resampling method, const Vec2_u64& newResolution) const;
void ToRGBA();
@@ -134,9 +133,9 @@ namespace ehs
static Img FromData(Str_8 id, const Str_8& ext, Serializer<UInt_64>& data);
private:
Img GetNearestNeighbor(UInt_64 newWidth, UInt_64 newHeight) const;
Img GetNearestNeighbor(const Vec2_u64& newResolution) const;
void NearestNeighbor(UInt_64 newWidth, UInt_64 newHeight);
void NearestNeighbor(const Vec2_u64& newResolution);
void RGB_To_RGBA(UInt_64 newSize, Byte* buffer) const;