Rectangle
Creating a Rectangle
You can create a rectangle in Ehhlang using the rect
keyword. The rect
keyword is followed by the position, width, height, and color of the rectangle. For example, to create a rectangle at position (100, 100) with width 200, height 100, and the white color, you can use the following code:
Output:
In the above example, we have created a rectangle at position (100, 100) with width 200, height 100, and the white color.
Properties
The rectangle has the following properties:
position
: The position of the rectangle. The position is specified in the formatX, Y
.width
: The width of the rectangle.height
: The height of the rectangle.color
: The color of the rectangle. The color is specified in RGB formatR, G, B
.thickness
: The thickness of the rectangle. The default thickness is 1.fillColor
: The fill color of the rectangle. The fill color is specified in RGB formatR, G, B
. It can be set tono
if it is inherited from a rectangle that has fill color and the current object doesn't want to inherit it.
Conclusion
A rectangle is a four-sided polygon with four right angles. You can create a rectangle in Ehhlang using the rect
keyword and specify the position, width, height, color, thickness, and fill color of the rectangle. This helps you to create images with different rectangles and colors.