Struct piston_window::Rectangle[][src]

pub struct Rectangle {
    pub color: [f32; 4],
    pub shape: Shape,
    pub border: Option<Border>,
}

A filled rectangle

Fields

color: [f32; 4]

The rectangle color

shape: Shape

The roundness of the rectangle

border: Option<Border>

The border

Implementations

impl Rectangle[src]

pub fn new(color: [f32; 4]) -> Rectangle[src]

Creates a new rectangle.

pub fn new_round(color: [f32; 4], round_radius: f64) -> Rectangle[src]

Creates a new rectangle with rounded corners.

pub fn new_border(color: [f32; 4], radius: f64) -> Rectangle[src]

Creates a new rectangle border.

pub fn new_round_border(
    color: [f32; 4],
    round_radius: f64,
    border_radius: f64
) -> Rectangle
[src]

Creates a new rectangle border with rounded corners.

pub fn color(self, value: [f32; 4]) -> Rectangle[src]

Sets color.

pub fn shape(self, value: Shape) -> Rectangle[src]

Sets shape of the corners.

pub fn border(self, value: Border) -> Rectangle[src]

Sets border properties.

pub fn maybe_border(self, value: Option<Border>) -> Rectangle[src]

Sets optional border.

pub fn draw_from_to<P, G>(
    &self,
    from: P,
    to: P,
    draw_state: &DrawState,
    transform: [[f64; 3]; 2],
    g: &mut G
) where
    P: Into<[f64; 2]>,
    G: Graphics
[src]

Draws the rectangle by corners using the default method.

pub fn draw<R, G>(
    &self,
    rectangle: R,
    draw_state: &DrawState,
    transform: [[f64; 3]; 2],
    g: &mut G
) where
    R: Into<[f64; 4]>,
    G: Graphics
[src]

Draws the rectangle using the default method.

rectangle defines the rectangle’s location and dimensions, draw_state draw state, draw_state::Default::default() can be used as a default, transform is the transformation matrix, g is the Graphics implementation, that is used to actually draw the rectangle.s

pub fn draw_tri<R, G>(
    &self,
    rectangle: R,
    draw_state: &DrawState,
    transform: [[f64; 3]; 2],
    g: &mut G
) where
    R: Into<[f64; 4]>,
    G: Graphics
[src]

Draws the rectangle using triangulation.

This is the default implementation of draw() that will be used if G does not redefine Graphics::rectangle().

Trait Implementations

impl Clone for Rectangle[src]

impl Colored for Rectangle[src]

impl Copy for Rectangle[src]

Auto Trait Implementations

impl RefUnwindSafe for Rectangle

impl Send for Rectangle

impl Sync for Rectangle

impl Unpin for Rectangle

impl UnwindSafe for Rectangle

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> Pointable for T[src]

type Init = T

The type for initializers.

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

type Owned = T

The resulting type after obtaining ownership.

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.