Lingo Dictionary > D-F > fill()

 

fill()

Syntax

imageObject.fill(left, top, right, bottom, colorObjectOrParameterList)
imageObject.fill(point(x, y), point(x, y), colorObjectOrParameterList)
imageObject.fill(rect, colorObjectOrParameterList)

Description

This function fills a rectangular region with the color colorObject in the given image object. You specify the rectangle in any of the three ways shown. The points specified are relative to the upper-left corner of the given image object. The return value is 1 if there is no error, zero if there is an error.

If you provide a parameterList instead of a simple colorObject, the rectangle is filled with a shape you specify with these parameters:

Property

Description

#shapeType

A symbol value of #oval, #rect, #roundRect, or #line. The default is #line.

#lineSize

The width of the line to use in drawing the shape.

#color

A color object, which determines the fill color of the shape.

#bgColor

A color object, which determines the color of the shape's border.


For best performance, with 8-bit or lower images the colorObject should contain an indexed color value. For 16- or 32-bit images, use an RGB color value.

Example

This statement renders the image object in the variable myImage completely black:

myImage.fill(myImage.rect, rgb(0, 0, 0))

Example

This statement draws a filled oval in the image object TestImage. The oval has a green fill and a 5-pixel-wide red border.

TestImage.fill(0, 0, 100, 100, [#shapeType: #oval, #lineSize: 5, #color: rgb(0, 255, 0), \
#bgColor: rgb(255, 0, 0)])

See also

color(), draw()