mirror of
https://github.com/microsoft/DirectXTex.git
synced 2025-07-09 11:40:14 +02: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,
|
REFGUID guidContainerFormat,
|
||||||
const wchar_t* fileName,
|
const wchar_t* fileName,
|
||||||
const GUID* targetFormat,
|
const GUID* targetFormat,
|
||||||
std::function<void(IPropertyBag2*)> setCustomProps )
|
std::function<void(IPropertyBag2*)> setCustomProps,
|
||||||
|
bool forceSRGB)
|
||||||
{
|
{
|
||||||
if ( !fileName )
|
if ( !fileName )
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
@ -949,7 +950,7 @@ HRESULT DirectX::SaveWICTextureToFile(
|
|||||||
|
|
||||||
// Determine source format's WIC equivalent
|
// Determine source format's WIC equivalent
|
||||||
WICPixelFormatGUID pfGuid;
|
WICPixelFormatGUID pfGuid;
|
||||||
bool sRGB = false;
|
bool sRGB = forceSRGB;
|
||||||
switch ( desc.Format )
|
switch ( desc.Format )
|
||||||
{
|
{
|
||||||
case DXGI_FORMAT_R32G32B32A32_FLOAT: pfGuid = GUID_WICPixelFormat128bppRGBAFloat; break;
|
case DXGI_FORMAT_R32G32B32A32_FLOAT: pfGuid = GUID_WICPixelFormat128bppRGBAFloat; break;
|
||||||
|
@ -20,20 +20,22 @@
|
|||||||
#include <d3d11_1.h>
|
#include <d3d11_1.h>
|
||||||
|
|
||||||
#include <OCIdl.h>
|
#include <OCIdl.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
HRESULT SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
HRESULT __cdecl SaveDDSTextureToFile(
|
||||||
|
_In_ ID3D11DeviceContext* pContext,
|
||||||
_In_ ID3D11Resource* pSource,
|
_In_ ID3D11Resource* pSource,
|
||||||
_In_z_ const wchar_t* fileName);
|
_In_z_ const wchar_t* fileName);
|
||||||
|
|
||||||
HRESULT SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
HRESULT __cdecl SaveWICTextureToFile(
|
||||||
|
_In_ ID3D11DeviceContext* pContext,
|
||||||
_In_ ID3D11Resource* pSource,
|
_In_ ID3D11Resource* pSource,
|
||||||
_In_ REFGUID guidContainerFormat,
|
_In_ REFGUID guidContainerFormat,
|
||||||
_In_z_ const wchar_t* fileName,
|
_In_z_ const wchar_t* fileName,
|
||||||
_In_opt_ const GUID* targetFormat = nullptr,
|
_In_opt_ const GUID* targetFormat = nullptr,
|
||||||
_In_opt_ std::function<void(IPropertyBag2*)> setCustomProps = 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 beforeState,
|
||||||
D3D12_RESOURCE_STATES afterState,
|
D3D12_RESOURCE_STATES afterState,
|
||||||
const GUID* targetFormat,
|
const GUID* targetFormat,
|
||||||
std::function<void(IPropertyBag2*)> setCustomProps )
|
std::function<void(IPropertyBag2*)> setCustomProps,
|
||||||
|
bool forceSRGB)
|
||||||
{
|
{
|
||||||
if ( !fileName )
|
if ( !fileName )
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
@ -1091,7 +1092,7 @@ HRESULT DirectX::SaveWICTextureToFile(
|
|||||||
|
|
||||||
// Determine source format's WIC equivalent
|
// Determine source format's WIC equivalent
|
||||||
WICPixelFormatGUID pfGuid;
|
WICPixelFormatGUID pfGuid;
|
||||||
bool sRGB = false;
|
bool sRGB = forceSRGB;
|
||||||
switch ( desc.Format )
|
switch ( desc.Format )
|
||||||
{
|
{
|
||||||
case DXGI_FORMAT_R32G32B32A32_FLOAT: pfGuid = GUID_WICPixelFormat128bppRGBAFloat; break;
|
case DXGI_FORMAT_R32G32B32A32_FLOAT: pfGuid = GUID_WICPixelFormat128bppRGBAFloat; break;
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include <d3d12.h>
|
#include <d3d12.h>
|
||||||
|
|
||||||
#include <OCIdl.h>
|
#include <OCIdl.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
|
||||||
@ -41,5 +40,6 @@ namespace DirectX
|
|||||||
D3D12_RESOURCE_STATES beforeState = D3D12_RESOURCE_STATE_RENDER_TARGET,
|
D3D12_RESOURCE_STATES beforeState = D3D12_RESOURCE_STATE_RENDER_TARGET,
|
||||||
D3D12_RESOURCE_STATES afterState = D3D12_RESOURCE_STATE_RENDER_TARGET,
|
D3D12_RESOURCE_STATES afterState = D3D12_RESOURCE_STATE_RENDER_TARGET,
|
||||||
_In_opt_ const GUID* targetFormat = nullptr,
|
_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…
x
Reference in New Issue
Block a user