pub struct AspectRatio {
defer: bool,
align: Option<Align>,
}Fields§
§defer: bool§align: Option<Align>Implementations§
Source§impl AspectRatio
impl AspectRatio
Sourcepub fn none() -> AspectRatio
pub fn none() -> AspectRatio
Produces the equivalent of preserveAspectRatio="none".
pub fn is_slice(&self) -> bool
pub fn compute(&self, vbox: &ViewBox, viewport: &Rect) -> Rect
Sourcepub fn viewport_to_viewbox_transform(
&self,
vbox: Option<ViewBox>,
viewport: &Rect,
) -> Result<Option<ValidTransform>, InvalidTransform>
pub fn viewport_to_viewbox_transform( &self, vbox: Option<ViewBox>, viewport: &Rect, ) -> Result<Option<ValidTransform>, InvalidTransform>
Computes the viewport to viewbox transformation.
Given a viewport, returns a transformation that will create a coordinate
space inside it. The (vbox.x0, vbox.y0) will be mapped to the viewport’s
upper-left corner, and the (vbox.x1, vbox.y1) will be mapped to the viewport’s
lower-right corner.
If the vbox or viewport are empty, returns Ok(None). Per the SVG spec, either
of those mean that the corresponding element should not be rendered.
If the vbox would create an invalid transform (say, a vbox with huge numbers that
leads to a near-zero scaling transform), returns an Err(()).
Trait Implementations§
Source§impl Clone for AspectRatio
impl Clone for AspectRatio
Source§fn clone(&self) -> AspectRatio
fn clone(&self) -> AspectRatio
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AspectRatio
impl Debug for AspectRatio
Source§impl Default for AspectRatio
impl Default for AspectRatio
Source§fn default() -> AspectRatio
fn default() -> AspectRatio
Returns the “default value” for a type. Read more
Source§impl Parse for AspectRatio
impl Parse for AspectRatio
Source§fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<AspectRatio, ParseError<'i>>
fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<AspectRatio, ParseError<'i>>
Parses a value out of the
parser. Read moreSource§impl PartialEq for AspectRatio
impl PartialEq for AspectRatio
impl Copy for AspectRatio
impl Eq for AspectRatio
impl StructuralPartialEq for AspectRatio
Auto Trait Implementations§
impl Freeze for AspectRatio
impl RefUnwindSafe for AspectRatio
impl Send for AspectRatio
impl Sync for AspectRatio
impl Unpin for AspectRatio
impl UnwindSafe for AspectRatio
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.