Lingo Dictionary > D-F > draw()

 

draw()

Syntax

imageObject.draw(x1, y1, x2, y2, colorObjectOrParameterList)
imageObject.draw(point(x, y), point(x, y), colorObjectOrParameterList)
imageObject.draw(rect, colorObjectOrParameterList)

Description

This function draws a line or an unfilled shape of color colorObject in a rectangular region of the given image object, as specified in any of the three ways shown. The draw returns a value of 1 if there is no error. You can use the optional property list ParameterList function to specify the following shape 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 color of the shape border.


If you do not provide a parameter list, this function draws a 1-pixel line between the first and second points given or between the upper left and lower right corners of the given rectangle.

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.

If you want to fill a solid region, use the fill() function.

Example

This statement draws a 1-pixel, dark red, diagonal line from point (0, 0) to point (128, 86) within the image of member Happy.

member("Happy").image.draw(0, 0, 128, 86, rgb(150,0,0))

Example

This statement draws a dark red, 3-pixel unfilled oval within the image of member Happy. The oval is drawn within the rectangle (0, 0, 128, 86).

member("Happy").image.draw(0, 0, 128, 86, [#shapeType:#oval, #lineSize:3, \
#color: rgb(150, 0, 0)])

See also

color(), copyPixels(), fill(), setPixel()