diff options
author | 2023-06-27 20:37:19 +0200 | |
---|---|---|
committer | 2023-06-27 20:37:19 +0200 | |
commit | f6966268bb6d58b4b03ba61fc5732e1bf016e2a1 (patch) | |
tree | c8e79670b59fdd19103cb1a3a6d18783136e2294 /runtime/src/window.rs | |
parent | ef18ecf4ef0fe654578380059b467fe2fb34aa0a (diff) | |
parent | 5b6e205e998cbb20b3c8aaff8b515d78315d6703 (diff) | |
download | iced-f6966268bb6d58b4b03ba61fc5732e1bf016e2a1.tar.gz iced-f6966268bb6d58b4b03ba61fc5732e1bf016e2a1.tar.bz2 iced-f6966268bb6d58b4b03ba61fc5732e1bf016e2a1.zip |
Merge pull request #1845 from bungoboingo/feat/offscreen-rendering
Feat: Offscreen Rendering & Screenshots
Diffstat (limited to 'runtime/src/window.rs')
-rw-r--r-- | runtime/src/window.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/src/window.rs b/runtime/src/window.rs index d4111293..e448edef 100644 --- a/runtime/src/window.rs +++ b/runtime/src/window.rs @@ -1,7 +1,10 @@ //! Build window-based GUI applications. mod action; +pub mod screenshot; + pub use action::Action; +pub use screenshot::Screenshot; use crate::command::{self, Command}; use crate::core::time::Instant; @@ -115,3 +118,10 @@ pub fn fetch_id<Message>( pub fn change_icon<Message>(icon: Icon) -> Command<Message> { Command::single(command::Action::Window(Action::ChangeIcon(icon))) } + +/// Captures a [`Screenshot`] from the window. +pub fn screenshot<Message>( + f: impl FnOnce(Screenshot) -> Message + Send + 'static, +) -> Command<Message> { + Command::single(command::Action::Window(Action::Screenshot(Box::new(f)))) +} |