pub struct Rectangle {
pub color: Color,
pub shape: Shape,
pub border: Option<Border>,
}
Expand description
A filled rectangle
Fields§
§color: Color
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: 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_from_to<P: Into<Vec2d>, G>(
&self,
from: P,
to: P,
draw_state: &DrawState,
transform: Matrix2d,
g: &mut G,
)where
G: Graphics,
pub fn draw_from_to<P: Into<Vec2d>, G>(
&self,
from: P,
to: P,
draw_state: &DrawState,
transform: Matrix2d,
g: &mut G,
)where
G: Graphics,
Draws the rectangle by corners using the default method.
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§
source§impl Colored for Rectangle
impl Colored for Rectangle
source§fn 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.
source§fn hue_rad(self, angle: ColorComponent) -> Self
fn hue_rad(self, angle: ColorComponent) -> Self
Rotates hue by radians.
source§fn tint(self, f: ColorComponent) -> Self
fn tint(self, f: ColorComponent) -> Self
Mixes the current color with white. Read more
source§fn shade(self, f: ColorComponent) -> Self
fn shade(self, f: ColorComponent) -> Self
Mixes the current color with black. Read more
source§fn 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 Freeze for Rectangle
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)