SCPickerResult

Struct SCPickerResult 

Source
pub struct SCPickerResult { /* private fields */ }
Expand description

Result from the main show() API - contains filter and content metadata

Provides access to:

  • The SCContentFilter for use with SCStream
  • Content dimensions and scale factor
  • The picked windows, displays, and applications for custom filter creation

Implementations§

Source§

impl SCPickerResult

Source

pub fn filter(&self) -> SCContentFilter

Get the content filter for use with SCStream::new()

Source

pub fn size(&self) -> (f64, f64)

Get the content size in points (width, height)

Source

pub fn rect(&self) -> (f64, f64, f64, f64)

Get the content rect (x, y, width, height) in points

Source

pub fn scale(&self) -> f64

Get the point-to-pixel scale factor (typically 2.0 for Retina displays)

Source

pub fn pixel_size(&self) -> (u32, u32)

Get the pixel dimensions (size * scale)

Source

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();
        }
    }
});
Source

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();
        }
    }
});
Source

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.

Source

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"),
            }
        }
    });
}

Trait Implementations§

Source§

impl Debug for SCPickerResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for SCPickerResult

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for SCPickerResult

Source§

impl Sync for SCPickerResult

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.