pub struct SCPickerResult { /* private fields */ }Expand description
Result from the main show() API - contains filter and content metadata
Provides access to:
- The
SCContentFilterfor use withSCStream - Content dimensions and scale factor
- The picked windows, displays, and applications for custom filter creation
Implementations§
Source§impl SCPickerResult
impl SCPickerResult
Sourcepub fn filter(&self) -> SCContentFilter
pub fn filter(&self) -> SCContentFilter
Get the content filter for use with SCStream::new()
Sourcepub fn rect(&self) -> (f64, f64, f64, f64)
pub fn rect(&self) -> (f64, f64, f64, f64)
Get the content rect (x, y, width, height) in points
Sourcepub fn scale(&self) -> f64
pub fn scale(&self) -> f64
Get the point-to-pixel scale factor (typically 2.0 for Retina displays)
Sourcepub fn pixel_size(&self) -> (u32, u32)
pub fn pixel_size(&self) -> (u32, u32)
Get the pixel dimensions (size * scale)
Sourcepub fn windows(&self) -> Vec<SCWindow>
pub fn windows(&self) -> Vec<SCWindow>
Get the windows selected by the user
Returns the picked windows that can be used to create a custom SCContentFilter.
§Example
use screencapturekit::content_sharing_picker::*;
use screencapturekit::prelude::*;
let config = SCContentSharingPickerConfiguration::new();
SCContentSharingPicker::show(&config, |outcome| {
if let SCPickerOutcome::Picked(result) = outcome {
let windows = result.windows();
if let Some(window) = windows.first() {
// Create custom filter with a picked window
let filter = SCContentFilter::create()
.with_window(window)
.build();
}
}
});Sourcepub fn displays(&self) -> Vec<SCDisplay>
pub fn displays(&self) -> Vec<SCDisplay>
Get the displays selected by the user
Returns the picked displays that can be used to create a custom SCContentFilter.
§Example
use screencapturekit::content_sharing_picker::*;
use screencapturekit::prelude::*;
let config = SCContentSharingPickerConfiguration::new();
SCContentSharingPicker::show(&config, |outcome| {
if let SCPickerOutcome::Picked(result) = outcome {
let displays = result.displays();
if let Some(display) = displays.first() {
// Create custom filter with the picked display
let filter = SCContentFilter::create()
.with_display(display)
.with_excluding_windows(&[])
.build();
}
}
});Sourcepub fn applications(&self) -> Vec<SCRunningApplication>
pub fn applications(&self) -> Vec<SCRunningApplication>
Get the applications selected by the user
Returns the picked applications that can be used to create a custom SCContentFilter.
Sourcepub fn source(&self) -> SCPickedSource
pub fn source(&self) -> SCPickedSource
Get the source type that was picked
Returns information about what the user selected: window, display, or application.
§Example
use screencapturekit::content_sharing_picker::*;
fn example() {
let config = SCContentSharingPickerConfiguration::new();
SCContentSharingPicker::show(&config, |outcome| {
if let SCPickerOutcome::Picked(result) = outcome {
match result.source() {
SCPickedSource::Window(title) => println!("[W] {}", title),
SCPickedSource::Display(id) => println!("[D] Display {}", id),
SCPickedSource::Application(name) => println!("[A] {}", name),
SCPickedSource::Unknown => println!("Unknown source"),
}
}
});
}