diff --git a/DirectXTex/DirectXTex.h b/DirectXTex/DirectXTex.h index 7427316..9e36d04 100644 --- a/DirectXTex/DirectXTex.h +++ b/DirectXTex/DirectXTex.h @@ -194,6 +194,12 @@ namespace DirectX WIC_FLAGS_IGNORE_SRGB = 0x20, // Ignores sRGB metadata if present in the file + WIC_FLAGS_FORCE_SRGB = 0x40, + // Writes sRGB metadata into the file reguardless of format + + WIC_FLAGS_FORCE_LINEAR = 0x80, + // Writes linear gamma metadata into the file reguardless of format + WIC_FLAGS_DITHER = 0x10000, // Use ordered 4x4 dithering for any required conversions diff --git a/DirectXTex/DirectXTexWIC.cpp b/DirectXTex/DirectXTexWIC.cpp index f5cb6d8..dabf9cf 100644 --- a/DirectXTex/DirectXTexWIC.cpp +++ b/DirectXTex/DirectXTexWIC.cpp @@ -570,6 +570,7 @@ namespace // Encodes image metadata //------------------------------------------------------------------------------------- HRESULT EncodeMetadata( + DWORD flags, _In_ IWICBitmapFrameEncode* frame, const GUID& containerFormat, DXGI_FORMAT format) @@ -584,7 +585,7 @@ namespace PROPVARIANT value; PropVariantInit(&value); - bool sRGB = IsSRGB(format); + bool sRGB = ((flags & WIC_FLAGS_FORCE_LINEAR) == 0) && ((flags & WIC_FLAGS_FORCE_SRGB) != 0 || IsSRGB(format)); value.vt = VT_LPSTR; value.pszVal = const_cast("DirectXTex"); @@ -715,7 +716,7 @@ namespace return E_FAIL; } - hr = EncodeMetadata(frame, containerFormat, image.format); + hr = EncodeMetadata(flags, frame, containerFormat, image.format); if (FAILED(hr)) return hr;