Skip to content

ROUNDRECT ​

Draws a rectangle with rounded corners.

Syntax ​

leo-grammar
ROUNDRECT [ x:measureValue ] [ y:measureValue ] [ w:measureValue ] [ h:measureValue ] [ rx:measureValue ] [ ry:measureValue ] .

Parameters ​

  • x (measureValue, optional) - The x-coordinate of the top-left corner of the rectangle. The default is 0cm.
  • y (measureValue, optional) - The y-coordinate of the top-left corner of the rectangle. The default is 0cm.
  • w (measureValue, optional) - The width of the rectangle. The default is 0cm.
  • h (measureValue, optional) - The height of the rectangle. The default is 0cm.
  • rx (measureValue, optional) - The elliptical x-radius for the corners. The default is 0cm.
  • ry (measureValue, optional) - The elliptical y-radius for the corners. The default is 0cm.

Details ​

The style of this command is defined by the PEN command for the outline and the FILL command to fill the shape.

The left and the right side of the rectangle are always parallel to the y-axis, the other two sides thus parallel to the x-axis. The rounding of the corners is specified through the rx and ry parameters.

Rotation of a rounded rectangle is not possible. This has an influence on the drawing of relations where a rounded rectangle's shape will change with different rotations. If a rotation of the rounded rectangle is necessary then use a ROUNDEDPOLYGON instead.

This command extends upon RECTANGLE by drawing all corners of the shape rounded.

See Also ​

Examples ​

Draw a 3cm wide and 2cm tall rectangle centered on the middle position (0cm, 0cm) with slightly rounded corners.
A simple rounded rectangle

leo
GRAPHREP
SHADOW off

ROUNDRECT x:-1.5cm y:-1cm w:3cm h:2cm rx:0.2cm ry:0.2cm

Draw a small orange square with a green border and rounded corners heavily on the x-axis.
A small green square with orange border

leo
GRAPHREP
SHADOW off

PEN color:"green" w:2pt
FILL color:"orange"
ROUNDRECT w:1cm h:1cm rx:0.4cm ry:0.2cm

Draw a green rectangular shape with half circles on the left and right side.
A rectangular shape with half circles on the left and right side

leo
GRAPHREP
SHADOW off

PEN style:null
FILL color:"forestgreen"
ROUNDRECT x:-1cm w:2cm h:0.8cm rx:0.4cm ry:0.4cm

Versions and Changes ​

Available since ADOxx 1.3