summaryrefslogtreecommitdiff
path: root/shared-bindings/displayio
diff options
context:
space:
mode:
Diffstat (limited to 'shared-bindings/displayio')
-rw-r--r--shared-bindings/displayio/ColorConverter.c90
-rw-r--r--shared-bindings/displayio/ColorConverter.h37
-rw-r--r--shared-bindings/displayio/Group.c11
-rw-r--r--shared-bindings/displayio/Group.h1
-rw-r--r--shared-bindings/displayio/OnDiskBitmap.c104
-rw-r--r--shared-bindings/displayio/OnDiskBitmap.h40
-rw-r--r--shared-bindings/displayio/Sprite.c51
-rw-r--r--shared-bindings/displayio/Sprite.h6
-rw-r--r--shared-bindings/displayio/__init__.c6
9 files changed, 322 insertions, 24 deletions
diff --git a/shared-bindings/displayio/ColorConverter.c b/shared-bindings/displayio/ColorConverter.c
new file mode 100644
index 000000000..670578888
--- /dev/null
+++ b/shared-bindings/displayio/ColorConverter.c
@@ -0,0 +1,90 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "shared-bindings/displayio/ColorConverter.h"
+
+#include <stdint.h>
+
+#include "lib/utils/context_manager_helpers.h"
+#include "py/binary.h"
+#include "py/objproperty.h"
+#include "py/runtime.h"
+#include "shared-bindings/microcontroller/Pin.h"
+#include "shared-bindings/util.h"
+#include "supervisor/shared/translate.h"
+
+//| .. currentmodule:: displayio
+//|
+//| :class:`ColorConverter` -- Converts one color format to another
+//| =========================================================================================
+//|
+//| Converts one color format to another.
+//|
+//| .. warning:: This will be changed before 4.0.0. Consider it very experimental.
+//|
+//| .. class:: ColorConverter()
+//|
+//| Create a ColorConverter object to convert color formats. Only supports RGB888 to RGB565
+//| currently.
+//|
+// TODO(tannewt): Add support for other color formats.
+//|
+STATIC mp_obj_t displayio_colorconverter_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) {
+ mp_arg_check_num(n_args, n_kw, 0, 0, true);
+
+ displayio_colorconverter_t *self = m_new_obj(displayio_colorconverter_t);
+ self->base.type = &displayio_colorconverter_type;
+ common_hal_displayio_colorconverter_construct(self);
+
+ return MP_OBJ_FROM_PTR(self);
+}
+
+//| .. method:: convert(color)
+//|
+STATIC mp_obj_t displayio_colorconverter_obj_convert(mp_obj_t self_in, mp_obj_t color_obj) {
+ displayio_colorconverter_t *self = MP_OBJ_TO_PTR(self_in);
+
+ mp_int_t color;
+ if (!mp_obj_get_int_maybe(color_obj, &color)) {
+ mp_raise_ValueError(translate("color should be an int"));
+ }
+ uint16_t output_color;
+ common_hal_displayio_colorconverter_convert(self, color, &output_color);
+ return MP_OBJ_NEW_SMALL_INT(output_color);
+}
+MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_convert_obj, displayio_colorconverter_obj_convert);
+
+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) },
+};
+STATIC MP_DEFINE_CONST_DICT(displayio_colorconverter_locals_dict, displayio_colorconverter_locals_dict_table);
+
+const mp_obj_type_t displayio_colorconverter_type = {
+ { &mp_type_type },
+ .name = MP_QSTR_ColorConverter,
+ .make_new = displayio_colorconverter_make_new,
+ .locals_dict = (mp_obj_dict_t*)&displayio_colorconverter_locals_dict,
+};
diff --git a/shared-bindings/displayio/ColorConverter.h b/shared-bindings/displayio/ColorConverter.h
new file mode 100644
index 000000000..71be7f543
--- /dev/null
+++ b/shared-bindings/displayio/ColorConverter.h
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_COLORCONVERTER_H
+#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_COLORCONVERTER_H
+
+#include "shared-module/displayio/ColorConverter.h"
+
+extern const mp_obj_type_t displayio_colorconverter_type;
+
+void common_hal_displayio_colorconverter_construct(displayio_colorconverter_t* self);
+bool common_hal_displayio_colorconverter_convert(displayio_colorconverter_t *colorconverter, uint32_t input_color, uint16_t* output_color);
+
+#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_COLORCONVERTER_H
diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c
index e6f1fbbf5..98257673b 100644
--- a/shared-bindings/displayio/Group.c
+++ b/shared-bindings/displayio/Group.c
@@ -83,8 +83,19 @@ STATIC mp_obj_t displayio_group_obj_append(mp_obj_t self_in, mp_obj_t layer) {
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_append_obj, displayio_group_obj_append);
+//| .. method:: pop()
+//|
+//| Remove the last item and return it.
+//|
+STATIC mp_obj_t displayio_group_obj_pop(mp_obj_t self_in) {
+ displayio_group_t *self = MP_OBJ_TO_PTR(self_in);
+ return common_hal_displayio_group_pop(self);
+}
+MP_DEFINE_CONST_FUN_OBJ_1(displayio_group_pop_obj, displayio_group_obj_pop);
+
STATIC const mp_rom_map_elem_t displayio_group_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_append), MP_ROM_PTR(&displayio_group_append_obj) },
+ { MP_ROM_QSTR(MP_QSTR_pop), MP_ROM_PTR(&displayio_group_pop_obj) },
};
STATIC MP_DEFINE_CONST_DICT(displayio_group_locals_dict, displayio_group_locals_dict_table);
diff --git a/shared-bindings/displayio/Group.h b/shared-bindings/displayio/Group.h
index aeb5a7b54..a85098e6d 100644
--- a/shared-bindings/displayio/Group.h
+++ b/shared-bindings/displayio/Group.h
@@ -34,5 +34,6 @@ extern const mp_obj_type_t displayio_group_type;
void common_hal_displayio_group_construct(displayio_group_t* self, uint32_t max_size);
void common_hal_displayio_group_append(displayio_group_t* self, mp_obj_t layer);
+mp_obj_t common_hal_displayio_group_pop(displayio_group_t* self);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_GROUP_H
diff --git a/shared-bindings/displayio/OnDiskBitmap.c b/shared-bindings/displayio/OnDiskBitmap.c
new file mode 100644
index 000000000..d3d413da1
--- /dev/null
+++ b/shared-bindings/displayio/OnDiskBitmap.c
@@ -0,0 +1,104 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "shared-bindings/displayio/OnDiskBitmap.h"
+
+#include <stdint.h>
+
+#include "py/runtime.h"
+#include "supervisor/shared/translate.h"
+
+//| .. currentmodule:: displayio
+//|
+//| :class:`OnDiskBitmap` -- Loads pixels straight from disk
+//| ==========================================================================
+//|
+//| Loads values straight from disk. This minimizes memory use but can lead to
+//| much slower pixel load times. These load times may result in frame tearing where only part of
+//| the image is visible.
+//|
+//| .. warning:: This will likely be changed before 4.0.0. Consider it very experimental.
+//|
+//| It's easiest to use on a board with a built in display such as the `Hallowing M0 Express
+//| <https://www.adafruit.com/product/3900>`_.
+//|
+//| .. code-block:: Python
+//|
+//| import board
+//| import displayio
+//| import time
+//| import pulseio
+//|
+//| backlight = pulseio.PWMOut(board.TFT_BACKLIGHT)
+//| splash = displayio.Group()
+//| board.DISPLAY.show(splash)
+//|
+//| with open("/sample.bmp", "rb") as f:
+//| odb = displayio.OnDiskBitmap(f)
+//| face = displayio.Sprite(odb, pixel_shader=displayio.ColorConverter(), position=(0,0))
+//| splash.append(face)
+//| # Wait for the image to load.
+//| board.DISPLAY.wait_for_frame()
+//|
+//| # Fade up the backlight
+//| for i in range(100):
+//| backlight.duty_cycle = i * (2 ** 15) // 100
+//| time.sleep(0.01)
+//|
+//| # Wait forever
+//| while True:
+//| pass
+//|
+//| .. class:: OnDiskBitmap(file)
+//|
+//| Create an OnDiskBitmap object with the given file.
+//|
+//| :param file file: The open bitmap file
+//|
+STATIC mp_obj_t displayio_ondiskbitmap_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) {
+ mp_arg_check_num(n_args, n_kw, 1, 1, false);
+
+ if (!MP_OBJ_IS_TYPE(pos_args[0], &mp_type_fileio)) {
+ mp_raise_TypeError(translate("file must be a file opened in byte mode"));
+ }
+
+ displayio_ondiskbitmap_t *self = m_new_obj(displayio_ondiskbitmap_t);
+ self->base.type = &displayio_ondiskbitmap_type;
+ common_hal_displayio_ondiskbitmap_construct(self, MP_OBJ_TO_PTR(pos_args[0]));
+
+ return MP_OBJ_FROM_PTR(self);
+}
+
+STATIC const mp_rom_map_elem_t displayio_ondiskbitmap_locals_dict_table[] = {
+};
+STATIC MP_DEFINE_CONST_DICT(displayio_ondiskbitmap_locals_dict, displayio_ondiskbitmap_locals_dict_table);
+
+const mp_obj_type_t displayio_ondiskbitmap_type = {
+ { &mp_type_type },
+ .name = MP_QSTR_OnDiskBitmap,
+ .make_new = displayio_ondiskbitmap_make_new,
+ .locals_dict = (mp_obj_dict_t*)&displayio_ondiskbitmap_locals_dict,
+};
diff --git a/shared-bindings/displayio/OnDiskBitmap.h b/shared-bindings/displayio/OnDiskBitmap.h
new file mode 100644
index 000000000..ab8b8dcd8
--- /dev/null
+++ b/shared-bindings/displayio/OnDiskBitmap.h
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_ONDISKBITMAP_H
+#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_ONDISKBITMAP_H
+
+#include "shared-module/displayio/OnDiskBitmap.h"
+#include "extmod/vfs_fat.h"
+
+extern const mp_obj_type_t displayio_ondiskbitmap_type;
+
+void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, pyb_file_obj_t* file);
+
+uint32_t common_hal_displayio_ondiskbitmap_get_pixel(displayio_ondiskbitmap_t *bitmap,
+ int16_t x, int16_t y);
+
+#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_ONDISKBITMAP_H
diff --git a/shared-bindings/displayio/Sprite.c b/shared-bindings/displayio/Sprite.c
index 223a8a394..69c1a5896 100644
--- a/shared-bindings/displayio/Sprite.c
+++ b/shared-bindings/displayio/Sprite.c
@@ -33,6 +33,9 @@
#include "py/objproperty.h"
#include "py/runtime.h"
#include "shared-bindings/displayio/Bitmap.h"
+#include "shared-bindings/displayio/ColorConverter.h"
+#include "shared-bindings/displayio/OnDiskBitmap.h"
+#include "shared-bindings/displayio/Palette.h"
#include "supervisor/shared/translate.h"
void unpack_position(mp_obj_t position_obj, int16_t* x, int16_t* y) {
@@ -51,23 +54,26 @@ void unpack_position(mp_obj_t position_obj, int16_t* x, int16_t* y) {
//| :class:`Sprite` -- A particular copy of an image to display
//| ==========================================================================
//|
-//| Position a particular image and palette combination.
+//| Position a particular image and pixel_shader combination. Multiple sprites can share bitmaps
+//| pixel shaders.
//|
//| .. warning:: This will be changed before 4.0.0. Consider it very experimental.
//|
-//| .. class:: Sprite(bitmap, *, palette, position, width, height)
+//| .. class:: Sprite(bitmap, *, pixel_shader, position, width, height)
//|
-//| Create a Sprite object
+//| Create a Sprite object. The bitmap is source for 2d pixels. The pixel_shader is used to
+//| convert the value and its location to a display native pixel color. This may be a simple color
+//| palette lookup, a gradient, a pattern or a color transformer.
//|
//|
STATIC mp_obj_t displayio_sprite_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) {
mp_arg_check_num(n_args, n_kw, 1, 4, true);
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, pos_args + n_args);
- enum { ARG_bitmap, ARG_palette, ARG_position, ARG_width, ARG_height };
+ enum { ARG_bitmap, ARG_pixel_shader, ARG_position, ARG_width, ARG_height };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_bitmap, MP_ARG_OBJ | MP_ARG_REQUIRED },
- { MP_QSTR_palette, MP_ARG_OBJ | MP_ARG_KW_ONLY },
+ { MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY },
{ MP_QSTR_position, MP_ARG_OBJ | MP_ARG_KW_ONLY },
{ MP_QSTR_width, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = -1} },
{ MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = -1} },
@@ -83,6 +89,10 @@ STATIC mp_obj_t displayio_sprite_make_new(const mp_obj_type_t *type, size_t n_ar
displayio_bitmap_t* bmp = MP_OBJ_TO_PTR(bitmap);
width = bmp->width;
height = bmp->height;
+ } else if (MP_OBJ_IS_TYPE(bitmap, &displayio_ondiskbitmap_type)) {
+ displayio_ondiskbitmap_t* bmp = MP_OBJ_TO_PTR(bitmap);
+ width = bmp->width;
+ height = bmp->height;
} else {
mp_raise_TypeError(translate("unsupported bitmap type"));
}
@@ -93,7 +103,7 @@ STATIC mp_obj_t displayio_sprite_make_new(const mp_obj_type_t *type, size_t n_ar
displayio_sprite_t *self = m_new_obj(displayio_sprite_t);
self->base.type = &displayio_sprite_type;
- common_hal_displayio_sprite_construct(self, bitmap, args[ARG_palette].u_obj,
+ common_hal_displayio_sprite_construct(self, bitmap, args[ARG_pixel_shader].u_obj,
width, height, x, y);
return MP_OBJ_FROM_PTR(self);
}
@@ -136,40 +146,39 @@ const mp_obj_property_t displayio_sprite_position_obj = {
(mp_obj_t)&mp_const_none_obj},
};
-//| .. attribute:: palette
+//| .. attribute:: pixel_shader
//|
-//| The color palette of the sprite.
+//| The pixel shader of the sprite.
//|
-STATIC mp_obj_t displayio_sprite_obj_get_palette(mp_obj_t self_in) {
+STATIC mp_obj_t displayio_sprite_obj_get_pixel_shader(mp_obj_t self_in) {
displayio_sprite_t *self = MP_OBJ_TO_PTR(self_in);
- return common_hal_displayio_sprite_get_palette(self);
+ return common_hal_displayio_sprite_get_pixel_shader(self);
}
-MP_DEFINE_CONST_FUN_OBJ_1(displayio_sprite_get_palette_obj, displayio_sprite_obj_get_palette);
+MP_DEFINE_CONST_FUN_OBJ_1(displayio_sprite_get_pixel_shader_obj, displayio_sprite_obj_get_pixel_shader);
-STATIC mp_obj_t displayio_sprite_obj_set_palette(mp_obj_t self_in, mp_obj_t palette_in) {
+STATIC mp_obj_t displayio_sprite_obj_set_pixel_shader(mp_obj_t self_in, mp_obj_t pixel_shader) {
displayio_sprite_t *self = MP_OBJ_TO_PTR(self_in);
- if (!MP_OBJ_IS_TYPE(palette_in, &displayio_palette_type)) {
- mp_raise_TypeError(translate("palette must be displayio.Palette"));
+ if (!MP_OBJ_IS_TYPE(pixel_shader, &displayio_palette_type) && !MP_OBJ_IS_TYPE(pixel_shader, &displayio_colorconverter_type)) {
+ mp_raise_TypeError(translate("pixel_shader must be displayio.Palette or displayio.ColorConverter"));
}
- displayio_palette_t *palette = MP_OBJ_TO_PTR(palette_in);
- common_hal_displayio_sprite_set_palette(self, palette);
+ common_hal_displayio_sprite_set_pixel_shader(self, pixel_shader);
return mp_const_none;
}
-MP_DEFINE_CONST_FUN_OBJ_2(displayio_sprite_set_palette_obj, displayio_sprite_obj_set_palette);
+MP_DEFINE_CONST_FUN_OBJ_2(displayio_sprite_set_pixel_shader_obj, displayio_sprite_obj_set_pixel_shader);
-const mp_obj_property_t displayio_sprite_palette_obj = {
+const mp_obj_property_t displayio_sprite_pixel_shader_obj = {
.base.type = &mp_type_property,
- .proxy = {(mp_obj_t)&displayio_sprite_get_palette_obj,
- (mp_obj_t)&displayio_sprite_set_palette_obj,
+ .proxy = {(mp_obj_t)&displayio_sprite_get_pixel_shader_obj,
+ (mp_obj_t)&displayio_sprite_set_pixel_shader_obj,
(mp_obj_t)&mp_const_none_obj},
};
STATIC const mp_rom_map_elem_t displayio_sprite_locals_dict_table[] = {
// Properties
{ MP_ROM_QSTR(MP_QSTR_position), MP_ROM_PTR(&displayio_sprite_position_obj) },
- { MP_ROM_QSTR(MP_QSTR_palette), MP_ROM_PTR(&displayio_sprite_palette_obj) },
+ { MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&displayio_sprite_pixel_shader_obj) },
};
STATIC MP_DEFINE_CONST_DICT(displayio_sprite_locals_dict, displayio_sprite_locals_dict_table);
diff --git a/shared-bindings/displayio/Sprite.h b/shared-bindings/displayio/Sprite.h
index 0bfa40044..1944e1d74 100644
--- a/shared-bindings/displayio/Sprite.h
+++ b/shared-bindings/displayio/Sprite.h
@@ -32,12 +32,12 @@
extern const mp_obj_type_t displayio_sprite_type;
void common_hal_displayio_sprite_construct(displayio_sprite_t *self, mp_obj_t bitmap,
- mp_obj_t palette, uint16_t width, uint16_t height, uint16_t x, uint16_t y);
+ mp_obj_t pixel_shader, uint16_t width, uint16_t height, uint16_t x, uint16_t y);
void common_hal_displayio_sprite_get_position(displayio_sprite_t *self, int16_t* x, int16_t* y);
void common_hal_displayio_sprite_set_position(displayio_sprite_t *self, int16_t x, int16_t y);
-displayio_palette_t* common_hal_displayio_sprite_get_palette(displayio_sprite_t *self);
-void common_hal_displayio_sprite_set_palette(displayio_sprite_t *self, displayio_palette_t* palette);
+mp_obj_t common_hal_displayio_sprite_get_pixel_shader(displayio_sprite_t *self);
+void common_hal_displayio_sprite_set_pixel_shader(displayio_sprite_t *self, mp_obj_t pixel_shader);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_SPRITE_H
diff --git a/shared-bindings/displayio/__init__.c b/shared-bindings/displayio/__init__.c
index 73f12db95..0610d71f6 100644
--- a/shared-bindings/displayio/__init__.c
+++ b/shared-bindings/displayio/__init__.c
@@ -31,8 +31,10 @@
#include "shared-bindings/displayio/__init__.h"
#include "shared-bindings/displayio/Bitmap.h"
+#include "shared-bindings/displayio/ColorConverter.h"
#include "shared-bindings/displayio/FourWire.h"
#include "shared-bindings/displayio/Group.h"
+#include "shared-bindings/displayio/OnDiskBitmap.h"
#include "shared-bindings/displayio/Palette.h"
#include "shared-bindings/displayio/Sprite.h"
@@ -57,8 +59,10 @@
//| :maxdepth: 3
//|
//| Bitmap
+//| ColorConverter
//| FourWire
//| Group
+//| OnDiskBitmap
//| Palette
//| Sprite
//|
@@ -68,7 +72,9 @@
STATIC const mp_rom_map_elem_t displayio_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_displayio) },
{ MP_ROM_QSTR(MP_QSTR_Bitmap), MP_ROM_PTR(&displayio_bitmap_type) },
+ { MP_ROM_QSTR(MP_QSTR_ColorConverter), MP_ROM_PTR(&displayio_colorconverter_type) },
{ MP_ROM_QSTR(MP_QSTR_Group), MP_ROM_PTR(&displayio_group_type) },
+ { MP_ROM_QSTR(MP_QSTR_OnDiskBitmap), MP_ROM_PTR(&displayio_ondiskbitmap_type) },
{ MP_ROM_QSTR(MP_QSTR_Palette), MP_ROM_PTR(&displayio_palette_type) },
{ MP_ROM_QSTR(MP_QSTR_Sprite), MP_ROM_PTR(&displayio_sprite_type) },