From f771a62298dd935a1ec6f746b738a2a82aab352d Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sun, 1 Nov 2026 09:45:59 +0400 Subject: fix(tools): preserve opaque framebuffer RGB in captures --- tools/native-frame-capture/convert-viewer-readback.ps1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tools/native-frame-capture/convert-viewer-readback.ps1') diff --git a/tools/native-frame-capture/convert-viewer-readback.ps1 b/tools/native-frame-capture/convert-viewer-readback.ps1 index 3bafe14..17c136a 100644 --- a/tools/native-frame-capture/convert-viewer-readback.ps1 +++ b/tools/native-frame-capture/convert-viewer-readback.ps1 @@ -118,7 +118,7 @@ function Save-BgraPngToStream { $bitmap = New-Object System.Drawing.Bitmap( $Width, $Height, - [System.Drawing.Imaging.PixelFormat]::Format32bppArgb + [System.Drawing.Imaging.PixelFormat]::Format32bppRgb ) $rectangle = New-Object System.Drawing.Rectangle(0, 0, $Width, $Height) $bitmapData = $null @@ -126,7 +126,7 @@ function Save-BgraPngToStream { $bitmapData = $bitmap.LockBits( $rectangle, [System.Drawing.Imaging.ImageLockMode]::WriteOnly, - [System.Drawing.Imaging.PixelFormat]::Format32bppArgb + [System.Drawing.Imaging.PixelFormat]::Format32bppRgb ) $rowBytes = $Width * 4 @@ -201,12 +201,12 @@ function Get-CameraExtent { function Invoke-SelfTest { $rgba = [byte[]]@( - 255, 0, 0, 255, 0, 255, 0, 255, - 0, 0, 255, 255, 255, 255, 255, 255 + 255, 0, 0, 0, 0, 255, 0, 64, + 0, 0, 255, 128, 255, 255, 255, 255 ) $expectedBgra = [byte[]]@( - 0, 0, 255, 255, 0, 255, 0, 255, - 255, 0, 0, 255, 255, 255, 255, 255 + 0, 0, 255, 0, 0, 255, 0, 64, + 255, 0, 0, 128, 255, 255, 255, 255 ) $rgbaResult = Convert-ReadbackToBgra -Source $rgba -Format 37 -Width 2 -Height 2 @@ -303,7 +303,7 @@ function Invoke-SelfTest { $stream.Dispose() } - 'Self-check passed (2x2 RGBA/BGRA PNG, byte-length/64 MiB limits, viewport-coordinate bounds, and cropped pixel_capture bounds).' + 'Self-check passed (opaque 2x2 RGBA/BGRA PNG, byte-length/64 MiB limits, viewport-coordinate bounds, and cropped pixel_capture bounds).' } if ($SelfTest) { -- cgit v1.2.3