Struct usvg_tree::NonZeroRect
source · pub struct NonZeroRect { /* private fields */ }
Expand description
A rectangle defined by left, top, right and bottom edges.
Similar to Rect
, but width and height guarantee to be non-zero and positive.
Guarantees
- All values are finite.
- Left edge is < right.
- Top edge is < bottom.
- Width and height are <= f32::MAX.
- Width and height are > 0.0
Implementations§
source§impl NonZeroRect
impl NonZeroRect
sourcepub fn from_ltrb(
left: f32,
top: f32,
right: f32,
bottom: f32
) -> Option<NonZeroRect>
pub fn from_ltrb( left: f32, top: f32, right: f32, bottom: f32 ) -> Option<NonZeroRect>
Creates new NonZeroRect
.
sourcepub fn from_xywh(x: f32, y: f32, w: f32, h: f32) -> Option<NonZeroRect>
pub fn from_xywh(x: f32, y: f32, w: f32, h: f32) -> Option<NonZeroRect>
Creates new NonZeroRect
.
sourcepub fn translate_to(&self, x: f32, y: f32) -> Option<NonZeroRect>
pub fn translate_to(&self, x: f32, y: f32) -> Option<NonZeroRect>
Translates the rect to the specified position.
sourcepub fn transform(&self, ts: Transform) -> Option<NonZeroRect>
pub fn transform(&self, ts: Transform) -> Option<NonZeroRect>
Transforms the rect using the provided Transform
.
This method is expensive.
sourcepub fn bbox_transform(&self, bbox: NonZeroRect) -> NonZeroRect
pub fn bbox_transform(&self, bbox: NonZeroRect) -> NonZeroRect
Applies a bounding box transform.
sourcepub fn to_int_rect(&self) -> IntRect
pub fn to_int_rect(&self) -> IntRect
Converts into IntRect
.
Trait Implementations§
source§impl Clone for NonZeroRect
impl Clone for NonZeroRect
source§fn clone(&self) -> NonZeroRect
fn clone(&self) -> NonZeroRect
Returns a copy 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 NonZeroRect
impl Debug for NonZeroRect
source§impl From<NonZeroRect> for BBox
impl From<NonZeroRect> for BBox
source§fn from(r: NonZeroRect) -> Self
fn from(r: NonZeroRect) -> Self
Converts to this type from the input type.
source§impl PartialEq for NonZeroRect
impl PartialEq for NonZeroRect
source§fn eq(&self, other: &NonZeroRect) -> bool
fn eq(&self, other: &NonZeroRect) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for NonZeroRect
impl StructuralPartialEq for NonZeroRect
Auto Trait Implementations§
impl RefUnwindSafe for NonZeroRect
impl Send for NonZeroRect
impl Sync for NonZeroRect
impl Unpin for NonZeroRect
impl UnwindSafe for NonZeroRect
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