pub struct Capturer {
pub image: Option<Image>,
/* private fields */
}Expand description
A screen capturer.
Can capture video frames with reasonable performance for screenshooting, recording, streaming, etc.
Fields§
§image: Option<Image>Implementations§
Source§impl Capturer
impl Capturer
Sourcepub fn new(capture_src: usize) -> Result<Capturer, String>
pub fn new(capture_src: usize) -> Result<Capturer, String>
Construct a new capturer for a given capture source, e.g. a display.
Sourcepub fn position(&self) -> (i32, i32)
pub fn position(&self) -> (i32, i32)
Returns the horizontal and vertical offset of the capture source from the primary display.
Sourcepub fn capture_frame(&mut self) -> Result<Vec<Bgr8>, CaptureError>
pub fn capture_frame(&mut self) -> Result<Vec<Bgr8>, CaptureError>
Capture screen and return an owned Vec of the image color data
Worse performance than self.capture_store_frame(); self.get_stored_frame()
due to an extra .to_vec() call.
Sourcepub fn capture_store_frame(&mut self) -> Result<(), CaptureError>
pub fn capture_store_frame(&mut self) -> Result<(), CaptureError>
Capture screen and store in self for later retreival
Performs no unnecessary allocations or copies, and is as such faster than
Self::capture_frame.
Recommended over Self::capture_frame unless an owned Vec is required.
Sourcepub fn get_stored_frame(&self) -> Option<&[Bgr8]>
pub fn get_stored_frame(&self) -> Option<&[Bgr8]>
Get the last frame stored in self by Self::capture_store_frame,
if one has ever been stored.