Added WIC_FLAGS_FORCE_SRGB / LINEAR flags for WIC writer (#127)
This commit is contained in:
parent
18c93ab11b
commit
cd8a682ca2
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user