diff options
| author | Matthew Newberg <mnewberg@gmail.com> | 2019-08-31 22:07:09 -0400 |
|---|---|---|
| committer | Matthew Newberg <mnewberg@gmail.com> | 2019-08-31 22:07:09 -0400 |
| commit | d87bfaf4800b3ed169831ba3ccdd4c52772cafe4 (patch) | |
| tree | 48377d55d3f9d73c7ee5b215f181c5c6920e62a4 /shared-bindings | |
| parent | b954b2f5df08a2674726fe70023adbe743280426 (diff) | |
Add random dithering to ColorConverter
Diffstat (limited to 'shared-bindings')
| -rw-r--r-- | shared-bindings/displayio/Display.c | 28 | ||||
| -rw-r--r-- | shared-bindings/displayio/Display.h | 3 |
2 files changed, 31 insertions, 0 deletions
diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 1eb1943b8..58d5e5123 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -346,6 +346,33 @@ const mp_obj_property_t displayio_display_auto_brightness_obj = { (mp_obj_t)&mp_const_none_obj}, }; +//| .. attribute:: dither +//| +//| True when the display is dithered +//| +STATIC mp_obj_t displayio_display_obj_get_dither(mp_obj_t self_in) { + displayio_display_obj_t *self = native_display(self_in); + return mp_obj_new_bool(common_hal_displayio_display_get_dither(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_dither_obj, displayio_display_obj_get_dither); + +STATIC mp_obj_t displayio_display_obj_set_dither(mp_obj_t self_in, mp_obj_t dither) { + displayio_display_obj_t *self = native_display(self_in); + + common_hal_displayio_display_set_dither(self, mp_obj_is_true(dither)); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_dither_obj, displayio_display_obj_set_dither); + +const mp_obj_property_t displayio_display_dither_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_display_get_dither_obj, + (mp_obj_t)&displayio_display_set_dither_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + + //| .. attribute:: width //| //| Gets the width of the board @@ -487,6 +514,7 @@ STATIC const mp_rom_map_elem_t displayio_display_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&displayio_display_brightness_obj) }, { MP_ROM_QSTR(MP_QSTR_auto_brightness), MP_ROM_PTR(&displayio_display_auto_brightness_obj) }, + { MP_ROM_QSTR(MP_QSTR_dither), MP_ROM_PTR(&displayio_display_dither_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_display_width_obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_display_height_obj) }, diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h index a3c77e4e8..ca2b2d476 100644 --- a/shared-bindings/displayio/Display.h +++ b/shared-bindings/displayio/Display.h @@ -62,6 +62,9 @@ uint16_t common_hal_displayio_display_get_rotation(displayio_display_obj_t* self bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* self); void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t* self, bool auto_brightness); +bool common_hal_displayio_display_get_dither(displayio_display_obj_t* self); +void common_hal_displayio_display_set_dither(displayio_display_obj_t* self, bool dither); + mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t* self); bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, mp_float_t brightness); |
