pub struct FrameDimensions {
pub width: u32,
pub height: u32,
}
Expand description
The dimensions of a frame.
Fields§
§width: u32
The width of the frame.
height: u32
The height of the frame.
Implementations§
Source§impl FrameDimensions
Extensions to FrameDimensions
for computing thumbnail dimensions.
impl FrameDimensions
Extensions to FrameDimensions
for computing thumbnail dimensions.
Sourcepub fn thumbnail_max_dimensions(scale_factor: i32) -> Self
pub fn thumbnail_max_dimensions(scale_factor: i32) -> Self
Get the maximum dimensions for a thumbnail with the given scale factor.
Sourcefn with_texture(texture: &Texture) -> Option<Self>
fn with_texture(texture: &Texture) -> Option<Self>
Construct a FrameDimensions
for the given texture.
Sourcepub(super) fn needs_thumbnail(
self,
thumbnail_dimensions: FrameDimensions,
) -> bool
pub(super) fn needs_thumbnail( self, thumbnail_dimensions: FrameDimensions, ) -> bool
Whether we should generate or request a thumbnail for these dimensions, given the wanted thumbnail dimensions.
Sourcepub(super) fn downscale_for(
self,
max_dimensions: FrameDimensions,
) -> Option<Self>
pub(super) fn downscale_for( self, max_dimensions: FrameDimensions, ) -> Option<Self>
Downscale these dimensions to fit into the given maximum dimensions while preserving the aspect ratio.
Returns None
if these dimensions are smaller than the maximum
dimensions.
Sourcefn to_image_loader_request(self, requested: Self) -> FrameRequest
fn to_image_loader_request(self, requested: Self) -> FrameRequest
Convert these dimensions to a request for the image loader with the requested dimensions.
Source§impl FrameDimensions
impl FrameDimensions
Sourcepub(crate) fn from_options(
width: Option<UInt>,
height: Option<UInt>,
) -> Option<Self>
pub(crate) fn from_options( width: Option<UInt>, height: Option<UInt>, ) -> Option<Self>
Construct a FrameDimensions
from the given optional dimensions.
Sourcepub(crate) fn dimension_for_orientation(self, orientation: Orientation) -> u32
pub(crate) fn dimension_for_orientation(self, orientation: Orientation) -> u32
Get the dimension for the given orientation.
Sourcepub(crate) fn dimension_for_other_orientation(
self,
orientation: Orientation,
) -> u32
pub(crate) fn dimension_for_other_orientation( self, orientation: Orientation, ) -> u32
Get the dimension for the other orientation than the given one.
Sourcepub(crate) fn ge(self, other: Self) -> bool
pub(crate) fn ge(self, other: Self) -> bool
Whether these dimensions are greater than or equal to the given dimensions.
Returns true
if either width
or height
is bigger than or equal to
the one in the other dimensions.
Sourcepub(crate) const fn increase_by(self, value: u32) -> Self
pub(crate) const fn increase_by(self, value: u32) -> Self
Increase both of these dimensions by the given value.
Sourcepub(crate) const fn scale(self, factor: u32) -> Self
pub(crate) const fn scale(self, factor: u32) -> Self
Scale these dimensions with the given factor.
Sourcepub(crate) fn scale_to_fit(
self,
requested: Self,
content_fit: ContentFit,
) -> Self
pub(crate) fn scale_to_fit( self, requested: Self, content_fit: ContentFit, ) -> Self
Scale these dimensions to fit into the requested dimensions while preserving the aspect ratio and respecting the given content fit.
Trait Implementations§
Source§impl Clone for FrameDimensions
impl Clone for FrameDimensions
Source§fn clone(&self) -> FrameDimensions
fn clone(&self) -> FrameDimensions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FrameDimensions
impl Debug for FrameDimensions
Source§impl PartialEq for FrameDimensions
impl PartialEq for FrameDimensions
impl Copy for FrameDimensions
impl Eq for FrameDimensions
impl StructuralPartialEq for FrameDimensions
Auto Trait Implementations§
impl Freeze for FrameDimensions
impl RefUnwindSafe for FrameDimensions
impl Send for FrameDimensions
impl Sync for FrameDimensions
impl Unpin for FrameDimensions
impl UnwindSafe for FrameDimensions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more