Struct piston_window::Rectangle
source · [−]Expand description
A filled rectangle
Fields
color: [f32; 4]
The rectangle color
shape: Shape
The roundness of the rectangle
border: Option<Border>
The border
Implementations
sourceimpl Rectangle
impl Rectangle
sourcepub fn new_round(color: [f32; 4], round_radius: f64) -> Rectangle
pub fn new_round(color: [f32; 4], round_radius: f64) -> Rectangle
Creates a new rectangle with rounded corners.
sourcepub fn new_round_border(
color: [f32; 4],
round_radius: f64,
border_radius: f64
) -> Rectangle
pub fn new_round_border(
color: [f32; 4],
round_radius: f64,
border_radius: f64
) -> Rectangle
Creates a new rectangle border with rounded corners.
sourcepub fn maybe_border(self, value: Option<Border>) -> Rectangle
pub fn maybe_border(self, value: Option<Border>) -> Rectangle
Sets optional border.
sourcepub 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,
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,
Draws the rectangle by corners using the default method.
sourcepub fn draw<R, G>(
&self,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2],
g: &mut G
) where
R: Into<[f64; 4]>,
G: Graphics,
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,
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
Trait Implementations
sourceimpl Colored for Rectangle
impl Colored for Rectangle
impl Copy for Rectangle
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more