animate/runtime/lottie/
lottie_drawable.rs

1use crate::{Canvas, Pattern, Rect, Size};
2// use dx::Matrix; // not available in wasm
3// use crate::Image; // not available in wasm
4use primitives::CanvasContext;
5
6use super::{
7    model::{layer::CompositionLayer, KeyPath},
8    LottieComposition, LottieDelegates,
9};
10
11pub struct LottieFontStyle {
12    font_family: String,
13    style: String,
14}
15
16impl LottieFontStyle {
17    pub fn new(font_family: &str, style: &str) -> Self {
18        Self {
19            font_family: font_family.into(),
20            style: style.into(),
21        }
22    }
23}
24
25pub struct LottieDrawable {
26    composition: LottieComposition,
27    // matrix: Matrix,// not available in wasm
28    composition_layer: CompositionLayer,
29    size: Size<f64>,
30    delegates: LottieDelegates,
31    is_dirty: bool,
32    enable_merge_paths: bool,
33    /// Gives a suggestion whether to paint with anti-aliasing, or not.
34    /// Default is true.
35    anti_aliasing_suggested: bool,
36
37    /// Sets whether to apply opacity to the each layer instead of shape.
38    ///
39    /// Opacity is normally applied directly to a shape. In cases where translucent
40    /// shapes overlap, applying opacity to a layer will be more accurate at the
41    /// expense of performance.
42    ///
43    /// The default value is false.
44    ///
45    /// Note: This process is very expensive. The performance impact will be reduced
46    /// when hardware acceleration is enabled.
47    is_applying_opacity_to_layers_enabled: bool,
48}
49
50impl LottieDrawable {
51    pub fn get_progress(&self) -> f64 {
52        unimplemented!()
53    }
54
55    pub fn set_progress(&self, value: f64) -> f64 {
56        unimplemented!()
57    }
58
59    pub fn get_delegates(&self) -> LottieDelegates {
60        unimplemented!()
61    }
62
63    pub fn set_delegates(&self, delegates: LottieDelegates) -> LottieDelegates {
64        unimplemented!()
65    }
66
67    pub fn get_use_text_glyphs(&self) -> bool {
68        unimplemented!()
69    }
70
71    // pub fn get_image_asset(&self, key: &str) -> Image {
72    //     unimplemented!()
73    // }
74
75    // pub fn get_text_style(&self, font: &str, style: &str) -> TextStyle {
76    //     unimplemented!()
77    // }
78
79    // fn update_value_delegates(&self, new_delegates: Vec<ValueDelegate>) {
80    //     unimplemented!()
81    // }
82
83    /// Takes a {@link KeyPath}, potentially with wildcards or globstars and resolve it to a list of
84    /// zero or more actual {@link KeyPath Keypaths} that exist in the current animation.
85    /// <p>
86    /// If you want to set value callbacks for any of these values, it is recommend to use the
87    /// returned {@link KeyPath} objects because they will be internally resolved to their content
88    /// and won't trigger a tree walk of the animation contents when applied.
89    fn resolve_key_path(&self, key_path: KeyPath) -> Vec<KeyPath> {
90        unimplemented!()
91    }
92
93    // )))
94    // should add `fit` and `alignment`
95    pub fn draw(&self, canvas: Canvas, rect: Rect<f64>) {
96        unimplemented!()
97    }
98}