Module graphics::rectangle [] [src]

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

Reexports

pub use math::margin_rectangle as margin;

Structs

Border

The border of the rectangle

Rectangle

A filled rectangle

Enums

Shape

The shape of the rectangle corners

Functions

centered

Use x, y, half-width, half-height

centered_square

Create types::Rectangle for a square with a center in (x, y) and side 2 * radius.

rectangle_by_corners

Create types::Rectangle by the two opposit corners.

square

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