[−]Struct piston_window::rectangle::Rectangle
A filled rectangle
Fields
color: [f32; 4]
The rectangle color
shape: Shape
The roundness of the rectangle
border: Option<Border>
The border
Methods
impl Rectangle
pub fn new(color: [f32; 4]) -> Rectangle
Creates a new rectangle.
pub fn new_round(color: [f32; 4], round_radius: f64) -> Rectangle
Creates a new rectangle with rounded corners.
pub fn new_border(color: [f32; 4], radius: f64) -> Rectangle
Creates a new rectangle border.
pub fn new_round_border(
color: [f32; 4],
round_radius: f64,
border_radius: f64
) -> Rectangle
color: [f32; 4],
round_radius: f64,
border_radius: f64
) -> Rectangle
Creates a new rectangle border with rounded corners.
pub fn color(self, value: [f32; 4]) -> Rectangle
Sets color.
pub fn shape(self, value: Shape) -> Rectangle
Sets shape of the corners.
pub fn border(self, value: Border) -> Rectangle
Sets border properties.
pub fn maybe_border(self, value: Option<Border>) -> Rectangle
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
G: Graphics,
P: Into<[f64; 2]>,
&self,
from: P,
to: P,
draw_state: &DrawState,
transform: [[f64; 3]; 2],
g: &mut G
) where
G: Graphics,
P: Into<[f64; 2]>,
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
G: Graphics,
R: Into<[f64; 4]>,
&self,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2],
g: &mut G
) where
G: Graphics,
R: Into<[f64; 4]>,
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
G: Graphics,
R: Into<[f64; 4]>,
&self,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2],
g: &mut G
) where
G: Graphics,
R: Into<[f64; 4]>,
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
fn clone(&self) -> Rectangle
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Colored for Rectangle
fn mul_rgba(self, r: f32, g: f32, b: f32, a: f32) -> Rectangle
fn hue_rad(self, angle: f32) -> Rectangle
fn tint(self, f: f32) -> Self
fn shade(self, f: f32) -> Self
fn hue_deg(self, angle: f32) -> Self
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,