The rectangle
shape draws a rectangle on the canvas. To draw the rectangle provide the parameter position
that specifies the top-left corner, and width
and height
specifying the width and the height of the rectangle respectively. You can optionally specify the color
and thickness
of the rectangle and can choose to color fill
it.
To understand how to declare and draw a shape please refer, to this document.
To declare and draw a rectangle named TheBigRedRectangle
at the point (100, 100)
with width being 100
, height being 40
, thickness of 2
units, and filled with Red color we write the following statement.
shape TheBigRedRectangle(rectangle):
.position = (100, 100)
.width = 100
.height = 40
.thickness = 2
.color = BLACK
.fill = RED
endshape
Parameter | Description | Possible values | Default | Required? |
---|---|---|---|---|
position | the position of the top-left corner | point | - | Yes |
width | width of the rectangle | 0 to 500 | - | Yes |
height | height of the rectangle | 0 to 500 | - | Yes |
thickness | the thickness of each side | 1 to 100 | 2 | No |
color | the color of the side | builtin colors | BLACK | No |
fill | the color to fill the rectangle with | builtin colors | WHITE | No |
Notice any errors or typos? Please let us know or feel free to edit rectangle.md and issue a pull request.
Follow us on twitter @RevineLang
Built by Arpit Bhayani