Pixel

The pixel function.

Get the state of a pixel in an Image.

JavaScript

export function pixel(_this: micro_bit.Image, x: number, y: number) : boolean

Parameters

x, y coordinates?

To figure out the x, y coordinates, see LED screen.

Returns

Example

This example gets the state of pixel 0, 0 in the img variable:

let img = images.createImage(`
. . # . . . . . . .
. # . # . . . # . .
. . # . . . . . . .
. # . # . . . # . .
. . # . . . . . . .
`)
let state = img.pixel(0, 0)

See also

set pixel, show image, image, create image, scroll image

Edit this page on GitHub