Module graphics::rectangle

source ·
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

Structs

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.
  • 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.