pub enum ImageFit {
Contain,
Cover,
Fill,
None,
}Expand description
Cómo encajar una imagen en el rect del nodo (CSS object-fit /
Flutter BoxFit). El runtime calcula la escala y el origen
correspondientes a esta política y siempre recorta al
node_rrect del nodo, así el clip respeta radius /
corner_radii.
Variants§
Contain
Preservar aspect ratio, caber dentro del rect (escala =
min(sx, sy)). Deja banda en el eje menos restrictivo.
CSS object-fit: contain / Flutter BoxFit.contain. Default
histórico — lo que hacía View::image() antes del Bloque 12.
Cover
Preservar aspect ratio, cubrir todo el rect (escala =
max(sx, sy)). Recorta el sobrante en el eje menos
restrictivo (el clip al node_rrect lo absorbe). CSS
object-fit: cover / Flutter BoxFit.cover — ideal para
avatares y hero images.
Fill
Estirar la imagen para ocupar el rect, sin preservar
aspect ratio (sx/sy independientes). CSS object-fit: fill / Flutter BoxFit.fill.
None
No escalar la imagen — pintarla a su tamaño original,
centrada en el rect. Si la imagen excede el rect, el clip al
node_rrect la recorta. CSS object-fit: none / Flutter
BoxFit.none.
Trait Implementations§
impl Copy for ImageFit
impl Eq for ImageFit
impl StructuralPartialEq for ImageFit
Auto Trait Implementations§
impl Freeze for ImageFit
impl RefUnwindSafe for ImageFit
impl Send for ImageFit
impl Sync for ImageFit
impl Unpin for ImageFit
impl UnsafeUnpin for ImageFit
impl UnwindSafe for ImageFit
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
impl<T> Brush for T
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.