2012-09-28 19:07:28 +00:00
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
// File: ScreenGrab.h
|
|
|
|
//
|
|
|
|
// Function for capturing a 2D texture and saving it to a file (aka a 'screenshot'
|
|
|
|
// when used on a Direct3D 11 Render Target).
|
|
|
|
//
|
|
|
|
// Note these functions are useful as a light-weight runtime screen grabber. For
|
|
|
|
// full-featured texture capture, DDS writer, and texture processing pipeline,
|
|
|
|
// see the 'Texconv' sample and the 'DirectXTex' library.
|
|
|
|
//
|
|
|
|
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
|
|
|
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
|
|
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
|
|
|
// PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
//
|
|
|
|
// http://go.microsoft.com/fwlink/?LinkId=248926
|
|
|
|
// http://go.microsoft.com/fwlink/?LinkId=248929
|
|
|
|
//--------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma once
|
|
|
|
#endif
|
|
|
|
|
2014-04-03 19:43:46 +00:00
|
|
|
#include <d3d11_1.h>
|
2012-09-28 19:07:28 +00:00
|
|
|
|
2013-06-27 18:05:15 +00:00
|
|
|
#include <ocidl.h>
|
|
|
|
|
2012-09-28 19:07:28 +00:00
|
|
|
#pragma warning(push)
|
|
|
|
#pragma warning(disable : 4005)
|
|
|
|
#include <stdint.h>
|
|
|
|
#pragma warning(pop)
|
|
|
|
|
2013-06-27 18:05:15 +00:00
|
|
|
#include <functional>
|
|
|
|
|
2012-09-28 19:07:28 +00:00
|
|
|
namespace DirectX
|
|
|
|
{
|
|
|
|
HRESULT SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
|
|
|
_In_ ID3D11Resource* pSource,
|
|
|
|
_In_z_ LPCWSTR fileName );
|
|
|
|
|
2014-04-03 19:43:46 +00:00
|
|
|
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (_WIN32_WINNT > _WIN32_WINNT_WIN8)
|
2012-10-31 00:31:19 +00:00
|
|
|
|
2012-09-28 19:07:28 +00:00
|
|
|
HRESULT SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext,
|
|
|
|
_In_ ID3D11Resource* pSource,
|
|
|
|
_In_ REFGUID guidContainerFormat,
|
|
|
|
_In_z_ LPCWSTR fileName,
|
2013-06-27 18:05:15 +00:00
|
|
|
_In_opt_ const GUID* targetFormat = nullptr,
|
|
|
|
_In_opt_ std::function<void(IPropertyBag2*)> setCustomProps = nullptr );
|
2012-10-31 00:31:19 +00:00
|
|
|
|
|
|
|
#endif
|
2012-09-28 19:07:28 +00:00
|
|
|
}
|