CapSoftware / scap

High-performance, cross-platform screen capture library in Rust.
https://crates.io/crates/scap
Other
238 stars 46 forks source link

Define a "crop area" in the options to manually specify part of the screen to capture #22

Closed clearlysid closed 7 months ago

clearlysid commented 10 months ago

For Helmer Micro's usage: where the user select only a small area of their display to record, I would like to be able to provide the crop area coordinates to scap. That way we can capture just a fixed area instead of the whole monitor/window.

As an example, we can look at the Aperture API.

const options = {
    // ....other stuff
    cropArea: {
    x: 100,
    y: 100,
    width: 500,
    height: 500
    }
};

// elsewhere in the project
await aperture.startRecording(options);

Suggestion: let's add a similar optional cropArea in our Options struct and ensure we only capture the defined area in this to gain some performance. Both windows-capture and ScreenCaptureKit seem to support this at first glance.

clearlysid commented 7 months ago

Support has been added ✅