Added offscreen rendering support for wgpu & tiny-skia exposed with the window::screenshot command.
This commit is contained in:
parent
c15f1b5f65
commit
233196eb14
16 changed files with 893 additions and 24 deletions
|
|
@ -7,6 +7,7 @@ use crate::command::{self, Command};
|
|||
use crate::core::time::Instant;
|
||||
use crate::core::window::{Event, Icon, Level, Mode, UserAttention};
|
||||
use crate::futures::subscription::{self, Subscription};
|
||||
use crate::screenshot::Screenshot;
|
||||
|
||||
/// Subscribes to the frames of the window of the running application.
|
||||
///
|
||||
|
|
@ -115,3 +116,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))))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue