Struct usvg::Rect[][src]

pub struct Rect { /* fields omitted */ }

A rect representation.

Width and height are guarantee to be > 0.

Implementations

impl Rect[src]

pub fn new(x: f64, y: f64, width: f64, height: f64) -> Option<Self>[src]

Creates a new Rect from values.

pub fn new_bbox() -> Self[src]

Creates a new Rect for bounding box calculation.

Shorthand for Rect::new(f64::MAX, f64::MAX, 1.0, 1.0).

pub fn size(&self) -> Size[src]

Returns rect’s size.

pub fn x(&self) -> f64[src]

Returns rect’s X position.

pub fn y(&self) -> f64[src]

Returns rect’s Y position.

pub fn width(&self) -> f64[src]

Returns rect’s width.

pub fn height(&self) -> f64[src]

Returns rect’s height.

pub fn left(&self) -> f64[src]

Returns rect’s left edge position.

pub fn right(&self) -> f64[src]

Returns rect’s right edge position.

pub fn top(&self) -> f64[src]

Returns rect’s top edge position.

pub fn bottom(&self) -> f64[src]

Returns rect’s bottom edge position.

pub fn translate(&self, tx: f64, ty: f64) -> Self[src]

Translates the rect by the specified offset.

pub fn translate_to(&self, x: f64, y: f64) -> Self[src]

Translates the rect to the specified position.

pub fn contains(&self, x: f64, y: f64) -> bool[src]

Checks that the rect contains a point.

pub fn expand(&self, r: Rect) -> Self[src]

Expands the Rect to the provided size.

pub fn bbox_transform(&self, bbox: Rect) -> Self[src]

Transforms the Rect using the provided bbox.

pub fn transform(&self, ts: &Transform) -> Option<Self>[src]

Transforms the Rect using the provided Transform.

This method is expensive.

pub fn to_screen_size(&self) -> ScreenSize[src]

Returns rect’s size in screen units.

pub fn to_screen_rect(&self) -> ScreenRect[src]

Returns rect in screen units.

Trait Implementations

impl Clone for Rect[src]

impl Copy for Rect[src]

impl Debug for Rect[src]

impl Display for Rect[src]

impl FuzzyEq<Rect> for Rect[src]

Auto Trait Implementations

impl RefUnwindSafe for Rect

impl Send for Rect

impl Sync for Rect

impl Unpin for Rect

impl UnwindSafe for Rect

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.