pub struct Viewport {
pub size: ViewportSize,
pub font_size: f32,
pub device_pixel_ratio: f32,
}Expand description
The viewport for the image renderer.
Fields§
§size: ViewportSizeSize of the viewport
font_size: f32Initial font size in pixels, used as the fallback when no root element
has set its computed font-size (see CSS Values 4 §6.1 for rem).
device_pixel_ratio: f32The device pixel ratio.
Implementations§
Source§impl Viewport
impl Viewport
Sourcepub fn new(size: impl Into<ViewportSize>) -> Self
pub fn new(size: impl Into<ViewportSize>) -> Self
Creates a new viewport with the default font size.
Sourcepub const fn with_font_size(self, font_size: f32) -> Self
pub const fn with_font_size(self, font_size: f32) -> Self
Sets the font size in pixels.
Sourcepub const fn with_device_pixel_ratio(self, device_pixel_ratio: f32) -> Self
pub const fn with_device_pixel_ratio(self, device_pixel_ratio: f32) -> Self
Sets the device pixel ratio.
Trait Implementations§
impl Copy for Viewport
Auto Trait Implementations§
impl Freeze for Viewport
impl RefUnwindSafe for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin for Viewport
impl UnsafeUnpin for Viewport
impl UnwindSafe for Viewport
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