2
2
3
3
if sys .platform != "win32" :
4
4
raise OSError
5
- from typing import TYPE_CHECKING , cast
5
+ from typing import TYPE_CHECKING
6
6
7
7
import cv2
8
8
import d3dshot
9
9
import win32api
10
10
import win32con
11
11
import win32gui
12
- from cv2 .typing import MatLike
13
12
from typing_extensions import override
14
13
15
14
from capture_method .BitBltCaptureMethod import BitBltCaptureMethod
@@ -25,7 +24,8 @@ class DesktopDuplicationCaptureMethod(BitBltCaptureMethod):
25
24
description = f"""
26
25
Duplicates the desktop using Direct3D.
27
26
It can record OpenGL and Hardware Accelerated windows.
28
- About 10-15x slower than BitBlt. Not affected by window size.
27
+ Up to 15x slower than BitBlt for tiny regions. Not affected by window size.
28
+ Limited by the target window and monitor's refresh rate.
29
29
Overlapping windows will show up and can't record across displays.
30
30
This option may not be available for hybrid GPU laptops,
31
31
see D3DDD-Note-Laptops.md for a solution.
@@ -57,10 +57,7 @@ def get_frame(self):
57
57
top = selection ["y" ] + offset_y + top_bounds
58
58
right = selection ["width" ] + left
59
59
bottom = selection ["height" ] + top
60
- screenshot = cast (
61
- MatLike | None ,
62
- self .desktop_duplication .screenshot ((left , top , right , bottom )),
63
- )
60
+ screenshot = self .desktop_duplication .screenshot ((left , top , right , bottom ))
64
61
if screenshot is None :
65
62
return None
66
63
return cv2 .cvtColor (screenshot , cv2 .COLOR_RGB2BGRA )
0 commit comments