|
29 | 29 | #include <stdint.h>
|
30 | 30 |
|
31 | 31 | #include "py/runtime.h"
|
| 32 | +#include "py/objproperty.h" |
32 | 33 | #include "supervisor/shared/translate.h"
|
| 34 | +#include "shared-bindings/displayio/OnDiskBitmap.h" |
33 | 35 |
|
34 | 36 | //| .. currentmodule:: displayio
|
35 | 37 | //|
|
@@ -92,7 +94,49 @@ STATIC mp_obj_t displayio_ondiskbitmap_make_new(const mp_obj_type_t *type, size_
|
92 | 94 | return MP_OBJ_FROM_PTR(self);
|
93 | 95 | }
|
94 | 96 |
|
| 97 | +//| .. attribute:: width |
| 98 | +//| |
| 99 | +//| Width of the bitmap. (read only) |
| 100 | +//| |
| 101 | +STATIC mp_obj_t displayio_ondiskbitmap_obj_get_width(mp_obj_t self_in) { |
| 102 | + displayio_ondiskbitmap_t *self = MP_OBJ_TO_PTR(self_in); |
| 103 | + |
| 104 | + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_ondiskbitmap_get_width(self)); |
| 105 | +} |
| 106 | + |
| 107 | +MP_DEFINE_CONST_FUN_OBJ_1(displayio_ondiskbitmap_get_width_obj, displayio_ondiskbitmap_obj_get_width); |
| 108 | + |
| 109 | +const mp_obj_property_t displayio_ondiskbitmap_width_obj = { |
| 110 | + .base.type = &mp_type_property, |
| 111 | + .proxy = {(mp_obj_t)&displayio_ondiskbitmap_get_width_obj, |
| 112 | + (mp_obj_t)&mp_const_none_obj, |
| 113 | + (mp_obj_t)&mp_const_none_obj}, |
| 114 | + |
| 115 | +}; |
| 116 | + |
| 117 | +//| .. attribute:: height |
| 118 | +//| |
| 119 | +//| Height of the bitmap. (read only) |
| 120 | +//| |
| 121 | +STATIC mp_obj_t displayio_ondiskbitmap_obj_get_height(mp_obj_t self_in) { |
| 122 | + displayio_ondiskbitmap_t *self = MP_OBJ_TO_PTR(self_in); |
| 123 | + |
| 124 | + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_ondiskbitmap_get_height(self)); |
| 125 | +} |
| 126 | + |
| 127 | +MP_DEFINE_CONST_FUN_OBJ_1(displayio_ondiskbitmap_get_height_obj, displayio_ondiskbitmap_obj_get_height); |
| 128 | + |
| 129 | +const mp_obj_property_t displayio_ondiskbitmap_height_obj = { |
| 130 | + .base.type = &mp_type_property, |
| 131 | + .proxy = {(mp_obj_t)&displayio_ondiskbitmap_get_height_obj, |
| 132 | + (mp_obj_t)&mp_const_none_obj, |
| 133 | + (mp_obj_t)&mp_const_none_obj}, |
| 134 | + |
| 135 | +}; |
| 136 | + |
95 | 137 | STATIC const mp_rom_map_elem_t displayio_ondiskbitmap_locals_dict_table[] = {
|
| 138 | + { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_ondiskbitmap_height_obj) }, |
| 139 | + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_ondiskbitmap_width_obj) }, |
96 | 140 | };
|
97 | 141 | STATIC MP_DEFINE_CONST_DICT(displayio_ondiskbitmap_locals_dict, displayio_ondiskbitmap_locals_dict_table);
|
98 | 142 |
|
|
0 commit comments