Struct graphics::rectangle::Rectangle
[−]
[src]
pub struct Rectangle { pub color: Color, pub shape: Shape, pub border: Option<Border>, }
A filled rectangle
Fields
color: Color
The rectangle color
shape: Shape
The roundness of the rectangle
border: Option<Border>
The border
Methods
impl Rectangle
[src]
fn new(color: Color) -> Rectangle
Creates a new rectangle.
fn new_round(color: Color, round_radius: Radius) -> Rectangle
Creates a new rectangle with rounded corners.
fn new_border(color: Color, radius: Radius) -> Rectangle
Creates a new rectangle border.
fn new_round_border(color: Color,
round_radius: Radius,
border_radius: Radius)
-> Rectangle
round_radius: Radius,
border_radius: Radius)
-> Rectangle
Creates a new rectangle border with rounded corners.
fn color(self, value: Color) -> Self
Sets color.
fn shape(self, value: Shape) -> Self
Sets shape of the corners.
fn border(self, value: Border) -> Self
Sets border properties.
fn maybe_border(self, value: Option<Border>) -> Self
Sets optional border.
fn draw<R: Into<Rectangle>, G>(&self,
rectangle: R,
draw_state: &DrawState,
transform: Matrix2d,
g: &mut G) where G: Graphics
rectangle: R,
draw_state: &DrawState,
transform: Matrix2d,
g: &mut G) where 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
fn draw_tri<R: Into<Rectangle>, G>(&self,
rectangle: R,
draw_state: &DrawState,
transform: Matrix2d,
g: &mut G) where G: Graphics
rectangle: R,
draw_state: &DrawState,
transform: Matrix2d,
g: &mut G) where G: Graphics
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 Colored for Rectangle
[src]
fn mul_rgba(self,
r: ColorComponent,
g: ColorComponent,
b: ColorComponent,
a: ColorComponent)
-> Self
r: ColorComponent,
g: ColorComponent,
b: ColorComponent,
a: ColorComponent)
-> Self
Multiplies with red, green, blue and alpha values.
fn hue_rad(self, angle: ColorComponent) -> Self
Rotates hue by radians.
fn tint(self, f: ColorComponent) -> Self
Mixes the current color with white. Read more
fn shade(self, f: ColorComponent) -> Self
Mixes the current color with black. Read more
fn hue_deg(self, angle: ColorComponent) -> Self
Rotates hue by degrees.
impl Copy for Rectangle
[src]
impl Clone for Rectangle
[src]
fn clone(&self) -> Rectangle
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more