diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-01 08:45:59 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-01 08:45:59 +0300 |
| commit | f771a62298dd935a1ec6f746b738a2a82aab352d (patch) | |
| tree | 313d5f4dab44fa2dfdf4f0d90f0917f00e9be7e3 /tools/native-frame-capture/convert-viewer-readback.ps1 | |
| parent | 6c603976d4e368708935ab80e152b495a5c5e47a (diff) | |
| download | fparkan-f771a62298dd935a1ec6f746b738a2a82aab352d.tar.xz fparkan-f771a62298dd935a1ec6f746b738a2a82aab352d.zip | |
fix(tools): preserve opaque framebuffer RGB in captures
Diffstat (limited to 'tools/native-frame-capture/convert-viewer-readback.ps1')
| -rw-r--r-- | tools/native-frame-capture/convert-viewer-readback.ps1 | 14 |
1 files changed, 7 insertions, 7 deletions
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) { |
