pub struct SvgImageData {
pub tree: Arc<Tree>,
pub intrinsic_width: Option<f32>,
pub intrinsic_height: Option<f32>,
}Expand description
A parsed SVG image together with its CSS intrinsic dimensions.
usvg always resolves the root <svg> to a concrete usvg::Tree::size,
falling back to the viewBox size when width/height are absent or given
as percentages. For CSS sizing purposes, however, such an SVG has no
intrinsic width/height (only an intrinsic aspect ratio). We record which
dimensions were actually declared as absolute lengths so the paint layer can
apply the CSS default sizing algorithm correctly.
Fields§
§tree: Arc<Tree>The parsed SVG tree.
intrinsic_width: Option<f32>The intrinsic width in CSS px, present only when the root <svg>
declared an absolute (non-percentage) width.
intrinsic_height: Option<f32>The intrinsic height in CSS px, present only when the root <svg>
declared an absolute (non-percentage) height.
Implementations§
Source§impl SvgImageData
impl SvgImageData
Sourcepub fn aspect_ratio(&self) -> f32
pub fn aspect_ratio(&self) -> f32
The intrinsic aspect ratio of the SVG (always available: usvg resolves
the viewBox or declared size into a non-zero usvg::Tree::size).
Trait Implementations§
Source§impl Clone for SvgImageData
impl Clone for SvgImageData
Source§fn clone(&self) -> SvgImageData
fn clone(&self) -> SvgImageData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SvgImageData
impl !UnwindSafe for SvgImageData
impl Freeze for SvgImageData
impl Send for SvgImageData
impl Sync for SvgImageData
impl Unpin for SvgImageData
impl UnsafeUnpin for SvgImageData
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