Refine editor host boundary
This commit is contained in:
42
editor/app/Host/D3D12/D3D12WindowCapture.h
Normal file
42
editor/app/Host/D3D12/D3D12WindowCapture.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <wincodec.h>
|
||||
#include <wrl/client.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
namespace XCEngine::UI::Editor::Host {
|
||||
|
||||
class D3D12WindowRenderer;
|
||||
|
||||
class D3D12WindowCapture {
|
||||
public:
|
||||
bool CaptureCurrentBackBufferToPng(
|
||||
const D3D12WindowRenderer& windowRenderer,
|
||||
const std::filesystem::path& outputPath,
|
||||
std::string& outError);
|
||||
void Shutdown();
|
||||
|
||||
private:
|
||||
bool EnsureWicFactory(std::string& outError);
|
||||
bool EncodePng(
|
||||
const std::filesystem::path& outputPath,
|
||||
const std::uint8_t* pixels,
|
||||
UINT width,
|
||||
UINT height,
|
||||
UINT rowPitch,
|
||||
REFWICPixelFormatGUID pixelFormat,
|
||||
std::string& outError) const;
|
||||
|
||||
Microsoft::WRL::ComPtr<IWICImagingFactory> m_wicFactory = {};
|
||||
bool m_wicComInitialized = false;
|
||||
};
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Host
|
||||
Reference in New Issue
Block a user