如何在Windows中捕获HDR Framebuffer
How to capture HDR framebuffer in Windows?
我使用以下代码读取标准的8位Framebuffer,但是我需要读取用于HDR Monitor上HDR内容的10位HDR Framebuffer。
据我所知,BI_RGB
是唯一相关的枚举选项。这是我到目前为止所拥有的,它适用于8位频道:
#include <iostream>
#include <windows.h>
#include <fstream>
void capture_screen() {
int nScreenWidth = GetSystemMetrics(SM_CXSCREEN);
int nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
HWND hDesktopWnd = GetDesktopWindow();
HDC hDesktopDC = GetDC(NULL);
HDC hCaptureDC = CreateCompatibleDC(hDesktopDC);
HBITMAP hCaptureBitmap = CreateCompatibleBitmap(hDesktopDC, nScreenWidth, nScreenHeight);
SelectObject(hCaptureDC, hCaptureBitmap);
BitBlt(hCaptureDC, 0, 0, nScreenWidth, nScreenHeight, hDesktopDC, 0, 0, SRCCOPY | CAPTUREBLT);
BITMAPINFO bmi = { 0 };
bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
bmi.bmiHeader.biWidth = nScreenWidth;
bmi.bmiHeader.biHeight = nScreenHeight;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
auto* pPixels = new RGBQUAD[nScreenWidth * nScreenHeight];
GetDIBits(hCaptureDC, hCaptureBitmap, 0,nScreenHeight, pPixels, &bmi, DIB_RGB_COLORS);
//...
delete[] pPixels;
ReleaseDC(hDesktopWnd, hDesktopDC);
DeleteDC(hCaptureDC);
DeleteObject(hCaptureBitmap);
}
Direct3D
已在最近的API更新中添加了与HDR相关的功能,该功能使用新的接口与最后一个数字。要访问它们,您必须首先查询其基础对象。
示例:
IDXGIOutput* output = /* initialize output */;
IDXGIOutput6* output6;
HRESULT hr = output->QueryInterface(__uuidof(IDXGIOutput6), (void**)&output6);
if(SUCCEEDED(hr)) {
// Use output6...
output6->Release();
} else {
// Error!
}
您只有在安装了Windows SDK的足够新版本的情况下才能成功编译此代码。仅当用户具有足够新版本的Windows 10。
然后,您可以通过调用功能IDXGIOUTPUT6 :: GETDESC1查询监视功能。您将获得结构DXGI_OUTPUT_DESC1填充,其中描述了可用的颜色空间,每个组件,红色/绿色/蓝色初选,白点以及设备上可用的亮度范围。
相关文章:
- 如何在生成文件中添加多个标头 (HDR) 和对象?
- 从具有不同曝光时间的图像中获取HDR图像
- OpenGL Framebuffer ColorAttachment to Compute Shader
- 如何在Windows中捕获HDR Framebuffer
- 如何在单独的视口和默认的framebuffer中使用framebuffer
- 使用GDI 从ADB Framebuffer绘制数据
- 在OpenCV中将LDR转换为HDR
- 是否可以将纹理作为渲染目标附加到默认的FrameBuffer
- 将卤化物与表示为浮点数组的 HDR 图像一起使用
- C++,使OpenCV 3.0.0与HDR API一起可用
- OpenGL HDR 值被钳制
- 在Android NDK上通过JNI从OpenGL ES Framebuffer创建位图图像
- 设置 GL 上下文时'framebuffer'的目的是什么?
- CCRenderTexture 在子线程中崩溃 - "Could not attach texture to framebuffer"
- 在GLFW3的glfwwindowint函数中,对framebuffer的几个组件使用位深的目的是什么?
- 延迟渲染:使用默认framebuffer中Gbuffer的深度缓冲区
- Framebuffer,不完整的纹理附件
- OpenGL FrameBuffer and glViewport
- Render the DepthTexture from a FrameBuffer
- 使用framebuffer对象组合图像