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
[src]
Creates a new rectangle.
fn new_round(color: Color, round_radius: Radius) -> Rectangle
[src]
Creates a new rectangle with rounded corners.
fn new_border(color: Color, radius: Radius) -> Rectangle
[src]
Creates a new rectangle border.
fn new_round_border(
color: Color,
round_radius: Radius,
border_radius: Radius
) -> Rectangle
[src]
color: Color,
round_radius: Radius,
border_radius: Radius
) -> Rectangle
Creates a new rectangle border with rounded corners.
fn color(self, value: Color) -> Self
[src]
Sets color.
fn shape(self, value: Shape) -> Self
[src]
Sets shape of the corners.
fn border(self, value: Border) -> Self
[src]
Sets border properties.
fn maybe_border(self, value: Option<Border>) -> Self
[src]
Sets optional border.
fn draw<R: Into<Rectangle>, G>(
&self,
rectangle: R,
draw_state: &DrawState,
transform: Matrix2d,
g: &mut G
) where
G: Graphics,
[src]
&self,
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,
[src]
&self,
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
[src]
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
[src]
Rotates hue by radians.
fn tint(self, f: ColorComponent) -> Self
[src]
Mixes the current color with white. Read more
fn shade(self, f: ColorComponent) -> Self
[src]
Mixes the current color with black. Read more
fn hue_deg(self, angle: ColorComponent) -> Self
[src]
Rotates hue by degrees.