title: How to capture HDR framebuffer in Windows?
body: <p>I use the following code to read the standard 8-bit framebuffer, however I need to read the 10-bit HDR framebuffer that's used for HDR content on my HDR monitor.</p>
  
  <p>As far as I can tell, <code>BI_RGB</code> is the only relevant enum option. Here's what I have so far, which works for 8-bit channels:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;windows.h&gt;
  #include &lt;fstream&gt;
  
  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, &amp;bmi, DIB_RGB_COLORS);
  
   //...               
   delete[] pPixels;
  
   ReleaseDC(hDesktopWnd, hDesktopDC);
   DeleteDC(hCaptureDC);
   DeleteObject(hCaptureBitmap);
  }
  </code></pre>