Rework libpng Auxiliary support to address numerous problems (#636)

This commit is contained in:
Chuck Walbourn
2025-10-21 23:02:38 -07:00
committed by GitHub
parent 0b4d5f6541
commit 264931b2e1
6 changed files with 214 additions and 67 deletions

View File

@@ -18,16 +18,51 @@
namespace DirectX
{
enum PNG_FLAGS : uint32_t
{
PNG_FLAGS_NONE = 0x0,
PNG_FLAGS_BGR = 0x1,
// 24bpp files are returned as BGRX; 32bpp files are returned as BGRA
PNG_FLAGS_IGNORE_SRGB = 0x2,
// Ignores sRGB rendering intent
PNG_FLAGS_DEFAULT_LINEAR = 0x4,
// If no gamma or intent is specified assume linear
PNG_FLAGS_FORCE_SRGB = 0x20,
// Writes sRGB metadata into the file reguardless of format
PNG_FLAGS_FORCE_LINEAR = 0x40,
// Writes linear gamma metadata into the file reguardless of format
};
DIRECTX_TEX_API HRESULT __cdecl GetMetadataFromPNGFile(
_In_z_ const wchar_t* szFile,
PNG_FLAGS flags,
_Out_ TexMetadata& metadata);
DIRECTX_TEX_API HRESULT __cdecl LoadFromPNGFile(
_In_z_ const wchar_t* szFile,
PNG_FLAGS flags,
_Out_opt_ TexMetadata* metadata,
_Out_ ScratchImage& image);
DIRECTX_TEX_API HRESULT __cdecl SaveToPNGFile(
_In_ const Image& image,
PNG_FLAGS flags,
_In_z_ const wchar_t* szFile);
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
#pragma clang diagnostic ignored "-Wextra-semi-stmt"
#endif
DEFINE_ENUM_FLAG_OPERATORS(PNG_FLAGS);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}