pub struct SCScreenshotManager;Expand description
Manager for capturing single screenshots
Available on macOS 14.0+. Provides a simpler API than SCStream for one-time captures.
§Examples
use screencapturekit::screenshot_manager::SCScreenshotManager;
use screencapturekit::stream::{content_filter::SCContentFilter, configuration::SCStreamConfiguration};
use screencapturekit::shareable_content::SCShareableContent;
let content = SCShareableContent::get()?;
let display = &content.displays()[0];
let filter = SCContentFilter::builder().display(display).exclude_windows(&[]).build();
let mut config = SCStreamConfiguration::default();
config.set_width(1920);
config.set_height(1080);
let image = SCScreenshotManager::capture_image(&filter, &config)?;
println!("Captured screenshot: {}x{}", image.width(), image.height());Implementations§
Source§impl SCScreenshotManager
impl SCScreenshotManager
Sourcepub fn capture_image(
content_filter: &SCContentFilter,
configuration: &SCStreamConfiguration,
) -> Result<CGImage, SCError>
pub fn capture_image( content_filter: &SCContentFilter, configuration: &SCStreamConfiguration, ) -> Result<CGImage, SCError>
Sourcepub fn capture_sample_buffer(
content_filter: &SCContentFilter,
configuration: &SCStreamConfiguration,
) -> Result<CMSampleBuffer, SCError>
pub fn capture_sample_buffer( content_filter: &SCContentFilter, configuration: &SCStreamConfiguration, ) -> Result<CMSampleBuffer, SCError>
Auto Trait Implementations§
impl Freeze for SCScreenshotManager
impl RefUnwindSafe for SCScreenshotManager
impl Send for SCScreenshotManager
impl Sync for SCScreenshotManager
impl Unpin for SCScreenshotManager
impl UnwindSafe for SCScreenshotManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more