pub struct SvgIntrinsicDimensions {
pub width: Option<Length>,
pub height: Option<Length>,
pub view_box: Option<NonZeroRect>,
pub preserve_aspect_ratio: AspectRatio,
pub degenerate_view_box: bool,
}Expand description
Dimensions declared on the root <svg> element, before any resolution.
Unlike usvg::Tree::size, which always produces a concrete size, this
preserves what the SVG actually declared: absent attributes are None and
percentage lengths are kept unresolved.
Fields§
§width: Option<Length>The root width attribute, if declared. Percentages are unresolved.
height: Option<Length>The root height attribute, if declared. Percentages are unresolved.
view_box: Option<NonZeroRect>The root viewBox, if declared and valid.
preserve_aspect_ratio: AspectRatioThe root preserveAspectRatio (default xMidYMid meet).
degenerate_view_box: boolWhether the root declared a viewBox with a zero width or height,
which disables rendering of the element per the SVG spec.
Implementations§
Source§impl SvgIntrinsicDimensions
impl SvgIntrinsicDimensions
Sourcepub fn from_xmltree(doc: &Document<'_>) -> Self
pub fn from_xmltree(doc: &Document<'_>) -> Self
Extract the width/height/viewBox attributes declared on the root
element of an already-parsed SVG document, with absent attributes as
None and percentages unresolved. usvg::Tree does not preserve
these (it always resolves to a concrete size), so they are read from
the XML document here.
Trait Implementations§
Source§impl Clone for SvgIntrinsicDimensions
impl Clone for SvgIntrinsicDimensions
impl Copy for SvgIntrinsicDimensions
Source§impl Debug for SvgIntrinsicDimensions
impl Debug for SvgIntrinsicDimensions
Auto Trait Implementations§
impl Freeze for SvgIntrinsicDimensions
impl RefUnwindSafe for SvgIntrinsicDimensions
impl Send for SvgIntrinsicDimensions
impl Sync for SvgIntrinsicDimensions
impl Unpin for SvgIntrinsicDimensions
impl UnsafeUnpin for SvgIntrinsicDimensions
impl UnwindSafe for SvgIntrinsicDimensions
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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