1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 12:00:06 +00:00

ScreenGrab updated to use non-sRGB metadataa for PNG

This commit is contained in:
Chuck Walbourn 2017-09-19 11:39:39 -07:00
parent 3a4748ddeb
commit 8ae822241a
3 changed files with 25 additions and 6 deletions

View File

@ -599,13 +599,12 @@ namespace
value.bVal = 0;
(void)metawriter->SetMetadataByName(L"/sRGB/RenderingIntent", &value);
}
// linear space.
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 );
(void)metawriter->SetMetadataByName(L"/gAMA/ImageGamma", &value);
// remove sRGB chunk which is added by default.
(void)metawriter->RemoveMetadataByName(L"/sRGB/RenderingIntent");

View File

@ -1102,11 +1102,21 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
(void)metawriter->SetMetadataByName( L"/tEXt/{str=Software}", &value );
// Set sRGB chunk
if ( sRGB )
if (sRGB)
{
value.vt = VT_UI1;
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

View File

@ -1202,11 +1202,21 @@ HRESULT DirectX::SaveWICTextureToFile( ID3D12CommandQueue* pCommandQ,
(void)metawriter->SetMetadataByName( L"/tEXt/{str=Software}", &value );
// Set sRGB chunk
if ( sRGB )
if (sRGB)
{
value.vt = VT_UI1;
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