[]Module piston_window::rectangle

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:

This example is not tested
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

Border

The border of the rectangle

Rectangle

A filled rectangle

Enums

Shape

The shape of the rectangle corners

Functions

margin

Shrinks a rectangle by a factor on all sides.

rectangle_by_corners

Create types::Rectangle by the two opposite corners.

square

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