fill()

Usage

-- Lingo syntax
imageObjRef.fill(left, top, right, bottom, colorObjOrParamList)
imageObjRef.fill(point(x, y), point(x, y), colorObjOrParamList)
imageObjRef.fill(rect, colorObjOrParamList)

// JavaScript syntax
imageObjRef.fill(left, top, right, bottom, colorObjOrParamList);
imageObjRef.fill(point(x, y), point(x, y), colorObjOrParamList);
imageObjRef.fill(rect, colorObjOrParamList);

Description

Image method. Fills a rectangular region with a specified color in a given image object.

This method returns a value of 1 if there is no error, zero if there is an error.

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

Parameters

left Required if filling a region specified by coordinates. An integer that specifies the left side of the region to fill.

top Required if filling a region specified by coordinates. An integer that specifies the top side of the region to fill.

right Required if filling a region specified by coordinates. An integer that specifies the right side of the region to fill.

bottom Required if filling a region specified by coordinates. An integer that specifies the bottom side of the region to fill.

colorObjOrParamList Required. A color object or parameter list that specifies the color used to fill the region. The parameter list can be used instead of a simple color object to specify the following properties.

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 region.

#bgColor

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

point(x, y), point(x, y) Required if filling a region using points. Two points that specify the upper-left and lower-right corners of region to fill, relative to the upper-left corner of the given image object.

rect Required if filling a region using a rectangle. A rectangle that specifies the rectangular region to fill.

Example

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

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

See also

color(), draw(), image()