ConsoleUser
Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com
This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.
All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.
- class NumpyRegion.NumpyRegion(config, path)¶
This is a concrete sublcass of Region which uses Numpy Arrays as the internal representation of the screen region.
Parameters:
config: a UserConfig object
path: the path to the image file to load or None for an empty Image
- count_color(color)¶
Parameters:
color: the color to count
Return: the number of times that color appeared in this region
- debugprint(rect=(), verbose=False)¶
Print a text version of the region to stdout. sys.stdout.write is used instead of print in order to have finer control of the formatting.
- from_array(array)¶
Define this Region as coming from the given array.
Parameters:
array: the array defining this image
- get_as_png()¶
Create a PIL Image from this data buffer Return: A PIL Image object
- get_row(ind)¶
Parameters:
ind: the row index (with row 0 being the top row, counting down from there)
Return: an entire row of pixes as a Sequence
- get_size()¶
Return: a tuple containing the height and width of this region
- get_value_at(x, y)¶
Return the value (usually the color) of the pixel at the given coordinates.
Parameters:
x: the column to check
y: the row to check
Return: the value of the given pixel/location
- is_black(x, y)¶
Parameters:
x: the column to check
y: the row to check
Return: True if the pixel at the given row and column is black
- is_white(x, y)¶
Parameters:
x: the column to check
y: the row to check
Return: True if the pixel at the given row and column is white
- save_as_png(path)¶
Save this Image to the given path (overwriting an existing file if there is one) as a PNG file.
Parameters:
path: the location of the file to create
Return: True if successful, False otherwise