Module pixel
Pixel objects for screen watching
Tables
| colors | Basic colors |
Class Pixel
| Pixel:__init (x, y, color) | Create a Pixel object |
| Pixel:color_changed () | Returns a function that checks if the pixel's color has changed |
| Pixel:visible () | Check if the pixel is in a screen |
Class Pixels
| Pixels:__init (pixels) | Create a Pixels object |
| Pixels:visible () | Check if all the pixels are in a screen |
| Pixels:count () | Count how many of the pixels are in a screen |
| Pixels:any_colors_changed () | Returns a function that checks if any pixels have changed color |
| Pixels:all_colors_changed () | Returns a function that checks if all pixels have changed color |
| Pixels:n_colors_changed (n) | Returns a function that checks if n pixels have changed color |
Class Region
| Region:__init (positions, color) | Create a Region object |
Class Ellipse
| Ellipse:__init (options) | Create a Ellipse object |
Class Rectangle
| Rectangle:__init (options) | Create a Rectangle object |
Class Triangle
| Triangle:__init (options) | Create a Triangle object |
Tables
- colors
-
Basic colors
Fields:
- aqua 65535
- black 0
- blue 255
- fuchsia 16711935
- gray 8421504
- green 32768
- lime 65280
- maroon 8388608
- navy 128
- olive 8421376
- orange 16753920
- purple 8388736
- red 16711680
- silver 12632256
- teal 32896
- yellow 16776960
- white 16777215
Class Pixel
Pixel object
- Pixel:__init (x, y, color)
-
Create a Pixel object
Parameters:
- x int x-position of pixel
- y int y-position of pixel
- color int expected color of pixel (default colors.white)
See also:
- Pixel:color_changed ()
-
Returns a function that checks if the pixel's color has changed
Returns:
-
func
check whether the color has changed
- Pixel:visible ()
-
Check if the pixel is in a screen
Returns:
-
boolean
is the pixel visible on the screen
Class Pixels
Collection of Pixel objects
- Pixels:__init (pixels)
-
Create a Pixels object
Parameters:
- pixels objects.list iterable of Pixel objects
See also:
- Pixels:visible ()
-
Check if all the pixels are in a screen
Returns:
-
boolean
are all the pixels visible on the screen
- Pixels:count ()
-
Count how many of the pixels are in a screen
Returns:
-
number
how many pixels are visible on the screen
- Pixels:any_colors_changed ()
-
Returns a function that checks if any pixels have changed color
Returns:
-
func
check whether the colors have changed
- Pixels:all_colors_changed ()
-
Returns a function that checks if all pixels have changed color
Returns:
-
func
check whether the colors have changed
- Pixels:n_colors_changed (n)
-
Returns a function that checks if n pixels have changed color
Parameters:
- n
Returns:
-
func
check whether the colors have changed
Class Region
Group of evenly spaced pixels
- Region:__init (positions, color)
-
Create a Region object
Parameters:
- positions iterable of positions
- color int color of region
See also:
Class Ellipse
Ellipse Region
- Ellipse:__init (options)
-
Create a Ellipse object
Parameters:
- options table (x, y, width, height, spacing)
See also:
Class Rectangle
Rectangle Region
- Rectangle:__init (options)
-
Create a Rectangle object
Parameters:
- options table (x, y, width, height, spacing)
See also:
Class Triangle
Triangle Region
- Triangle:__init (options)
-
Create a Triangle object
Parameters:
- options table
See also: