Added WIC_FLAGS_FORCE_SRGB / LINEAR flags for WIC writer (#127)

This commit is contained in:
Chuck Walbourn 2018-12-07 15:44:31 -08:00 committed by GitHub
parent 18c93ab11b
commit cd8a682ca2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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<char*>("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;