Skip to content

displayio: added Mapping to bits_per_value getter #8191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions shared-bindings/displayio/Bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
Expand Down Expand Up @@ -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) },
Expand Down