2.1.28, initiation update to PXT v5.28.24 (#54)

This commit is contained in:
Amerlander
2019-12-02 05:58:26 +01:00
committed by Peli de Halleux
parent 38a964516e
commit 5c114a0c57
1261 changed files with 50692 additions and 21604 deletions

View File

@@ -1,51 +1,41 @@
# Pixel
The pixel function.
Get the state of a pixel in an [Image](/reference/images/image).
### JavaScript
## JavaScript
```sig
export function pixel(_this: micro_bit.Image, x: number, y: number) : boolean
let item: Image = null;
item.pixel(0, 0)
```
## Parameters
### Parameters
* 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)
* x - [Number](/reference/types/number); the *x coordinate* or horizontal position of a pixel in an [image](/reference/images/image)
* y - [Number](/reference/types/number); the *y coordinate* or vertical position of a pixel in an [image](/reference/images/image)
### x, y coordinates?
## x, y coordinates?
To figure out the ``x``, ``y`` coordinates, see [LED screen](/device/screen).
### Returns
## Returns
* [Boolean](/blocks/logic/boolean) - `true` for on and `false` for off
### Example
## Example
This example gets the state of pixel `0, 0` in the `img` variable:
### ~hide
```blocks
let img = images.createImage(`
. . # . . . . . . .
. # . # . . . # . .
. . # . . . . . . .
. # . # . . . # . .
. . # . . . . . . .
. # . # . . . # . .. . # . . . . . . .
`)
```
### ~
```typescript-ignore
let state = img.pixel(0, 0)
```
### See also
[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)
## See also
[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)