//! Region screenshots, as the app takes them: the overlay and the saving
//! are in `hdrshot_core::capture::region`, shared with the command line.
use std::time::Duration;
pub(crate) use hdrshot_core::capture::region::{showing, take};
use crate::screenshot::{Options, Taken};
/// Takes a region screenshot after `delay`, on a thread of its own, and
/// sends the outcome; nothing when the user cancels.
pub(crate) fn take_later(
delay: Duration,
options: Options,
taken: std::sync::mpsc::Sender<Taken>,
ctx: egui::Context,
) {
std::thread::spawn(move || {
std::thread::sleep(delay);
if let Some(outcome) = take(&options)
&& taken.send(outcome).is_ok()
{
ctx.request_repaint();
}
});
}