Skip to content

FILL ​

Sets the style for filling in shapes.

Syntax ​

leo-grammar
FILL [ style:FillStyle ] [ color:ColorSpec ] [ transparent | fcolor:ColorSpec ] .

FillStyle : solid | horz | vert | cross | diagcross | updiag | downdiag | null .

Parameters ​

  • style (PenStyle, optional) - What style of brush to use for filling in shapes. The default is solid.
  • color (ColorSpec, optional) - The main color used for filling in shapes. The default is "black".
  • transparent (modifier, optional) - Secondary color for hatched patterns is set to be transparent. By default this is not specified.
  • fcolor (ColorSpec, optional) - The secondary color used for hatched patterns. The default is "black".

Details ​

This command sets the brush style and color for filling an area of shapes drawn after it. It applies for example to the commands RECTANGLE, POLYGON, ELLIPSE, COMPOUND, DRAW_PATH and other similar commands.

The following filling patterns are available for style:

  • solid: Solid surface (default setting).
  • horz: Horizontally hatched surface.
  • vert: Vertically hatched surface.
  • cross: Horizontally and vertically hatched surface.
  • diagcross: Diagonally upward and diagonally downward hatched surface.
  • updiag: Diagonally upward hatched surface.
  • downdiag: Diagonally downward hatched surface.
  • null: Invisible (i.e. no) filling.

The main color is specified with color, which is used for solid filling and for all hatched patterns for the hatching lines. Through fcolor a secondary color can be specified for hatched patterns, which fills in the spaces between the lines. Alternatively use transparent instead of fcolor to not fill the space between lines of a hatched pattern, allowing objects in the back to shine through.

Colors are specified through a ColorSpec, which has to evaluate to a strValue or an intValue (see LEO Colors for details).

The filling color can also be set arbitrarily depending on an instance attribute. For example the color can be entered by the user as an RGB value or color name through the Notebook (see Notebook and ATTR documentation for details). The value from there can then be retrieved using the AVAL command and passed as the color to the FILL command. There is also an example available.

Caution

The default setting FILL style:null (transparent) applies until the FILL command is used in a GraphRep.

To fill an area with a color gradient use the commands GRADIENT_RECT and GRADIENT_TRI instead.

The style of the FILL command is not fully supported in SVG Graphics. While style:solid and style:null are displayed correctly, all other styles are replaced with solid.

See Also ​

Examples ​

Draw a small green square with an orange border.
A small green square with orange border

leo
GRAPHREP
SHADOW off

PEN color:"orange" w:2pt
FILL color:"green"
RECTANGLE w:1cm h:1cm

A yellow filled area with blue hatching in an upward direction. Using the default PEN style.
A small green square with orange border

leo
GRAPHREP
SHADOW off

FILL style:updiag color:"blue" fcolor:"yellow"
# Alternative ways to specify the same colors:
# FILL style:updiag color:(rgbval(0,0,255)) fcolor:(rgbval(255,255,0))
# FILL style:updiag color:"$0000ff" fcolor:"$ffff00"
RECTANGLE w:2cm h:1cm

Example for loading color values from instance attributes and using them as a pen and a fill color. The attributes "Pen color" and "Fill color" are of type short string and displayed in the Notebook via dialog:color.
Three rectangles with different line and fill colors

leo
GRAPHREP
SHADOW off

AVAL sPenColor:"Pen color"
AVAL sFillColor:"Fill color"
PEN w:2pt color:(sPenColor)
FILL color:(sFillColor)
RECTANGLE w:2cm h:1cm

Versions and Changes ​

Available since ADOxx 1.3

ADOxx 1.8.0

  • The values mix25, mix50 and mix75 no longer work as a style.