ferroui_controls_inking/
ink_platform_services.rs1use super::{InkError, InkStroke};
2use ferroui_base::Point;
3use std::future::Future;
4use std::pin::Pin;
5use std::rc::Rc;
6
7#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
10#[repr(i32)]
11pub enum InkPersistenceFormat {
12 GifWithEmbeddedIsf = 0,
13 Isf = 1,
14 #[default]
15 Portable = 2,
16}
17
18pub type InkServiceFuture<T> = Pin<Box<dyn Future<Output = Result<T, InkError>>>>;
19
20pub trait IInkPlatformServices {
24 fn save(
27 &self,
28 strokes: Vec<Rc<InkStroke>>,
29 format: InkPersistenceFormat,
30 ) -> InkServiceFuture<Vec<u8>>;
31 fn load(&self, data: Vec<u8>) -> InkServiceFuture<Vec<Rc<InkStroke>>>;
32 fn copy_to_clipboard(&self, strokes: &[Rc<InkStroke>]) -> Result<(), InkError>;
33 fn can_paste(&self) -> Result<bool, InkError>;
34 fn paste(&self, position: Point) -> Result<Vec<Rc<InkStroke>>, InkError>;
35}