pub struct Viewport {
pub dpi: Dpi,
pub vbox: ViewBox,
pub transform: Transform,
}
Expand description
Holds the size of the current viewport in the user’s coordinate system.
Fields§
§dpi: Dpi
§vbox: ViewBox
Corners of the current coordinate space.
transform: Transform
The viewport’s coordinate system, or “user coordinate system” in SVG terms.
Implementations§
source§impl Viewport
impl Viewport
sourcepub fn new(dpi: Dpi, view_box_width: f64, view_box_height: f64) -> Viewport
pub fn new(dpi: Dpi, view_box_width: f64, view_box_height: f64) -> Viewport
FIXME: this is just used in Handle::with_height_to_user(), and in length.rs’s test suite. Find a way to do this without involving a default identity transform.
sourcepub fn with_units(&self, units: CoordUnits) -> Viewport
pub fn with_units(&self, units: CoordUnits) -> Viewport
Creates a new viewport suitable for a certain kind of units.
For objectBoundingBox
, CSS lengths which are in percentages
refer to the size of the current viewport. Librsvg implements
that by keeping the same current transformation matrix, and
setting a viewport size of (1.0, 1.0).
For userSpaceOnUse
, we just duplicate the current viewport,
since that kind of units means to use the current coordinate
system unchanged.
sourcepub fn with_view_box(&self, width: f64, height: f64) -> Viewport
pub fn with_view_box(&self, width: f64, height: f64) -> Viewport
Returns a viewport with a new size for normalizing Length
values.
pub fn with_composed_transform(&self, transform: Transform) -> Viewport
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Viewport
impl RefUnwindSafe for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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§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>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.