Comments (3)
In the case of a single display, and after maximizing the window, the obtained window position is as follows: WindowPosition { x: -8.0, y: -8.0, width: 2576.0, height: 1408.0 } }
use active_win_pos_rs::get_active_window;
use screenshots::Screen;
pub fn main() -> Result<(), ()> {
match get_active_window() {
Ok(active_window) => {
println!("active_window {:?}", active_window);
println!("screens {:?}", Screen::all().unwrap());
let mut _x: i32 = active_window.position.x as i32;
let mut _y: i32 = active_window.position.y as i32;
let _width: u32 = active_window.position.width as u32;
let _height: u32 = active_window.position.height as u32;
let screen = Screen::from_point(_x, _y).unwrap();
let image = screen.capture_area(_x, _y, _width, _height).unwrap();
image.save("./a.png").unwrap();
}
Err(()) => {
println!("error occurred while getting the active window");
}
}
Ok(())
}
from xcap.
do you have any suggestion for this minus window position in single display and after maximizing the window? @nashaofu
from xcap.
#91 window capture is WIP,this may be helpful to you @ihsanrabb
from xcap.
Related Issues (20)
- Multi Monitor fullscreen screenshot error HOT 1
- MacOS下窗口截图非常慢 HOT 2
- capture screen with Pipewire on Linux/Wayland HOT 1
- Error: "Get displays from point failed" on MacOS HOT 6
- Saving screenshot as JPEG only produces garbage HOT 1
- Panic in Window::all() while in mission control on MacOS HOT 3
- Panic when calling Monitor::all() while plugging in external display on macOS HOT 2
- Possible race condition in get_window_title
- MacOS screencapture not working properly? HOT 11
- Hide mouse cursor in screenshots
- Rayon Image Support
- 请问下Windows下可不可以获取进程id HOT 5
- 请问win11下为什么截取的图片会比实际窗口小很多,有没有什么办法可以截取窗口的大小 HOT 9
- win11下截屏会经常整个图都是白的 HOT 5
- Frame out of date when capturing games on Windows
- 截图转换 HOT 2
- 截图速度有点慢,想知道底层用的是什么方式截图,有无优化空间 HOT 8
- use feature to selectively build things for linux
- Window not supporting wayland native apps & Monitor returning 0,0 on wayland.
- Instructions to implement recording?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xcap.