CharacterImage
CharacterImage(character_width, character_height, filename=None, image=None, width=None, height=None, palette=None, additional_palette=None, pixel_size=None)
Access characters from an image.
| PARAMETER | DESCRIPTION |
|---|---|
character_width
|
width of a character in pixels
TYPE:
|
character_height
|
height of a character in pixels
TYPE:
|
filename
|
filename of image to load
TYPE:
|
image
|
image to use
TYPE:
|
width
|
width of image in characters
TYPE:
|
height
|
height of image in characters
TYPE:
|
palette
|
Palette to use
TYPE:
|
additional_palette
|
additional colors to add to palette
TYPE:
|
pixel_size
|
size of logical pixels
TYPE:
|
get(index)
Get character at given index.
| PARAMETER | DESCRIPTION |
|---|---|
index
|
index of character to get
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bytes | None
|
bytes of character, or None if character is a hole |
get_xy(x, y)
Get character at given coordinates.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
x coordinate of character to get
TYPE:
|
y
|
y coordinate of character to get
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bytes | None
|
bytes of character, or None if character is a hole |
set(index, value)
Set character at given index.
| PARAMETER | DESCRIPTION |
|---|---|
index
|
index of character to set
TYPE:
|
value
|
bytes of character
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
if index is out of bounds or value has invalid size |
set_xy(x, y, value)
Set character at given coordinates.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
x coordinate of character to set
TYPE:
|
y
|
y coordinate of character to set
TYPE:
|
value
|
bytes of character
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
if coordinates are out of bounds or value has invalid size |