MCPcopy Create free account
hub / github.com/Recordscript/recordscript / new

Method new

libs/scrap/src/common/quartz.rs:13–36  ·  view source on GitHub ↗
(display: Display)

Source from the content-addressed store, hash-verified

11
12impl Capturer {
13 pub fn new(display: Display) -> io::Result<Capturer> {
14 let frame = Arc::new(Mutex::new(None));
15
16 let f = frame.clone();
17 let inner = quartz::Capturer::new(
18 display.0,
19 display.width(),
20 display.height(),
21 quartz::PixelFormat::Argb8888,
22 Default::default(),
23 move |inner| {
24 if let Ok(mut f) = f.lock() {
25 *f = Some(inner);
26 }
27 },
28 )
29 .map_err(|_| io::Error::from(io::ErrorKind::Other))?;
30
31 Ok(Capturer {
32 inner,
33 frame,
34 saved_raw_data: Vec::new(),
35 })
36 }
37
38 pub fn width(&self) -> usize {
39 self.inner.width()

Callers

nothing calls this directly

Calls 3

cloneMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected