diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index c678a76703..17a4b4c87f 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -116,6 +116,21 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_bitmap_get_height_obj, displayio_bitmap_obj_ MP_PROPERTY_GETTER(displayio_bitmap_height_obj, (mp_obj_t)&displayio_bitmap_get_height_obj); +//| bits_per_value: int +//| """Bits per Pixel of the bitmap. (read only)""" +STATIC mp_obj_t displayio_bitmap_obj_get_bits_per_value(mp_obj_t self_in) { + displayio_bitmap_t *self = MP_OBJ_TO_PTR(self_in); + + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_bitmap_get_bits_per_value(self)); +} + +MP_DEFINE_CONST_FUN_OBJ_1(displayio_bitmap_get_bits_per_value_obj, displayio_bitmap_obj_get_bits_per_value); + +MP_PROPERTY_GETTER(displayio_bitmap_bits_per_value_obj, + (mp_obj_t)&displayio_bitmap_get_bits_per_value_obj); + + //| def __getitem__(self, index: Union[Tuple[int, int], int]) -> int: //| """Returns the value at the given index. The index can either be an x,y tuple or an int equal //| to ``y * width + x``. @@ -260,6 +275,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_bitmap_deinit_obj, displayio_bitmap_obj_dein STATIC const mp_rom_map_elem_t displayio_bitmap_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_bitmap_height_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_bitmap_width_obj) }, + { MP_ROM_QSTR(MP_QSTR_bits_per_value), MP_ROM_PTR(&displayio_bitmap_bits_per_value_obj) }, { MP_ROM_QSTR(MP_QSTR_fill), MP_ROM_PTR(&displayio_bitmap_fill_obj) }, { MP_ROM_QSTR(MP_QSTR_dirty), MP_ROM_PTR(&displayio_bitmap_dirty_obj) }, { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&displayio_bitmap_deinit_obj) },