Expand description
Draw rectangle
This module contains the definintion of a rectangle with possibly rounded
corners. It contains the code to draw the rectangle and defines properties
like color and shape. The rectangle dimensions and location are specified by
types::Rectangle
.
To draw a square with side 10 and top left corner in (0, 0), do the following:
ⓘ
let rectangle = Rectangle::new(color::BLACK);
let dims = square(0.0, 0.0, 10.0);
rectangle.draw(dims, &draw_state::Default::default(), transform, g);
Re-exports§
pub use crate::math::margin_rectangle as margin;
Structs§
- The border of the rectangle
- A filled rectangle
Enums§
- The shape of the rectangle corners
Functions§
- Create a centered rectangle.
- Create
types::Rectangle
for a square with a center in (x
,y
) and side2 * radius
. - Create
types::Rectangle
by the two opposite corners. - Create
types::Rectangle
for a square with a top-left corner in (x
,y
) and sidesize
.