summaryrefslogtreecommitdiff
path: root/shared-bindings/displayio
diff options
context:
space:
mode:
authorJensen <jensechu@gmail.com>2020-10-08 21:40:55 -0500
committerJensen <jensechu@gmail.com>2020-10-12 20:48:04 -0500
commit57b44928a38b5a2328e0fd4fe8f2baee11062229 (patch)
treef759d98e8df106b61f49788660b44c65229ee742 /shared-bindings/displayio
parentb578afa02f7d813684fb6488aed029c65e929e92 (diff)
displayio: Pass transparent_color to ColorConverter
Signed-off-by: Jensen <jensechu@gmail.com>
Diffstat (limited to 'shared-bindings/displayio')
-rw-r--r--shared-bindings/displayio/ColorConverter.c5
-rw-r--r--shared-bindings/displayio/ColorConverter.h2
2 files changed, 5 insertions, 2 deletions
diff --git a/shared-bindings/displayio/ColorConverter.c b/shared-bindings/displayio/ColorConverter.c
index a2b6699ef..d2cbcfc73 100644
--- a/shared-bindings/displayio/ColorConverter.c
+++ b/shared-bindings/displayio/ColorConverter.c
@@ -43,6 +43,7 @@
//| """Create a ColorConverter object to convert color formats. Only supports RGB888 to RGB565
//| currently.
//| :param bool dither: Adds random noise to dither the output image"""
+//| :param bool transparent_color: Sets one color in the colorset to transparent"""
//| ...
//|
@@ -50,9 +51,11 @@
//|
STATIC mp_obj_t displayio_colorconverter_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_dither};
+ enum { ARG_transparent_color };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_dither, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
+ { MP_QSTR_transparent_color, MP_ARG_KW_ONLY | MP_ARG_INT, {.uint32_t = 0} },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
@@ -60,7 +63,7 @@ STATIC mp_obj_t displayio_colorconverter_make_new(const mp_obj_type_t *type, siz
displayio_colorconverter_t *self = m_new_obj(displayio_colorconverter_t);
self->base.type = &displayio_colorconverter_type;
- common_hal_displayio_colorconverter_construct(self, args[ARG_dither].u_bool);
+ common_hal_displayio_colorconverter_construct(self, args[ARG_dither].u_bool, args[ARG_transparent_color].uint32_t);
return MP_OBJ_FROM_PTR(self);
}
diff --git a/shared-bindings/displayio/ColorConverter.h b/shared-bindings/displayio/ColorConverter.h
index d550d81be..146ad80bd 100644
--- a/shared-bindings/displayio/ColorConverter.h
+++ b/shared-bindings/displayio/ColorConverter.h
@@ -33,7 +33,7 @@
extern const mp_obj_type_t displayio_colorconverter_type;
-void common_hal_displayio_colorconverter_construct(displayio_colorconverter_t* self, bool dither);
+void common_hal_displayio_colorconverter_construct(displayio_colorconverter_t* self, bool dither, uint32_t transparent_color);
void common_hal_displayio_colorconverter_convert(displayio_colorconverter_t *colorconverter, const _displayio_colorspace_t* colorspace, uint32_t input_color, uint32_t* output_color);
void common_hal_displayio_colorconverter_set_dither(displayio_colorconverter_t* self, bool dither);