Rectangle


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.

Example

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

Revine Shape Rectangle

Parameters

ParameterDescriptionPossible valuesDefaultRequired?
positionthe position of the top-left cornerpoint-Yes
widthwidth of the rectangle0 to 500-Yes
heightheight of the rectangle0 to 500-Yes
thicknessthe thickness of each side1 to 1002No
colorthe color of the sidebuiltin colorsBLACKNo
fillthe color to fill the rectangle withbuiltin colorsWHITENo

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