pub struct Rect { /* private fields */ }Expand description
A rect representation.
Width and height are guarantee to be > 0.
Implementations§
source§impl Rect
impl Rect
sourcepub fn new(x: f64, y: f64, width: f64, height: f64) -> Option<Self>
pub fn new(x: f64, y: f64, width: f64, height: f64) -> Option<Self>
Creates a new Rect from values.
sourcepub fn new_bbox() -> Self
pub fn new_bbox() -> Self
Creates a new Rect for bounding box calculation.
Shorthand for Rect::new(f64::MAX, f64::MAX, 1.0, 1.0).
sourcepub fn translate_to(&self, x: f64, y: f64) -> Self
pub fn translate_to(&self, x: f64, y: f64) -> Self
Translates the rect to the specified position.
sourcepub fn bbox_transform(&self, bbox: Rect) -> Self
pub fn bbox_transform(&self, bbox: Rect) -> Self
Transforms the Rect using the provided bbox.
sourcepub fn transform(&self, ts: &Transform) -> Option<Self>
pub fn transform(&self, ts: &Transform) -> Option<Self>
Transforms the Rect using the provided Transform.
This method is expensive.
sourcepub fn to_path_bbox(&self) -> PathBbox
pub fn to_path_bbox(&self) -> PathBbox
Returns rect’s size in screen units.
sourcepub fn to_screen_size(&self) -> ScreenSize
pub fn to_screen_size(&self) -> ScreenSize
Returns rect’s size in screen units.
sourcepub fn to_screen_rect(&self) -> ScreenRect
pub fn to_screen_rect(&self) -> ScreenRect
Returns rect in screen units.
Trait Implementations§
source§impl PartialEq for Rect
impl PartialEq for Rect
source§impl ToTokens for Rect
impl ToTokens for Rect
source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
impl Copy for Rect
impl Eq for Rect
Auto Trait Implementations§
impl Freeze for Rect
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnwindSafe for Rect
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