Debian Codegraph @

third_party/rust/wpf-gpu-raster/src/matrix.rs

raw
1 use std::marker::PhantomData;
2
3 use crate::types::CoordinateSpace;
4
5 pub type CMILMatrix = CMatrix<CoordinateSpace::Shape,CoordinateSpace::Device>;
6 #[derive(Default, Clone)]
7 pub struct CMatrix<InCoordSpace, OutCoordSpace> {
8 _11: f32, _12: f32, _13: f32, _14: f32,
9 _21: f32, _22: f32, _23: f32 , _24: f32,
10 _31: f32, _32: f32, _33: f32, _34: f32,
11 _41: f32, _42: f32, _43: f32, _44: f32,
12 in_coord: PhantomData<InCoordSpace>,
13 out_coord: PhantomData<OutCoordSpace>
14 }
15
16 impl<InCoordSpace: Default, OutCoordSpace: Default> CMatrix<InCoordSpace, OutCoordSpace> {
17 pub fn Identity() -> Self { let mut ret: Self = Default::default();
18 ret._11 = 1.;
19 ret._22 = 1.;
20 ret._33 = 1.;
21 ret._44 = 1.;
22 ret
23 }
24 pub fn GetM11(&self) -> f32 { self._11 }
25 pub fn GetM12(&self) -> f32 { self._12 }
26 pub fn GetM21(&self) -> f32 { self._21 }
27 pub fn GetM22(&self) -> f32 { self._22 }
28 pub fn GetDx(&self) -> f32 { self._41 }
29 pub fn GetDy(&self) -> f32 { self._42 }
30
31 pub fn SetM11(&mut self, r: f32) { self._11 = r}
32 pub fn SetM12(&mut self, r: f32) { self._12 = r}
33 pub fn SetM21(&mut self, r: f32) { self._21 = r}
34 pub fn SetM22(&mut self, r: f32) { self._22 = r}
35 pub fn SetDx(&mut self, dx: f32) { self._41 = dx }
36 pub fn SetDy(&mut self, dy: f32) { self._42 = dy }
37 }