Lingo Dictionary > S > setPixel() |  |

setPixel()

Syntax

    imageObject.setPixel(x, y, colorObject)
    imageObject.setPixel(point(x, y), colorObject)
    imageObject.setPixel(x, y, integerValue)
    imageObject.setPixel(point(x, y), integerValue)

Description

Function; sets the color value of the pixel at the specified point in the given image object, to either `colorObject` or to a raw integer with `integerValue`. If you are setting many pixels to the color of another pixel with `getPixel()`, it is faster to set them as raw integers.

For best performance with color objects, with 8-bit or lower images use an indexed color object, and with 16-bit or higher images, use an RGB color object.

The `setPixel()` function returns `FALSE` if the specified pixel falls outside the specified image.

To see an example of `setPixel()` used in a completed movie, see the Imaging movie in the Learning\Lingo Examples folder inside the Director application folder.

Example

This Lingo statement draws a horizontal black line 50 pixels from left to right in cast member 5.

    repeat with x = 1 to 50
    	member(5).image.setPixel(x, 0, rgb(0, 0, 0))
    end repeat

See also

`getPixel()`, `draw()`, `fill()`, `color()`