Struct usvg::ScreenRect[][src]

pub struct ScreenRect { /* fields omitted */ }

A 2D screen rect representation.

Width and height are guarantee to be > 0.


impl ScreenRect[src]

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

Creates a new Rect from values.

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

Returns rect’s size.

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

Returns rect’s X position.

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

Returns rect’s Y position.

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

Returns rect’s width.

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

Returns rect’s height.

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

Returns rect’s left edge position.

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

Returns rect’s right edge position.

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

Returns rect’s top edge position.

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

Returns rect’s bottom edge position.

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

Translates the rect by the specified offset.

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

Translates the rect to the specified position.

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

Checks that rect contains a point.

pub fn fit_to_rect(&self, bounds: ScreenRect) -> Self[src]

Fits the current rect into the specified bounds.

pub fn to_rect(&self) -> Rect[src]

Converts into Rect.

Trait Implementations

impl Clone for ScreenRect[src]

impl Copy for ScreenRect[src]

impl Debug for ScreenRect[src]

impl Display for ScreenRect[src]

impl PartialEq<ScreenRect> for ScreenRect[src]

impl StructuralPartialEq for ScreenRect[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.