Struct piston_window::Rectangle
source · pub struct Rectangle {
pub color: [f32; 4],
pub shape: Shape,
pub border: Option<Border>,
}
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§
source§impl 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§
source§impl 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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more