restoring some docs (#1533)

This commit is contained in:
Peli de Halleux
2018-10-26 00:10:41 -07:00
committed by GitHub
parent 1d9441bc9e
commit 6293e8f342
5 changed files with 174 additions and 3 deletions

View File

@ -28,4 +28,5 @@ images.arrowNumber(ArrowNames.North)
[createImage](/reference/images/create-image), [createBigImage](/reference/images/create-big-image),
[showImage](/reference/images/show-image), [scrollImage](/reference/images/scroll-image),
[arrowImage](/reference/images/arrow-image), [iconImage](/reference/images/icon-image), [arrowNumber](/reference/images/arrow-number)
[arrowImage](/reference/images/arrow-image), [iconImage](/reference/images/icon-image), [arrowNumber](/reference/images/arrow-number),
[pixel](/reference/images/pixel), [set-pixel](/reference/images/set-pixel)

View File

@ -1 +1,41 @@
TODO: Fix for microbit master
# Pixel
Get the state of a pixel in an [Image](/reference/images/image).
## JavaScript
```sig
let item: Image = null;
item.pixel(0, 0)
```
## 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, y coordinates?
To figure out the ``x``, ``y`` coordinates, see [LED screen](/device/screen).
## Returns
* [Boolean](/blocks/logic/boolean) - `true` for on and `false` for off
## Example
This example gets the state of pixel `0, 0` in the `img` variable:
```blocks
let img = images.createImage(`
. . # . . . . . . .
. # . # . . . # . .
. . # . . . . . . .
. # . # . . . # . .. . # . . . . . . .
`)
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)

View File

@ -1 +1,39 @@
TODO: Fix for microbit master
# Set Pixel
Set the on/off state of pixel in an [Image](/reference/images/image).
## JavaScript
```sig
let item: Image = null;
item.setPixel(0, 0, true)
```
## 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)
* value -[Boolean](/blocks/logic/boolean); the on/off state of a pixel; `true` for on, `false` for off
## x, y coordinates?
To figure out the ``x``, ``y`` coordinates, see [LED screen](/device/screen).
## Example
The following example creates an image and stores it in the `img` variable. The `set pixel` function sets the center pixel off, before `img` is shown using `show image`.
```blocks
let img = images.createImage(`
. . # . .
. # . # .
. . # . .
. # . # .
. . # . .
`)
img.setPixel(2, 2, false)
img.showImage(0)
```
## See also
[pixel](/reference/images/pixel), [show image](/reference/images/show-image), [image](/reference/images/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image)