mirror of
https://github.com/microsoft/DirectXTex
synced 2024-11-21 12:00:06 +00:00
Added optional forceSRGB parameter to SaveWICTextureToFile (#148)
This commit is contained in:
parent
f4954ce11b
commit
156af67b8c
@ -936,7 +936,8 @@ HRESULT DirectX::SaveWICTextureToFile(
|
||||
REFGUID guidContainerFormat,
|
||||
const wchar_t* fileName,
|
||||
const GUID* targetFormat,
|
||||
std::function<void(IPropertyBag2*)> setCustomProps )
|
||||
std::function<void(IPropertyBag2*)> setCustomProps,
|
||||
bool forceSRGB)
|
||||
{
|
||||
if ( !fileName )
|
||||
return E_INVALIDARG;
|
||||
@ -949,7 +950,7 @@ HRESULT DirectX::SaveWICTextureToFile(
|
||||
|
||||
// Determine source format's WIC equivalent
|
||||
WICPixelFormatGUID pfGuid;
|
||||
bool sRGB = false;
|
||||
bool sRGB = forceSRGB;
|
||||
switch ( desc.Format )
|
||||
{
|
||||
case DXGI_FORMAT_R32G32B32A32_FLOAT: pfGuid = GUID_WICPixelFormat128bppRGBAFloat; break;
|
||||
|
@ -20,20 +20,22 @@
|
||||
#include <d3d11_1.h>
|
||||
|
||||
#include <OCIdl.h>
|
||||
#include <stdint.h>
|
||||
#include <functional>
|
||||
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
HRESULT SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
||||
_In_ ID3D11Resource* pSource,
|
||||
_In_z_ const wchar_t* fileName );
|
||||
HRESULT __cdecl SaveDDSTextureToFile(
|
||||
_In_ ID3D11DeviceContext* pContext,
|
||||
_In_ ID3D11Resource* pSource,
|
||||
_In_z_ const wchar_t* fileName);
|
||||
|
||||
HRESULT SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
||||
_In_ ID3D11Resource* pSource,
|
||||
_In_ REFGUID guidContainerFormat,
|
||||
_In_z_ const wchar_t* fileName,
|
||||
_In_opt_ const GUID* targetFormat = nullptr,
|
||||
_In_opt_ std::function<void(IPropertyBag2*)> setCustomProps = nullptr );
|
||||
HRESULT __cdecl SaveWICTextureToFile(
|
||||
_In_ ID3D11DeviceContext* pContext,
|
||||
_In_ ID3D11Resource* pSource,
|
||||
_In_ REFGUID guidContainerFormat,
|
||||
_In_z_ const wchar_t* fileName,
|
||||
_In_opt_ const GUID* targetFormat = nullptr,
|
||||
_In_opt_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr,
|
||||
_In_ bool forceSRGB = false);
|
||||
}
|
||||
|
@ -1050,7 +1050,8 @@ HRESULT DirectX::SaveWICTextureToFile(
|
||||
D3D12_RESOURCE_STATES beforeState,
|
||||
D3D12_RESOURCE_STATES afterState,
|
||||
const GUID* targetFormat,
|
||||
std::function<void(IPropertyBag2*)> setCustomProps )
|
||||
std::function<void(IPropertyBag2*)> setCustomProps,
|
||||
bool forceSRGB)
|
||||
{
|
||||
if ( !fileName )
|
||||
return E_INVALIDARG;
|
||||
@ -1091,7 +1092,7 @@ HRESULT DirectX::SaveWICTextureToFile(
|
||||
|
||||
// Determine source format's WIC equivalent
|
||||
WICPixelFormatGUID pfGuid;
|
||||
bool sRGB = false;
|
||||
bool sRGB = forceSRGB;
|
||||
switch ( desc.Format )
|
||||
{
|
||||
case DXGI_FORMAT_R32G32B32A32_FLOAT: pfGuid = GUID_WICPixelFormat128bppRGBAFloat; break;
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <d3d12.h>
|
||||
|
||||
#include <OCIdl.h>
|
||||
#include <stdint.h>
|
||||
#include <functional>
|
||||
|
||||
|
||||
@ -41,5 +40,6 @@ namespace DirectX
|
||||
D3D12_RESOURCE_STATES beforeState = D3D12_RESOURCE_STATE_RENDER_TARGET,
|
||||
D3D12_RESOURCE_STATES afterState = D3D12_RESOURCE_STATE_RENDER_TARGET,
|
||||
_In_opt_ const GUID* targetFormat = nullptr,
|
||||
_In_opt_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr);
|
||||
_In_opt_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr,
|
||||
bool forceSRGB = false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user