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.