Expand description
A filled rectangle
Fields
color: Color
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: Color, round_radius: Radius) -> Rectangle
pub fn new_round(color: Color, round_radius: Radius) -> Rectangle
Creates a new rectangle with rounded corners.
sourcepub fn new_border(color: Color, radius: Radius) -> Rectangle
pub fn new_border(color: Color, radius: Radius) -> Rectangle
Creates a new rectangle border.
sourcepub fn new_round_border(
color: Color,
round_radius: Radius,
border_radius: Radius
) -> Rectangle
pub fn new_round_border(
color: Color,
round_radius: Radius,
border_radius: Radius
) -> Rectangle
Creates a new rectangle border with rounded corners.
sourcepub fn maybe_border(self, value: Option<Border>) -> Self
pub fn maybe_border(self, value: Option<Border>) -> Self
Sets optional border.
sourcepub fn draw<R: Into<Rectangle>, G>(
&self,
rectangle: R,
draw_state: &DrawState,
transform: Matrix2d,
g: &mut G
)where
G: Graphics,
pub fn draw<R: Into<Rectangle>, G>(
&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
Trait Implementations
sourceimpl Colored for Rectangle
impl Colored for Rectangle
sourcefn mul_rgba(
self,
r: ColorComponent,
g: ColorComponent,
b: ColorComponent,
a: ColorComponent
) -> Self
fn mul_rgba(
self,
r: ColorComponent,
g: ColorComponent,
b: ColorComponent,
a: ColorComponent
) -> Self
Multiplies with red, green, blue and alpha values.
sourcefn hue_rad(self, angle: ColorComponent) -> Self
fn hue_rad(self, angle: ColorComponent) -> Self
Rotates hue by radians.
sourcefn tint(self, f: ColorComponent) -> Self
fn tint(self, f: ColorComponent) -> Self
Mixes the current color with white. Read more
sourcefn shade(self, f: ColorComponent) -> Self
fn shade(self, f: ColorComponent) -> Self
Mixes the current color with black. Read more
sourcefn hue_deg(self, angle: ColorComponent) -> Self
fn hue_deg(self, angle: ColorComponent) -> Self
Rotates hue by degrees.
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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more