pub struct Affine {
pub sx: f32,
pub ky: f32,
pub kx: f32,
pub sy: f32,
pub tx: f32,
pub ty: f32,
}Expand description
A 2D affine transform, in the order tiny-skia’s Transform::from_row
takes: a point (x, y) goes to (sx·x + kx·y + tx, ky·x + sy·y + ty).
Fields§
§sx: f32How far x moves along x.
ky: f32How far x moves along y.
kx: f32How far y moves along x.
sy: f32How far y moves along y.
tx: f32Added to x.
ty: f32Added to y.
Implementations§
Source§impl Affine
impl Affine
Sourcepub fn layer_zoom(&self) -> f32
pub fn layer_zoom(&self) -> f32
How many times its own resolution a layer drawn through this transform, from the window down, is drawn at, so what it scales up stays sharp: the most it stretches a length, rounded up to a quarter and kept from 1 to 4. A scale-down draws at its own size, and an animated scale-up changes it only every quarter.
use crabshell_ui::Affine;
let scale = |s: f32| Affine { sx: s, ky: 0.0, kx: 0.0, sy: s, tx: 0.0, ty: 0.0 };
assert_eq!(scale(3.0).layer_zoom(), 3.0);
assert_eq!(scale(1.1).layer_zoom(), 1.25);
assert_eq!(scale(0.5).layer_zoom(), 1.0);
assert_eq!(scale(9.0).layer_zoom(), 4.0);Trait Implementations§
impl Copy for Affine
impl StructuralPartialEq for Affine
Auto Trait Implementations§
impl Forget for Affine
impl Freeze for Affine
impl Move for Affine
impl RefUnwindSafe for Affine
impl Send for Affine
impl Sync for Affine
impl Unpin for Affine
impl UnsafeUnpin for Affine
impl UnwindSafe for Affine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more