Skip to main content

ferroui_base/media/immutable/
immutable_transform.rs

1use crate::media::ITransform;
2use crate::Matrix;
3use std::any::Any;
4
5/// Represents a transform on a visual or brush whose value cannot change.
6#[derive(Clone, Copy, Debug)]
7pub struct ImmutableTransform {
8    value: Matrix,
9}
10
11impl ImmutableTransform {
12    pub const fn new(matrix: Matrix) -> Self {
13        Self { value: matrix }
14    }
15
16    /// The transform's matrix.
17    #[inline]
18    pub fn value(&self) -> Matrix {
19        self.value
20    }
21}
22
23impl ITransform for ImmutableTransform {
24    #[inline]
25    fn value(&self) -> Matrix {
26        self.value
27    }
28
29    fn as_any(&self) -> &dyn Any {
30        self
31    }
32}