Bitmap – Stores values in a 2D array

Stores values of a certain size in a 2D array

class displayio.Bitmap(width, height, value_count)

Create a Bitmap object with the given fixed size. Each pixel stores a value that is used to index into a corresponding palette. This enables differently colored sprites to share the underlying Bitmap. value_count is used to minimize the memory used to store the Bitmap.

Parameters:
  • width (int) – The number of values wide
  • height (int) – The number of values high
  • value_count (int) – The number of possible pixel values.
width

Width of the bitmap. (read only)

height

Height of the bitmap. (read only)

__getitem__(index)

Returns the value at the given index. The index can either be an x,y tuple or an int equal to y * width + x.

This allows you to:

print(bitmap[0,1])
__setitem__(index, value)

Sets the value at the given index. The index can either be an x,y tuple or an int equal to y * width + x.

This allows you to:

bitmap[0,1] = 3