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);

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 side 2 * radius.

Shrinks a rectangle by a factor on all sides.

Create types::Rectangle by the two opposite corners.

Create types::Rectangle for a square with a top-left corner in (x, y) and side size.