2016-03-26 00:47:20 +01:00
|
|
|
# Pixel
|
|
|
|
|
2016-04-16 00:02:26 +02:00
|
|
|
Get the state of a pixel in an [Image](/reference/images/image).
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
|
|
|
|
## JavaScript
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-08-09 17:52:24 +02:00
|
|
|
```sig
|
2019-12-02 05:58:26 +01:00
|
|
|
let item: Image = null;
|
|
|
|
item.pixel(0, 0)
|
2016-03-26 00:47:20 +01:00
|
|
|
```
|
2019-12-02 05:58:26 +01:00
|
|
|
## Parameters
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
* x - [Number](/types/number); the *x coordinate* or horizontal position of a pixel in an [image](/reference/images/image)
|
|
|
|
* y - [Number](/types/number); the *y coordinate* or vertical position of a pixel in an [image](/reference/images/image)
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## x, y coordinates?
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-04-13 17:27:45 +02:00
|
|
|
To figure out the ``x``, ``y`` coordinates, see [LED screen](/device/screen).
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## Returns
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-06-15 13:55:19 +02:00
|
|
|
* [Boolean](/blocks/logic/boolean) - `true` for on and `false` for off
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## Example
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
This example gets the state of pixel `0, 0` in the `img` variable:
|
|
|
|
|
2016-08-09 17:52:24 +02:00
|
|
|
```blocks
|
2016-03-26 00:47:20 +01:00
|
|
|
let img = images.createImage(`
|
|
|
|
. . # . . . . . . .
|
|
|
|
. # . # . . . # . .
|
|
|
|
. . # . . . . . . .
|
2019-12-02 05:58:26 +01:00
|
|
|
. # . # . . . # . .. . # . . . . . . .
|
2016-03-26 00:47:20 +01:00
|
|
|
`)
|
|
|
|
let state = img.pixel(0, 0)
|
|
|
|
```
|
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## See also
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
[set pixel](/reference/images/set-pixel), [show image](/reference/images/show-image), [image](/reference/images/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image)
|