mirror of
https://github.com/microsoft/DirectXTex.git
synced 2025-07-09 19:50:13 +02:00
ScreenGrab updated to use non-sRGB metadataa for PNG
This commit is contained in:
parent
3a4748ddeb
commit
8ae822241a
@ -599,13 +599,12 @@ namespace
|
|||||||
value.bVal = 0;
|
value.bVal = 0;
|
||||||
(void)metawriter->SetMetadataByName(L"/sRGB/RenderingIntent", &value);
|
(void)metawriter->SetMetadataByName(L"/sRGB/RenderingIntent", &value);
|
||||||
}
|
}
|
||||||
// linear space.
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// add gAMA chunk with gamma 1.0
|
// add gAMA chunk with gamma 1.0
|
||||||
value.vt = VT_UI4;
|
value.vt = VT_UI4;
|
||||||
value.uintVal = 100000; // gama value * 100,000 -- i.e. gamma 1.0
|
value.uintVal = 100000; // gama value * 100,000 -- i.e. gamma 1.0
|
||||||
(void)metawriter->SetMetadataByName( L"/gAMA/ImageGamma", &value );
|
(void)metawriter->SetMetadataByName(L"/gAMA/ImageGamma", &value);
|
||||||
|
|
||||||
// remove sRGB chunk which is added by default.
|
// remove sRGB chunk which is added by default.
|
||||||
(void)metawriter->RemoveMetadataByName(L"/sRGB/RenderingIntent");
|
(void)metawriter->RemoveMetadataByName(L"/sRGB/RenderingIntent");
|
||||||
|
@ -1102,11 +1102,21 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
|||||||
(void)metawriter->SetMetadataByName( L"/tEXt/{str=Software}", &value );
|
(void)metawriter->SetMetadataByName( L"/tEXt/{str=Software}", &value );
|
||||||
|
|
||||||
// Set sRGB chunk
|
// Set sRGB chunk
|
||||||
if ( sRGB )
|
if (sRGB)
|
||||||
{
|
{
|
||||||
value.vt = VT_UI1;
|
value.vt = VT_UI1;
|
||||||
value.bVal = 0;
|
value.bVal = 0;
|
||||||
(void)metawriter->SetMetadataByName( L"/sRGB/RenderingIntent", &value );
|
(void)metawriter->SetMetadataByName(L"/sRGB/RenderingIntent", &value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add gAMA chunk with gamma 1.0
|
||||||
|
value.vt = VT_UI4;
|
||||||
|
value.uintVal = 100000; // gama value * 100,000 -- i.e. gamma 1.0
|
||||||
|
(void)metawriter->SetMetadataByName(L"/gAMA/ImageGamma", &value);
|
||||||
|
|
||||||
|
// remove sRGB chunk which is added by default.
|
||||||
|
(void)metawriter->RemoveMetadataByName(L"/sRGB/RenderingIntent");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1202,11 +1202,21 @@ HRESULT DirectX::SaveWICTextureToFile( ID3D12CommandQueue* pCommandQ,
|
|||||||
(void)metawriter->SetMetadataByName( L"/tEXt/{str=Software}", &value );
|
(void)metawriter->SetMetadataByName( L"/tEXt/{str=Software}", &value );
|
||||||
|
|
||||||
// Set sRGB chunk
|
// Set sRGB chunk
|
||||||
if ( sRGB )
|
if (sRGB)
|
||||||
{
|
{
|
||||||
value.vt = VT_UI1;
|
value.vt = VT_UI1;
|
||||||
value.bVal = 0;
|
value.bVal = 0;
|
||||||
(void)metawriter->SetMetadataByName( L"/sRGB/RenderingIntent", &value );
|
(void)metawriter->SetMetadataByName(L"/sRGB/RenderingIntent", &value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add gAMA chunk with gamma 1.0
|
||||||
|
value.vt = VT_UI4;
|
||||||
|
value.uintVal = 100000; // gama value * 100,000 -- i.e. gamma 1.0
|
||||||
|
(void)metawriter->SetMetadataByName(L"/gAMA/ImageGamma", &value);
|
||||||
|
|
||||||
|
// remove sRGB chunk which is added by default.
|
||||||
|
(void)metawriter->RemoveMetadataByName(L"/sRGB/RenderingIntent");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user