pub struct LayerProperties {
pub opacity: f32,
pub translation: Vector,
pub scale: Vector,
pub scale_anchor: Vector,
}Expand description
How a retained layer is presented without repainting it: faded, moved, and scaled. Changing these updates the composited layer only.
Fields§
§opacity: f32§translation: Vector§scale: VectorScale factors along x and y, applied around scale_anchor before
translation. (1, 1) presents the layer as painted.
scale_anchor: VectorThe point scaling keeps fixed, as a fraction of the layer’s bounds:
(0.5, 0.5) is the center, (0.5, 0.0) the middle of the top edge.
Implementations§
Source§impl LayerProperties
impl LayerProperties
pub const IDENTITY_SCALE: Vector
pub const CENTER: Vector
pub const fn new(opacity: f32, translation: Vector) -> LayerProperties
pub const fn with_opacity(self, opacity: f32) -> LayerProperties
pub const fn with_translation(self, translation: Vector) -> LayerProperties
Sourcepub const fn with_scale(self, scale: f32) -> LayerProperties
pub const fn with_scale(self, scale: f32) -> LayerProperties
Scale uniformly by scale around the scale anchor.
Sourcepub const fn with_scale_xy(self, scale: Vector) -> LayerProperties
pub const fn with_scale_xy(self, scale: Vector) -> LayerProperties
Scale by scale.x horizontally and scale.y vertically.
Sourcepub const fn with_scale_anchor(self, anchor: Vector) -> LayerProperties
pub const fn with_scale_anchor(self, anchor: Vector) -> LayerProperties
Scale around this point, as a fraction of the layer’s bounds.
pub fn is_scaled(&self) -> bool
Sourcepub fn anchor_point(&self, bounds: Rect) -> Point
pub fn anchor_point(&self, bounds: Rect) -> Point
The point in window coordinates that scaling keeps fixed for a layer
laid out at bounds.
Sourcepub fn map_point(&self, bounds: Rect, point: Point) -> Point
pub fn map_point(&self, bounds: Rect, point: Point) -> Point
Where point is presented for a layer laid out at bounds.
Trait Implementations§
Source§impl Clone for LayerProperties
impl Clone for LayerProperties
Source§fn clone(&self) -> LayerProperties
fn clone(&self) -> LayerProperties
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for LayerProperties
Source§impl Debug for LayerProperties
impl Debug for LayerProperties
Source§impl Default for LayerProperties
impl Default for LayerProperties
Source§fn default() -> LayerProperties
fn default() -> LayerProperties
Returns the “default value” for a type. Read more
Source§impl PartialEq for LayerProperties
impl PartialEq for LayerProperties
impl StructuralPartialEq for LayerProperties
Auto Trait Implementations§
impl Forget for LayerProperties
impl Freeze for LayerProperties
impl Move for LayerProperties
impl RefUnwindSafe for LayerProperties
impl Send for LayerProperties
impl Sync for LayerProperties
impl Unpin for LayerProperties
impl UnsafeUnpin for LayerProperties
impl UnwindSafe for LayerProperties
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.