rapidshot 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rapidshot-1.0.0/.github/FUNDING.yml +3 -0
- rapidshot-1.0.0/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- rapidshot-1.0.0/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- rapidshot-1.0.0/.gitignore +132 -0
- rapidshot-1.0.0/CHANGELOG.md +0 -0
- rapidshot-1.0.0/LICENSE +21 -0
- rapidshot-1.0.0/PKG-INFO +409 -0
- rapidshot-1.0.0/README.md +348 -0
- rapidshot-1.0.0/benchmarks/bettercam_capture.py +17 -0
- rapidshot-1.0.0/benchmarks/bettercam_max_fps.py +24 -0
- rapidshot-1.0.0/benchmarks/d3dshot_max_fps.py +26 -0
- rapidshot-1.0.0/benchmarks/dxcam_capture.py +17 -0
- rapidshot-1.0.0/benchmarks/dxcam_max_fps.py +24 -0
- rapidshot-1.0.0/benchmarks/mss_max_fps.py +22 -0
- rapidshot-1.0.0/benchmarks/rapidshot_capture.py +70 -0
- rapidshot-1.0.0/benchmarks/rapidshot_max_fps.py +53 -0
- rapidshot-1.0.0/examples/capture_to_video.py +22 -0
- rapidshot-1.0.0/examples/instant_replay.py +126 -0
- rapidshot-1.0.0/images/banner.png +0 -0
- rapidshot-1.0.0/pyproject.toml +88 -0
- rapidshot-1.0.0/rapidshot/__init__.py +406 -0
- rapidshot-1.0.0/rapidshot/_libs/__init__.py +0 -0
- rapidshot-1.0.0/rapidshot/_libs/d3d11.py +270 -0
- rapidshot-1.0.0/rapidshot/_libs/dxgi.py +281 -0
- rapidshot-1.0.0/rapidshot/_libs/user32.py +28 -0
- rapidshot-1.0.0/rapidshot/core/__init__.py +7 -0
- rapidshot-1.0.0/rapidshot/core/device.py +81 -0
- rapidshot-1.0.0/rapidshot/core/duplicator.py +277 -0
- rapidshot-1.0.0/rapidshot/core/output.py +60 -0
- rapidshot-1.0.0/rapidshot/core/stagesurf.py +123 -0
- rapidshot-1.0.0/rapidshot/core.py +557 -0
- rapidshot-1.0.0/rapidshot/processor/__init__.py +1 -0
- rapidshot-1.0.0/rapidshot/processor/base.py +154 -0
- rapidshot-1.0.0/rapidshot/processor/cupy_processor.py +279 -0
- rapidshot-1.0.0/rapidshot/processor/numpy_processor.py +138 -0
- rapidshot-1.0.0/rapidshot/processor/pillow_processor.py +106 -0
- rapidshot-1.0.0/rapidshot/util/__init__.py +0 -0
- rapidshot-1.0.0/rapidshot/util/io.py +94 -0
- rapidshot-1.0.0/rapidshot/util/logging.py +128 -0
- rapidshot-1.0.0/rapidshot/util/timer.py +39 -0
- rapidshot-1.0.0/rapidshot.egg-info/PKG-INFO +409 -0
- rapidshot-1.0.0/rapidshot.egg-info/SOURCES.txt +45 -0
- rapidshot-1.0.0/rapidshot.egg-info/dependency_links.txt +1 -0
- rapidshot-1.0.0/rapidshot.egg-info/requires.txt +32 -0
- rapidshot-1.0.0/rapidshot.egg-info/top_level.txt +1 -0
- rapidshot-1.0.0/setup.cfg +4 -0
- rapidshot-1.0.0/setup.py +46 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
1. Go to '...'
|
|
16
|
+
2. Click on '....'
|
|
17
|
+
3. Scroll down to '....'
|
|
18
|
+
4. See error
|
|
19
|
+
|
|
20
|
+
**Expected behavior**
|
|
21
|
+
A clear and concise description of what you expected to happen.
|
|
22
|
+
|
|
23
|
+
**Screenshots**
|
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
|
25
|
+
|
|
26
|
+
**Desktop (please complete the following information):**
|
|
27
|
+
- OS: [e.g. iOS]
|
|
28
|
+
- Browser [e.g. chrome, safari]
|
|
29
|
+
- Version [e.g. 22]
|
|
30
|
+
|
|
31
|
+
**Smartphone (please complete the following information):**
|
|
32
|
+
- Device: [e.g. iPhone6]
|
|
33
|
+
- OS: [e.g. iOS8.1]
|
|
34
|
+
- Browser [e.g. stock browser, safari]
|
|
35
|
+
- Version [e.g. 22]
|
|
36
|
+
|
|
37
|
+
**Additional context**
|
|
38
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
.python-version
|
|
86
|
+
|
|
87
|
+
# pipenv
|
|
88
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
89
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
90
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
91
|
+
# install all needed dependencies.
|
|
92
|
+
#Pipfile.lock
|
|
93
|
+
|
|
94
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
95
|
+
__pypackages__/
|
|
96
|
+
|
|
97
|
+
# Celery stuff
|
|
98
|
+
celerybeat-schedule
|
|
99
|
+
celerybeat.pid
|
|
100
|
+
|
|
101
|
+
# SageMath parsed files
|
|
102
|
+
*.sage.py
|
|
103
|
+
|
|
104
|
+
# Environments
|
|
105
|
+
.env
|
|
106
|
+
.venv
|
|
107
|
+
env/
|
|
108
|
+
venv/
|
|
109
|
+
ENV/
|
|
110
|
+
env.bak/
|
|
111
|
+
venv.bak/
|
|
112
|
+
|
|
113
|
+
# Spyder project settings
|
|
114
|
+
.spyderproject
|
|
115
|
+
.spyproject
|
|
116
|
+
|
|
117
|
+
# Rope project settings
|
|
118
|
+
.ropeproject
|
|
119
|
+
|
|
120
|
+
# mkdocs documentation
|
|
121
|
+
/site
|
|
122
|
+
|
|
123
|
+
# mypy
|
|
124
|
+
.mypy_cache/
|
|
125
|
+
.dmypy.json
|
|
126
|
+
dmypy.json
|
|
127
|
+
|
|
128
|
+
# Pyre type checker
|
|
129
|
+
.pyre/
|
|
130
|
+
|
|
131
|
+
# Local tests
|
|
132
|
+
.test/
|
|
File without changes
|
rapidshot-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Rain
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
rapidshot-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rapidshot
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A high-performance screencapture library for Windows using Desktop Duplication API
|
|
5
|
+
Home-page: https://github.com/Zaatra/Rapidshot
|
|
6
|
+
Author: Rapidshot Contributors
|
|
7
|
+
Author-email: RapidShot Contributors <example@example.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/Zaatra/Rapidshot
|
|
10
|
+
Project-URL: Bug Reports, https://github.com/Zaatra/Rapidshot/issues
|
|
11
|
+
Project-URL: Source, https://github.com/Zaatra/Rapidshot
|
|
12
|
+
Project-URL: Documentation, https://github.com/Zaatra/Rapidshot
|
|
13
|
+
Keywords: screencapture,desktop-duplication,screen-recorder,windows
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
22
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
23
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
|
|
24
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 11
|
|
25
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
26
|
+
Classifier: Topic :: Multimedia :: Graphics :: Capture
|
|
27
|
+
Classifier: Topic :: Multimedia :: Graphics :: Capture :: Screen Capture
|
|
28
|
+
Requires-Python: >=3.8
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: numpy>=1.19.0
|
|
32
|
+
Requires-Dist: comtypes>=1.1.0
|
|
33
|
+
Provides-Extra: cv2
|
|
34
|
+
Requires-Dist: opencv-python>=4.5.0; extra == "cv2"
|
|
35
|
+
Provides-Extra: gpu
|
|
36
|
+
Requires-Dist: cupy-cuda11x>=11.0.0; extra == "gpu"
|
|
37
|
+
Requires-Dist: opencv-python>=4.5.0; extra == "gpu"
|
|
38
|
+
Provides-Extra: pil
|
|
39
|
+
Requires-Dist: pillow>=8.0.0; extra == "pil"
|
|
40
|
+
Provides-Extra: all
|
|
41
|
+
Requires-Dist: numpy>=1.19.0; extra == "all"
|
|
42
|
+
Requires-Dist: comtypes>=1.1.0; extra == "all"
|
|
43
|
+
Requires-Dist: opencv-python>=4.5.0; extra == "all"
|
|
44
|
+
Requires-Dist: pillow>=8.0.0; extra == "all"
|
|
45
|
+
Provides-Extra: dev
|
|
46
|
+
Requires-Dist: black>=22.3.0; extra == "dev"
|
|
47
|
+
Requires-Dist: isort>=5.10.1; extra == "dev"
|
|
48
|
+
Requires-Dist: mypy>=0.950; extra == "dev"
|
|
49
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
50
|
+
Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
|
|
51
|
+
Requires-Dist: flake8>=4.0.1; extra == "dev"
|
|
52
|
+
Requires-Dist: tox>=3.24.5; extra == "dev"
|
|
53
|
+
Provides-Extra: docs
|
|
54
|
+
Requires-Dist: sphinx>=4.5.0; extra == "docs"
|
|
55
|
+
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
|
|
56
|
+
Requires-Dist: myst-parser>=0.18.0; extra == "docs"
|
|
57
|
+
Dynamic: author
|
|
58
|
+
Dynamic: home-page
|
|
59
|
+
Dynamic: license-file
|
|
60
|
+
Dynamic: requires-python
|
|
61
|
+
|
|
62
|
+
# RapidShot
|
|
63
|
+
|
|
64
|
+
A high-performance screencapture library for Windows using the Desktop Duplication API. This is a merged version combining features from multiple DXCam forks, designed to deliver ultra-fast capture capabilities with advanced functionality.
|
|
65
|
+
|
|
66
|
+
## Features
|
|
67
|
+
|
|
68
|
+
- **Ultra-fast capture**: 240Hz+ capturing capability
|
|
69
|
+
- **Multi-backend support**: NumPy, PIL, and CUDA/CuPy backends
|
|
70
|
+
- **Cursor capture**: Capture mouse cursor position and shape
|
|
71
|
+
- **Direct3D support**: Capture Direct3D exclusive full-screen applications without interruption
|
|
72
|
+
- **NVIDIA GPU acceleration**: GPU-accelerated processing using CuPy
|
|
73
|
+
- **Multi-monitor setup**: Support for multiple GPUs and monitors
|
|
74
|
+
- **Flexible output formats**: RGB, RGBA, BGR, BGRA, and grayscale support
|
|
75
|
+
- **Region-based capture**: Efficient capture of specific screen regions
|
|
76
|
+
- **Rotation handling**: Automatic handling of rotated displays
|
|
77
|
+
|
|
78
|
+
## Installation
|
|
79
|
+
|
|
80
|
+
> **Note:** The package is installed as `rapidshot` and imported as `import rapidshot`.
|
|
81
|
+
|
|
82
|
+
### Basic Installation
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install rapidshot
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### With OpenCV Support (recommended)
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install rapidshot[cv2]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### With NVIDIA GPU Acceleration
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pip install rapidshot[gpu]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### With All Dependencies
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pip install rapidshot[all]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Quick Start
|
|
107
|
+
|
|
108
|
+
### Basic Screencapture
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
import rapidshot
|
|
112
|
+
|
|
113
|
+
# Create a ScreenCapture instance on the primary monitor
|
|
114
|
+
screencapture = rapidshot.create()
|
|
115
|
+
|
|
116
|
+
# Take a screencapture
|
|
117
|
+
frame = screencapture.grab()
|
|
118
|
+
|
|
119
|
+
# Display the screencapture
|
|
120
|
+
from PIL import Image
|
|
121
|
+
Image.fromarray(frame).show()
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Region-based Capture
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
# Define a specific region
|
|
128
|
+
left, top = (1920 - 640) // 2, (1080 - 640) // 2
|
|
129
|
+
right, bottom = left + 640, top + 640
|
|
130
|
+
region = (left, top, right, bottom)
|
|
131
|
+
|
|
132
|
+
# Capture only this region
|
|
133
|
+
frame = screencapture.grab(region=region) # 640x640x3 numpy.ndarray
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Continuous Capture
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
# Start capturing at 60 FPS
|
|
140
|
+
screencapture.start(target_fps=60)
|
|
141
|
+
|
|
142
|
+
# Get the latest frame
|
|
143
|
+
for i in range(1000):
|
|
144
|
+
image = screencapture.get_latest_frame() # Blocks until new frame is available
|
|
145
|
+
# Process the frame...
|
|
146
|
+
|
|
147
|
+
# Stop capturing
|
|
148
|
+
screencapture.stop()
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Video Recording
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
import rapidshot
|
|
155
|
+
import cv2
|
|
156
|
+
|
|
157
|
+
# Create a ScreenCapture instance with BGR color format for OpenCV
|
|
158
|
+
screencapture = rapidshot.create(output_color="BGR")
|
|
159
|
+
|
|
160
|
+
# Start capturing at 30 FPS in video mode
|
|
161
|
+
screencapture.start(target_fps=30, video_mode=True)
|
|
162
|
+
|
|
163
|
+
# Create a video writer
|
|
164
|
+
writer = cv2.VideoWriter(
|
|
165
|
+
"video.mp4", cv2.VideoWriter_fourcc(*"mp4v"), 30, (1920, 1080)
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
# Record for 10 seconds (300 frames at 30 FPS)
|
|
169
|
+
for i in range(300):
|
|
170
|
+
writer.write(screencapture.get_latest_frame())
|
|
171
|
+
|
|
172
|
+
# Clean up
|
|
173
|
+
screencapture.stop()
|
|
174
|
+
writer.release()
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### NVIDIA GPU Acceleration
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
# Create a ScreenCapture instance with NVIDIA GPU acceleration
|
|
181
|
+
screencapture = rapidshot.create(nvidia_gpu=True)
|
|
182
|
+
|
|
183
|
+
# Screenshots will be processed on the GPU for improved performance
|
|
184
|
+
frame = screencapture.grab()
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Cursor Capture
|
|
188
|
+
|
|
189
|
+
RapidShot provides comprehensive cursor capture capabilities, allowing you to track cursor position, visibility, and shape in your screen captures.
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
# Take a screenshot
|
|
193
|
+
frame = screencapture.grab()
|
|
194
|
+
|
|
195
|
+
# Get cursor information
|
|
196
|
+
cursor = screencapture.grab_cursor()
|
|
197
|
+
|
|
198
|
+
# Check if cursor is visible in the capture area
|
|
199
|
+
if cursor.PointerPositionInfo.Visible:
|
|
200
|
+
# Get cursor position
|
|
201
|
+
x, y = cursor.PointerPositionInfo.Position.x, cursor.PointerPositionInfo.Position.y
|
|
202
|
+
print(f"Cursor position: ({x}, {y})")
|
|
203
|
+
|
|
204
|
+
# Cursor shape information is also available
|
|
205
|
+
if cursor.Shape is not None:
|
|
206
|
+
width = cursor.PointerShapeInfo.Width
|
|
207
|
+
height = cursor.PointerShapeInfo.Height
|
|
208
|
+
print(f"Cursor size: {width}x{height}")
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
#### Advanced Cursor Handling
|
|
212
|
+
|
|
213
|
+
The cursor information provided by RapidShot can be used in various ways:
|
|
214
|
+
|
|
215
|
+
1. **Overlay cursor on captured image:**
|
|
216
|
+
|
|
217
|
+
```python
|
|
218
|
+
import numpy as np
|
|
219
|
+
import cv2
|
|
220
|
+
|
|
221
|
+
def overlay_cursor(frame, cursor):
|
|
222
|
+
"""Overlay cursor on captured frame."""
|
|
223
|
+
if not cursor.PointerPositionInfo.Visible or cursor.Shape is None:
|
|
224
|
+
return frame
|
|
225
|
+
|
|
226
|
+
# Create an overlay from cursor shape data
|
|
227
|
+
shape_type = cursor.PointerShapeInfo.Type
|
|
228
|
+
width = cursor.PointerShapeInfo.Width
|
|
229
|
+
height = cursor.PointerShapeInfo.Height
|
|
230
|
+
|
|
231
|
+
# Different processing based on cursor type (monochrome, color, or masked)
|
|
232
|
+
if shape_type & DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MONOCHROME:
|
|
233
|
+
# Process monochrome cursor
|
|
234
|
+
# ...
|
|
235
|
+
elif shape_type & DXGI_OUTDUPL_POINTER_SHAPE_TYPE_COLOR:
|
|
236
|
+
# Process color cursor
|
|
237
|
+
# ...
|
|
238
|
+
elif shape_type & DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MASKED_COLOR:
|
|
239
|
+
# Process masked color cursor
|
|
240
|
+
# ...
|
|
241
|
+
|
|
242
|
+
# Position the cursor on the frame at its current coordinates
|
|
243
|
+
x, y = cursor.PointerPositionInfo.Position.x, cursor.PointerPositionInfo.Position.y
|
|
244
|
+
|
|
245
|
+
# Ensure cursor is within frame boundaries
|
|
246
|
+
# ...
|
|
247
|
+
|
|
248
|
+
# Blend cursor with frame
|
|
249
|
+
# ...
|
|
250
|
+
|
|
251
|
+
return frame_with_cursor
|
|
252
|
+
|
|
253
|
+
# Usage example
|
|
254
|
+
frame = screencapture.grab()
|
|
255
|
+
cursor = screencapture.grab_cursor()
|
|
256
|
+
composite_image = overlay_cursor(frame, cursor)
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
2. **Track cursor movements:**
|
|
260
|
+
|
|
261
|
+
```python
|
|
262
|
+
import time
|
|
263
|
+
|
|
264
|
+
# Record cursor positions over time
|
|
265
|
+
positions = []
|
|
266
|
+
screencapture = rapidshot.create()
|
|
267
|
+
|
|
268
|
+
for i in range(100):
|
|
269
|
+
cursor = screencapture.grab_cursor()
|
|
270
|
+
if cursor.PointerPositionInfo.Visible:
|
|
271
|
+
positions.append((
|
|
272
|
+
time.time(),
|
|
273
|
+
cursor.PointerPositionInfo.Position.x,
|
|
274
|
+
cursor.PointerPositionInfo.Position.y
|
|
275
|
+
))
|
|
276
|
+
time.sleep(0.05) # Sample at 20Hz
|
|
277
|
+
|
|
278
|
+
# Analyze cursor movement
|
|
279
|
+
# ...
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Multiple Monitors / GPUs
|
|
283
|
+
|
|
284
|
+
```python
|
|
285
|
+
# Show available devices and outputs
|
|
286
|
+
print(rapidshot.device_info())
|
|
287
|
+
print(rapidshot.output_info())
|
|
288
|
+
|
|
289
|
+
# Create ScreenCapture instances for specific devices/outputs
|
|
290
|
+
capture1 = rapidshot.create(device_idx=0, output_idx=0) # First monitor on first GPU
|
|
291
|
+
capture2 = rapidshot.create(device_idx=0, output_idx=1) # Second monitor on first GPU
|
|
292
|
+
capture3 = rapidshot.create(device_idx=1, output_idx=0) # First monitor on second GPU
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## Advanced Usage
|
|
296
|
+
|
|
297
|
+
### Custom Buffer Size
|
|
298
|
+
|
|
299
|
+
```python
|
|
300
|
+
# Create a ScreenCapture instance with a larger frame buffer
|
|
301
|
+
screencapture = rapidshot.create(max_buffer_len=256)
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Different Color Formats
|
|
305
|
+
|
|
306
|
+
```python
|
|
307
|
+
# RGB (default)
|
|
308
|
+
screencapture_rgb = rapidshot.create(output_color="RGB")
|
|
309
|
+
|
|
310
|
+
# RGBA (with alpha channel)
|
|
311
|
+
screencapture_rgba = rapidshot.create(output_color="RGBA")
|
|
312
|
+
|
|
313
|
+
# BGR (OpenCV format)
|
|
314
|
+
screencapture_bgr = rapidshot.create(output_color="BGR")
|
|
315
|
+
|
|
316
|
+
# Grayscale
|
|
317
|
+
screencapture_gray = rapidshot.create(output_color="GRAY")
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Resource Management
|
|
321
|
+
|
|
322
|
+
```python
|
|
323
|
+
# Release resources when done
|
|
324
|
+
screencapture.release()
|
|
325
|
+
|
|
326
|
+
# Or automatically released when object is deleted
|
|
327
|
+
del screencapture
|
|
328
|
+
|
|
329
|
+
# Clean up all resources
|
|
330
|
+
rapidshot.clean_up()
|
|
331
|
+
|
|
332
|
+
# Reset the library completely
|
|
333
|
+
rapidshot.reset()
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## Benchmarks and Performance Comparison
|
|
337
|
+
|
|
338
|
+
RapidShot includes benchmark utilities to compare its performance against other popular screen capture libraries. The benchmark scripts are located in the `benchmarks/` directory and are designed to provide objective performance measurements.
|
|
339
|
+
|
|
340
|
+
### Benchmark Structure
|
|
341
|
+
|
|
342
|
+
- **FPS Benchmarks**: Measure the maximum frame rate achievable by each library
|
|
343
|
+
- `rapidshot_max_fps.py` - Tests RapidShot's maximum FPS
|
|
344
|
+
- `bettercam_max_fps.py` - Tests BetterCam's maximum FPS
|
|
345
|
+
- `dxcam_max_fps.py` - Tests DXCam's maximum FPS
|
|
346
|
+
- `d3dshot_max_fps.py` - Tests D3DShot's maximum FPS
|
|
347
|
+
- `mss_max_fps.py` - Tests MSS's maximum FPS
|
|
348
|
+
|
|
349
|
+
- **Capture Benchmarks**: Test the continuous capture performance
|
|
350
|
+
- `rapidshot_capture.py` - Tests RapidShot's continuous capture
|
|
351
|
+
- `bettercam_capture.py` - Tests BetterCam's continuous capture
|
|
352
|
+
- `dxcam_capture.py` - Tests DXCam's continuous capture
|
|
353
|
+
|
|
354
|
+
### Running Benchmarks
|
|
355
|
+
|
|
356
|
+
To run a benchmark comparison:
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
# Run RapidShot benchmark
|
|
360
|
+
python benchmarks/rapidshot_max_fps.py
|
|
361
|
+
|
|
362
|
+
# Run with GPU acceleration
|
|
363
|
+
python benchmarks/rapidshot_max_fps.py --gpu
|
|
364
|
+
|
|
365
|
+
# Test with different color formats
|
|
366
|
+
python benchmarks/rapidshot_max_fps.py --color BGRA
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Benchmark Results
|
|
370
|
+
|
|
371
|
+
The table below shows typical performance results across different libraries:
|
|
372
|
+
|
|
373
|
+
| Library | Average FPS | GPU-accelerated FPS |
|
|
374
|
+
|-----------------|-------------|---------------------|
|
|
375
|
+
| RapidShot | 240+ | 300+ |
|
|
376
|
+
| Original DXCam | 210 | N/A |
|
|
377
|
+
| Python-MSS | 75 | N/A |
|
|
378
|
+
| D3DShot | 118 | N/A |
|
|
379
|
+
|
|
380
|
+
## System Requirements
|
|
381
|
+
|
|
382
|
+
- **Operating System:** Windows 10 or newer
|
|
383
|
+
- **Python:** 3.7+
|
|
384
|
+
- **GPU:** Compatible GPU for NVIDIA acceleration (for GPU features)
|
|
385
|
+
- **RAM:** 8 GB+ (depending on the resolution and number of screencapture instances used)
|
|
386
|
+
|
|
387
|
+
### Troubleshooting
|
|
388
|
+
|
|
389
|
+
- **ImportError with CuPy:** Ensure you have compatible CUDA drivers installed.
|
|
390
|
+
- **Black screens when capturing:** Verify the application isn't running in exclusive fullscreen mode.
|
|
391
|
+
- **Low performance:** Experiment with different backends (NUMPY vs. CUPY) to optimize performance.
|
|
392
|
+
|
|
393
|
+
## Contributing
|
|
394
|
+
|
|
395
|
+
Contributions are welcome! Please feel free to submit a Pull Request
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
## License
|
|
399
|
+
|
|
400
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
401
|
+
|
|
402
|
+
## Acknowledgments
|
|
403
|
+
|
|
404
|
+
RapidShot is a merged version of the following projects:
|
|
405
|
+
|
|
406
|
+
- Original DXcam by ra1nty
|
|
407
|
+
- dxcampil - PIL-based version
|
|
408
|
+
- DXcam-AI-M-BOT - Cursor support version
|
|
409
|
+
- BetterCam - GPU acceleration version
|