{"record":{"id":"0b6522e339c34102","repo":"babalae/better-genshin-impact","slug":"bitblt-only-support-24-or-32-bit-pixel-color","errorCode":null,"errorMessage":"BitBlt only support 24 or 32 bit pixel color","messagePattern":"BitBlt only support 24 or 32 bit pixel color","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Fischless.GameCapture/BitBlt/BitBltSession.cs","lineNumber":78,"sourceCode":"        Height = h;\n\n        lock (_lockObject)\n        {\n            try\n            {\n                _hdcSrc = User32.GetDC(_hWnd);\n                if (_hdcSrc.IsInvalid) throw new Exception($\"Failed to get DC for {_hWnd}\");\n\n                var hdcRasterCaps = Gdi32.GetDeviceCaps(_hdcSrc, Gdi32.DeviceCap.RASTERCAPS);\n                if ((hdcRasterCaps | 1) == 0) // RC_BITBLT\n                    // 设备不支持 BitBlt\n                    throw new Exception(\"BitBlt not supported\");\n\n                var hdcSrcPixel = Gdi32.GetDeviceCaps(_hdcSrc, Gdi32.DeviceCap.BITSPIXEL);\n                // 颜色位数\n                if (hdcSrcPixel != 32 && hdcSrcPixel != 24)\n                    // 目前只考虑支持24/32位像素格式\n                    throw new Exception(\"BitBlt only support 24 or 32 bit pixel color\");\n\n                var hdcSrcPlanes = Gdi32.GetDeviceCaps(_hdcSrc, Gdi32.DeviceCap.PLANES);\n                // 颜色平面数\n                if (hdcSrcPlanes > 1)\n                    // 意味着色深不是标准色深\n                    throw new Exception(\"BitBlt only support 1 plane\");\n\n                var hdcClip = Gdi32.GetDeviceCaps(_hdcSrc, Gdi32.DeviceCap.CLIPCAPS);\n                if (hdcClip == 0)\n                    // 设备不支持剪切出单一窗口\n                    throw new Exception(\"Device does not support clipping\");\n\n                _hdcDest = Gdi32.CreateCompatibleDC(_hdcSrc);\n                if (_hdcDest.IsInvalid)\n                {\n                    Debug.Fail(\"Failed to create CompatibleDC\");\n                    throw new Exception($\"Failed to create CompatibleDC for {_hWnd}\");\n                }","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/Fischless.GameCapture/BitBlt/BitBltSession.cs#L60-L96","documentation":"Thrown when the window DC reports a BITSPIXEL device cap other than 24 or 32 — the display is running at an unsupported color depth (e.g. 16-bit or 8-bit). BitBltSession only handles 24/32-bit pixel formats because the DIB section is created with biBitCount=24.","triggerScenarios":"The user's monitor/display is set to 16-bit (High Color) or 8-bit color depth; an RDP session forces reduced color depth; a virtual GPU driver reports a nonstandard depth.","commonSituations":"Windows display set to 16-bit color; RDP configured for 16-bit color mode; certain virtual display adapters / remote tools that lower color depth.","solutions":["Set the display color depth to 32-bit (Highest / True Color 32bit) in Windows display settings.","For RDP, configure the session to use 32-bit color depth.","Switch capture mode from BitBlt to GraphicsCapture or DXGI, which are color-depth agnostic."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var bitsPixel = Gdi32.GetDeviceCaps(hdc, Gdi32.DeviceCap.BITSPIXEL);\nif (bitsPixel != 24 && bitsPixel != 32)\n    return CaptureMode.UnsupportedColorDepth; // fall back to GraphicsCapture/DXGI","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Probe BITSPIXEL before constructing a BitBltSession and choose an alternate capture mode.","Recommend 32-bit color depth to users in setup docs.","Treat color-depth mismatch as a mode-selection decision, not a hard failure."],"tags":["capture","bitblt","display","gdi"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}