1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
//! Captured elements configuration
//!
//! Methods for configuring which elements are included in the capture
//! (cursor, shadows, etc.).
use super::internal::SCStreamConfiguration;
impl SCStreamConfiguration {
/// Show or hide the cursor in captured frames
///
/// # Examples
///
/// ```
/// use screencapturekit::prelude::*;
///
/// let mut config = SCStreamConfiguration::default();
/// config.set_shows_cursor(true);
/// assert!(config.shows_cursor());
/// ```
pub fn set_shows_cursor(&mut self, shows_cursor: bool) -> &mut Self {
unsafe {
crate::ffi::sc_stream_configuration_set_shows_cursor(self.as_ptr(), shows_cursor);
}
self
}
/// Show or hide the cursor (builder pattern)
#[must_use]
pub fn with_shows_cursor(mut self, shows_cursor: bool) -> Self {
self.set_shows_cursor(shows_cursor);
self
}
/// Check if cursor is shown in capture
pub fn shows_cursor(&self) -> bool {
unsafe { crate::ffi::sc_stream_configuration_get_shows_cursor(self.as_ptr()) }
}
/// Show mouse click indicators (macOS 15.0+)
///
/// When enabled, draws a circle around the cursor when clicked.
/// This helps viewers track mouse activity in recordings.
///
/// # Availability
/// macOS 15.0+. On earlier versions, this setting has no effect.
///
/// # Examples
/// ```
/// use screencapturekit::prelude::*;
///
/// let config = SCStreamConfiguration::new()
/// .with_shows_cursor(true)
/// .with_shows_mouse_clicks(true);
/// ```
#[cfg(feature = "macos_15_0")]
pub fn set_shows_mouse_clicks(&mut self, shows_mouse_clicks: bool) -> &mut Self {
unsafe {
crate::ffi::sc_stream_configuration_set_shows_mouse_clicks(
self.as_ptr(),
shows_mouse_clicks,
);
}
self
}
/// Show mouse click indicators (builder pattern)
#[cfg(feature = "macos_15_0")]
#[must_use]
pub fn with_shows_mouse_clicks(mut self, shows_mouse_clicks: bool) -> Self {
self.set_shows_mouse_clicks(shows_mouse_clicks);
self
}
/// Check if mouse click indicators are shown (macOS 15.0+)
#[cfg(feature = "macos_15_0")]
pub fn shows_mouse_clicks(&self) -> bool {
unsafe { crate::ffi::sc_stream_configuration_get_shows_mouse_clicks(self.as_ptr()) }
}
/// Capture only window shadows (macOS 14.0+)
///
/// When set to `true`, the stream captures only the shadows of windows,
/// not the actual window content. This is useful for creating transparency
/// or blur effects in compositing applications.
///
/// # Availability
/// macOS 14.0+. On earlier versions, this setting has no effect.
///
/// # Examples
/// ```no_run
/// use screencapturekit::prelude::*;
///
/// let config = SCStreamConfiguration::new()
/// .with_width(1920)
/// .with_height(1080)
/// .with_captures_shadows_only(true);
/// ```
#[cfg(feature = "macos_14_0")]
pub fn set_captures_shadows_only(&mut self, captures_shadows_only: bool) -> &mut Self {
unsafe {
crate::ffi::sc_stream_configuration_set_captures_shadows_only(
self.as_ptr(),
captures_shadows_only,
);
}
self
}
/// Capture only window shadows (builder pattern)
#[cfg(feature = "macos_14_0")]
#[must_use]
pub fn with_captures_shadows_only(mut self, captures_shadows_only: bool) -> Self {
self.set_captures_shadows_only(captures_shadows_only);
self
}
/// Get whether only window shadows are captured (macOS 14.0+).
#[cfg(feature = "macos_14_0")]
pub fn captures_shadows_only(&self) -> bool {
unsafe { crate::ffi::sc_stream_configuration_get_captures_shadows_only(self.as_ptr()) }
}
/// Ignore shadows for display capture (macOS 14.0+)
///
/// When set to `true`, window shadows are excluded from display capture.
///
/// # Availability
/// macOS 14.0+. On earlier versions, this setting has no effect.
#[cfg(feature = "macos_14_0")]
pub fn set_ignores_shadows_display(&mut self, ignores_shadows: bool) -> &mut Self {
unsafe {
crate::ffi::sc_stream_configuration_set_ignores_shadows_display(
self.as_ptr(),
ignores_shadows,
);
}
self
}
/// Ignore shadows for display capture (builder pattern)
#[cfg(feature = "macos_14_0")]
#[must_use]
pub fn with_ignores_shadows_display(mut self, ignores_shadows: bool) -> Self {
self.set_ignores_shadows_display(ignores_shadows);
self
}
/// Check if shadows are ignored for display capture (macOS 14.0+)
#[cfg(feature = "macos_14_0")]
pub fn ignores_shadows_display(&self) -> bool {
unsafe { crate::ffi::sc_stream_configuration_get_ignores_shadows_display(self.as_ptr()) }
}
/// Ignore global clip for display capture (macOS 14.0+)
///
/// When set to `true`, the global clip region is ignored for display capture.
///
/// # Availability
/// macOS 14.0+. On earlier versions, this setting has no effect.
#[cfg(feature = "macos_14_0")]
pub fn set_ignore_global_clip_display(&mut self, ignore: bool) -> &mut Self {
unsafe {
crate::ffi::sc_stream_configuration_set_ignore_global_clip_display(
self.as_ptr(),
ignore,
);
}
self
}
/// Ignore global clip for display capture (builder pattern)
#[cfg(feature = "macos_14_0")]
#[must_use]
pub fn with_ignore_global_clip_display(mut self, ignore: bool) -> Self {
self.set_ignore_global_clip_display(ignore);
self
}
/// Check if global clip is ignored for display capture (macOS 14.0+)
#[cfg(feature = "macos_14_0")]
pub fn ignore_global_clip_display(&self) -> bool {
unsafe { crate::ffi::sc_stream_configuration_get_ignore_global_clip_display(self.as_ptr()) }
}
/// Ignore global clip for single window capture (macOS 14.0+)
///
/// When set to `true`, the global clip region is ignored for single window capture.
///
/// # Availability
/// macOS 14.0+. On earlier versions, this setting has no effect.
#[cfg(feature = "macos_14_0")]
pub fn set_ignore_global_clip_single_window(&mut self, ignore: bool) -> &mut Self {
unsafe {
crate::ffi::sc_stream_configuration_set_ignore_global_clip_single_window(
self.as_ptr(),
ignore,
);
}
self
}
/// Ignore global clip for single window capture (builder pattern)
#[cfg(feature = "macos_14_0")]
#[must_use]
pub fn with_ignore_global_clip_single_window(mut self, ignore: bool) -> Self {
self.set_ignore_global_clip_single_window(ignore);
self
}
/// Check if global clip is ignored for single window capture (macOS 14.0+)
#[cfg(feature = "macos_14_0")]
pub fn ignore_global_clip_single_window(&self) -> bool {
unsafe {
crate::ffi::sc_stream_configuration_get_ignore_global_clip_single_window(self.as_ptr())
}
}
}