mirror of
https://github.com/microsoft/DirectXTex.git
synced 2025-07-12 21:20:13 +02:00
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,
|
WIC_FLAGS_IGNORE_SRGB = 0x20,
|
||||||
// Ignores sRGB metadata if present in the file
|
// 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,
|
WIC_FLAGS_DITHER = 0x10000,
|
||||||
// Use ordered 4x4 dithering for any required conversions
|
// Use ordered 4x4 dithering for any required conversions
|
||||||
|
|
||||||
|
@ -570,6 +570,7 @@ namespace
|
|||||||
// Encodes image metadata
|
// Encodes image metadata
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
HRESULT EncodeMetadata(
|
HRESULT EncodeMetadata(
|
||||||
|
DWORD flags,
|
||||||
_In_ IWICBitmapFrameEncode* frame,
|
_In_ IWICBitmapFrameEncode* frame,
|
||||||
const GUID& containerFormat,
|
const GUID& containerFormat,
|
||||||
DXGI_FORMAT format)
|
DXGI_FORMAT format)
|
||||||
@ -584,7 +585,7 @@ namespace
|
|||||||
PROPVARIANT value;
|
PROPVARIANT value;
|
||||||
PropVariantInit(&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.vt = VT_LPSTR;
|
||||||
value.pszVal = const_cast<char*>("DirectXTex");
|
value.pszVal = const_cast<char*>("DirectXTex");
|
||||||
@ -715,7 +716,7 @@ namespace
|
|||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = EncodeMetadata(frame, containerFormat, image.format);
|
hr = EncodeMetadata(flags, frame, containerFormat, image.format);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user