displayio: Add in opaque pixel option for future

This commit is contained in:
Jensen 2020-10-16 19:48:41 -05:00
parent b02a5bcbd5
commit 74c07a4bdc
4 changed files with 10 additions and 10 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-10-14 22:22-0500\n"
"POT-Creation-Date: 2020-10-16 19:50-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -3408,10 +3408,6 @@ msgstr ""
msgid "too many values to unpack (expected %d)"
msgstr ""
#: shared-bindings/displayio/ColorConverter.c
msgid "transparent_color should be an int"
msgstr ""
#: extmod/ulab/code/approx/approx.c
msgid "trapz is defined for 1D arrays of equal length"
msgstr ""

View File

@ -125,12 +125,14 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_make_transparent_obj, display
//| def make_opaque(self) -> None:
//| """Sets a pixel to opaque."""
//|
STATIC mp_obj_t displayio_colorconverter_make_opaque(mp_obj_t self_in) {
STATIC mp_obj_t displayio_colorconverter_make_opaque(mp_obj_t self_in, mp_obj_t transparent_color_obj) {
displayio_colorconverter_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_displayio_colorconverter_make_opaque(self);
mp_int_t transparent_color = mp_obj_get_int(&transparent_color);
common_hal_displayio_colorconverter_make_opaque(self, transparent_color);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_1(displayio_colorconverter_make_opaque_obj, displayio_colorconverter_make_opaque);
MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_make_opaque_obj, displayio_colorconverter_make_opaque);
STATIC const mp_rom_map_elem_t displayio_colorconverter_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_convert), MP_ROM_PTR(&displayio_colorconverter_convert_obj) },

View File

@ -40,6 +40,6 @@ void common_hal_displayio_colorconverter_set_dither(displayio_colorconverter_t*
bool common_hal_displayio_colorconverter_get_dither(displayio_colorconverter_t* self);
void common_hal_displayio_colorconverter_make_transparent(displayio_colorconverter_t* self, uint32_t transparent_color);
void common_hal_displayio_colorconverter_make_opaque(displayio_colorconverter_t* self);
void common_hal_displayio_colorconverter_make_opaque(displayio_colorconverter_t* self, uint32_t transparent_color);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_COLORCONVERTER_H

View File

@ -136,7 +136,9 @@ void common_hal_displayio_colorconverter_make_transparent(displayio_colorconvert
self->transparent_color = transparent_color;
}
void common_hal_displayio_colorconverter_make_opaque(displayio_colorconverter_t* self) {
void common_hal_displayio_colorconverter_make_opaque(displayio_colorconverter_t* self, uint32_t transparent_color) {
(void) transparent_color;
// 0x1000000 will never equal a valid color
self->transparent_color = 0x1000000;
}