网站: www.wisenheimerbrainstorm.com 解决方案 您好ata6502, 根据您的描述,此问题与DX有关。我将其移至DX相关论坛,以便您获得更好的支持。 感谢您的理解。 问候。 Hi,I'm trying to use the SaveWICTextureToFile utility from DirectXTK to grab a screenshot. I'm using XAML with a SwapChainPanel element. Unfortunately, the method always saves a rectangle filled with solid color rather than the current screenshot. Every time I call the SaveWICTextureToFile method is saves a different color. This is my code (somewhat simplified):void DirectXPage::SaveButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e){ critical_section::scoped_lock lock(m_main->GetCriticalSection()); auto folder = Windows::Storage::ApplicationData::Current->TemporaryFolder; WCHAR fname[_MAX_PATH]; wcscpy_s(fname, folder->Path->Data()); wcscat_s(fname, L"\\screenshot.png"); auto context = m_deviceResources->GetD3DDeviceContext(); auto swapChain = m_deviceResources->GetSwapChain(); ID3D11Texture2D* backBuffer = nullptr; HRESULT hr = swapChain->GetBuffer(0, __uuidof(*backBuffer), (LPVOID*)&backBuffer); if (SUCCEEDED(hr)) { HRESULT hr = SaveWICTextureToFile(context, backBuffer, GUID_ContainerFormatPng, fname); DX::ThrowIfFailed(hr); // ... mode code for FileSavePicker etc. }}What am I doing wrong?Thanks,LeszekWiki: wbswiki.comWebsite: www.wisenheimerbrainstorm.com 解决方案 Hello ata6502,From your description, this issue is related with DX. I move it to the DX related forum so that you could get better support.Thanks for your understanding.Regards. 这篇关于[DX 11.2] [XAML] [C ++] [DirectXTK] SaveWICTextureToFile和SwapChainPanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-19 02:46