pub struct SCScreenshotConfiguration { /* private fields */ }Expand description
Configuration for advanced screenshot capture (macOS 26.0+)
Provides fine-grained control over screenshot output including:
- Output dimensions
- Source and destination rectangles
- Shadow and clipping behavior
- HDR/SDR dynamic range
- File output
§Examples
use screencapturekit::screenshot_manager::{SCScreenshotConfiguration, SCScreenshotDynamicRange};
let config = SCScreenshotConfiguration::new().expect("create screenshot configuration")
.with_width(1920)
.with_height(1080)
.with_shows_cursor(true)
.with_dynamic_range(SCScreenshotDynamicRange::BothSDRAndHDR);Implementations§
Source§impl SCScreenshotConfiguration
impl SCScreenshotConfiguration
Sourcepub fn new() -> Result<Self, SCError>
pub fn new() -> Result<Self, SCError>
Create a new screenshot configuration
§Errors
Returns SCError::FeatureNotAvailable if the configuration cannot be
created (requires macOS 26.0+)
Sourcepub fn with_width(self, width: usize) -> Self
pub fn with_width(self, width: usize) -> Self
Set the output width in pixels
Sourcepub fn with_height(self, height: usize) -> Self
pub fn with_height(self, height: usize) -> Self
Set the output height in pixels
Sourcepub fn with_shows_cursor(self, shows_cursor: bool) -> Self
pub fn with_shows_cursor(self, shows_cursor: bool) -> Self
Set whether to show the cursor
Sourcepub fn with_source_rect(self, rect: CGRect) -> Self
pub fn with_source_rect(self, rect: CGRect) -> Self
Set the source rectangle (subset of capture area)
Sourcepub fn with_destination_rect(self, rect: CGRect) -> Self
pub fn with_destination_rect(self, rect: CGRect) -> Self
Set the destination rectangle (output area)
Sourcepub fn with_ignore_shadows(self, ignore_shadows: bool) -> Self
pub fn with_ignore_shadows(self, ignore_shadows: bool) -> Self
Set whether to ignore shadows
Sourcepub fn with_ignore_clipping(self, ignore_clipping: bool) -> Self
pub fn with_ignore_clipping(self, ignore_clipping: bool) -> Self
Set whether to ignore clipping
Sourcepub fn with_include_child_windows(self, include_child_windows: bool) -> Self
pub fn with_include_child_windows(self, include_child_windows: bool) -> Self
Set whether to include child windows
Sourcepub fn with_display_intent(
self,
display_intent: SCScreenshotDisplayIntent,
) -> Self
pub fn with_display_intent( self, display_intent: SCScreenshotDisplayIntent, ) -> Self
Set the display intent
Sourcepub fn with_dynamic_range(self, dynamic_range: SCScreenshotDynamicRange) -> Self
pub fn with_dynamic_range(self, dynamic_range: SCScreenshotDynamicRange) -> Self
Set the dynamic range
Sourcepub fn set_file_path(
&mut self,
path: impl AsRef<Path>,
) -> Result<&mut Self, InvalidScreenshotPath>
pub fn set_file_path( &mut self, path: impl AsRef<Path>, ) -> Result<&mut Self, InvalidScreenshotPath>
Set the output file path.
Accepts anything path-like (&str, String, &Path, PathBuf).
§Errors
Returns InvalidScreenshotPath and leaves the configuration unchanged
if Foundation cannot represent the path.
Sourcepub fn with_file_path(
self,
path: impl AsRef<Path>,
) -> Result<Self, InvalidScreenshotPath>
pub fn with_file_path( self, path: impl AsRef<Path>, ) -> Result<Self, InvalidScreenshotPath>
Set the output file path (builder pattern).
See set_file_path for how invalid paths are
handled.
Sourcepub fn without_file_path(self) -> Self
pub fn without_file_path(self) -> Self
Clear any previously configured output file path.
Sourcepub fn clear_file_path(&mut self) -> &mut Self
pub fn clear_file_path(&mut self) -> &mut Self
Clear any previously configured output file path.
Sourcepub fn file_path(&self) -> Option<PathBuf>
pub fn file_path(&self) -> Option<PathBuf>
Get the configured output file path, if one was set.
Sourcepub fn shows_cursor(&self) -> bool
pub fn shows_cursor(&self) -> bool
Whether the cursor will be drawn into the screenshot.
Sourcepub fn source_rect(&self) -> CGRect
pub fn source_rect(&self) -> CGRect
Get the source rectangle (the subset of the capture area to read).
Sourcepub fn destination_rect(&self) -> CGRect
pub fn destination_rect(&self) -> CGRect
Get the destination rectangle (where the source is drawn in the output).
Sourcepub fn ignore_shadows(&self) -> bool
pub fn ignore_shadows(&self) -> bool
Whether window shadows are excluded from the screenshot.
Sourcepub fn ignore_clipping(&self) -> bool
pub fn ignore_clipping(&self) -> bool
Whether clipping to the window bounds is ignored.
Sourcepub fn include_child_windows(&self) -> bool
pub fn include_child_windows(&self) -> bool
Whether child windows are included in the screenshot.
Sourcepub fn display_intent(&self) -> Result<SCScreenshotDisplayIntent, SCError>
pub fn display_intent(&self) -> Result<SCScreenshotDisplayIntent, SCError>
Get the display intent.
Returns SCError::UnknownValue if the framework reported an intent
this crate does not know about (a newer macOS adding a case).
Sourcepub fn dynamic_range(&self) -> Result<SCScreenshotDynamicRange, SCError>
pub fn dynamic_range(&self) -> Result<SCScreenshotDynamicRange, SCError>
Get the dynamic range.
Returns SCError::UnknownValue if the framework reported a range
this crate does not know about (a newer macOS adding a case).
Sourcepub fn with_content_type(
self,
identifier: &str,
) -> Result<Self, InteriorNulError>
pub fn with_content_type( self, identifier: &str, ) -> Result<Self, InteriorNulError>
Set the content type (output format) using UTType identifier
Common identifiers include:
"public.png"- PNG format"public.jpeg"- JPEG format"public.heic"- HEIC format"public.tiff"- TIFF format
Use supported_content_types() to get
available formats.
§Errors
Returns InteriorNulError if identifier contains an interior NUL
byte. Valid UTType identifiers never contain NUL bytes.
Sourcepub fn content_type(&self) -> Option<String>
pub fn content_type(&self) -> Option<String>
Get the current content type as UTType identifier
Returns None when no content type is set or the identifier does not
fit in the transfer buffer; the bridge reports overflow as failure
rather than handing back a truncated identifier.
Sourcepub fn supported_content_types() -> Vec<String>
pub fn supported_content_types() -> Vec<String>
Get the list of supported content types (UTType identifiers)
Returns a list of UTType identifiers that can be used with
with_content_type().
Common types include:
"public.png"- PNG format"public.jpeg"- JPEG format"public.heic"- HEIC format
pub const fn as_ptr(&self) -> *const c_void
Trait Implementations§
Source§impl Debug for SCScreenshotConfiguration
Available on crate feature macos_26_0 only.
impl Debug for SCScreenshotConfiguration
macos_26_0 only.Source§impl Drop for SCScreenshotConfiguration
impl Drop for SCScreenshotConfiguration
impl Send for SCScreenshotConfiguration
macos_26_0 only.impl Sync for SCScreenshotConfiguration
macos_26_0 only.