pub struct SCContentFilter(/* private fields */);Expand description
Content filter for ScreenCaptureKit streams
Defines what content to capture (displays, windows, or applications).
§Examples
use screencapturekit::shareable_content::SCShareableContent;
use screencapturekit::stream::content_filter::SCContentFilter;
let content = SCShareableContent::get()?;
let display = &content.displays()[0];
// Capture entire display
let filter = SCContentFilter::create()
.with_display(display)
.with_excluding_windows(&[])
.build();
// Or capture a specific window
let window = &content.windows()[0];
let filter = SCContentFilter::create()
.with_window(window)
.build();Implementations§
Source§impl SCContentFilter
impl SCContentFilter
Sourcepub fn create() -> SCContentFilterBuilder
pub fn create() -> SCContentFilterBuilder
Creates a content filter builder
§Examples
use screencapturekit::prelude::*;
let content = SCShareableContent::get()?;
let display = &content.displays()[0];
let filter = SCContentFilter::create()
.with_display(display)
.with_excluding_windows(&[])
.build();Sourcepub fn set_content_rect(self, rect: CGRect) -> Self
pub fn set_content_rect(self, rect: CGRect) -> Self
Sets the content rectangle for this filter (macOS 14.2+)
Specifies the rectangle within the content filter to capture.
Sourcepub fn content_rect(&self) -> CGRect
pub fn content_rect(&self) -> CGRect
Gets the content rectangle for this filter (macOS 14.2+)
Sourcepub fn style(&self) -> SCShareableContentStyle
pub fn style(&self) -> SCShareableContentStyle
Get the content style (macOS 14.0+)
Returns the type of content being captured (window, display, application, or none).
Sourcepub fn stream_type(&self) -> SCStreamType
pub fn stream_type(&self) -> SCStreamType
Get the stream type (macOS 14.0+)
Returns whether this filter captures a window or a display.
Sourcepub fn point_pixel_scale(&self) -> f32
pub fn point_pixel_scale(&self) -> f32
Get the point-to-pixel scale factor (macOS 14.0+)
Returns the scaling factor used to convert points to pixels. Typically 2.0 for Retina displays.
Include the menu bar in capture (macOS 14.2+)
When set to true, the menu bar is included in display capture.
This property has no effect for window filters.
Check if menu bar is included in capture (macOS 14.2+)
Sourcepub fn included_displays(&self) -> Vec<SCDisplay>
pub fn included_displays(&self) -> Vec<SCDisplay>
Get included displays (macOS 15.2+)
Returns the displays currently included in this filter.
Sourcepub fn included_windows(&self) -> Vec<SCWindow>
pub fn included_windows(&self) -> Vec<SCWindow>
Get included windows (macOS 15.2+)
Returns the windows currently included in this filter.
Sourcepub fn included_applications(&self) -> Vec<SCRunningApplication>
pub fn included_applications(&self) -> Vec<SCRunningApplication>
Get included applications (macOS 15.2+)
Returns the applications currently included in this filter.