// // Created by sfd on 25-9-21. // #ifndef DXT_H #define DXT_H #include #include namespace PKG { enum class DXTFlags { DXT1 = 1, DXT3 = 1 << 1, DXT5 = 1 << 2, }; class DXT { public: // public static byte[] DecompressImage(int width, int height, byte[] data, DXTFlags flags) static void DecompressImage(int width, int height, std::vector& data, DXTFlags flags); private: static void Decompress(std::vector& rgba, std::vector& block, int blockIndex, DXTFlags flags); static int UnPack565(std::vector& block, int blockIndex, int packedOffset, std::vector& color, int colorOffset); static void DecompressColor(std::vector& rgba, std::vector& block, int blockIndex, bool isDxt1); static void DecompressAlphaDxt3(std::vector& rgba, std::vector& block, int blockIndex); static void DecompressAlphaDxt5(std::vector& rgba, std::vector& block, int blockIndex); }; } #endif //DXT_H