added Mapping to bits_per_value getter

This commit is contained in:
Gaweng Tan 2023-07-22 13:26:34 +02:00
parent 823e505572
commit e58496feb2
1 changed files with 16 additions and 0 deletions

View File

@ -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_PROPERTY_GETTER(displayio_bitmap_height_obj,
(mp_obj_t)&displayio_bitmap_get_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: //| 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 //| """Returns the value at the given index. The index can either be an x,y tuple or an int equal
//| to ``y * width + x``. //| 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[] = { 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_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_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_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_dirty), MP_ROM_PTR(&displayio_bitmap_dirty_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&displayio_bitmap_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&displayio_bitmap_deinit_obj) },