summaryrefslogtreecommitdiff
path: root/shared-bindings/_pixelbuf
diff options
context:
space:
mode:
authorRoy Hooper <rhooper@toybox.ca>2019-07-21 16:37:06 -0400
committerRoy Hooper <rhooper@toybox.ca>2019-07-21 16:37:06 -0400
commit31e4591691891abd92d8e3851cd13fb6dbc9bf64 (patch)
tree7487c1f847749f566562599d2d13cadecf6d0f4f /shared-bindings/_pixelbuf
parenta62a1ae2bd16a4d8e4029b26bd23761da1b12d5f (diff)
WIP: refactor _pixelbuf to use strings instead of classes
Diffstat (limited to 'shared-bindings/_pixelbuf')
-rw-r--r--shared-bindings/_pixelbuf/PixelBuf.c2
-rw-r--r--shared-bindings/_pixelbuf/__init__.c122
2 files changed, 2 insertions, 122 deletions
diff --git a/shared-bindings/_pixelbuf/PixelBuf.c b/shared-bindings/_pixelbuf/PixelBuf.c
index 2ea40d1de..01ba702c3 100644
--- a/shared-bindings/_pixelbuf/PixelBuf.c
+++ b/shared-bindings/_pixelbuf/PixelBuf.c
@@ -133,7 +133,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_a
if (args[ARG_byteorder].u_obj == NULL)
byteorder_str = "BGR";
else
- byteorder_str = mp_obj_str_get_data(byteorder_str, bo_len);
+ byteorder_str = mp_obj_str_get_data(args[ARG_byteorder].u_obj, &bo_len);
parse_byteorder_string(byteorder_str, byteorder_details);
diff --git a/shared-bindings/_pixelbuf/__init__.c b/shared-bindings/_pixelbuf/__init__.c
index 229c04603..02d5f49b3 100644
--- a/shared-bindings/_pixelbuf/__init__.c
+++ b/shared-bindings/_pixelbuf/__init__.c
@@ -82,126 +82,6 @@ const int32_t colorwheel(float pos) {
}
}
-
-/// RGB
-//| .. data:: RGB
-//|
-//| * **order** Red, Green, Blue
-//| * **bpp** 3
-PIXELBUF_BYTEORDER(RGB, 3, 0, 1, 2, 3, false, false)
-//| .. data:: RBG
-//|
-//| * **order** Red, Blue, Green
-//| * **bpp** 3
-PIXELBUF_BYTEORDER(RBG, 3, 0, 2, 1, 3, false, false)
-//| .. data:: GRB
-//|
-//| * **order** Green, Red, Blue
-//| * **bpp** 3
-//|
-//| Commonly used by NeoPixel.
-PIXELBUF_BYTEORDER(GRB, 3, 1, 0, 2, 3, false, false)
-//| .. data:: GBR
-//|
-//| * **order** Green, Blue, Red
-//| * **bpp** 3
-PIXELBUF_BYTEORDER(GBR, 3, 1, 2, 0, 3, false, false)
-//| .. data:: BRG
-//|
-//| * **order** Blue, Red, Green
-//| * **bpp** 3
-PIXELBUF_BYTEORDER(BRG, 3, 2, 0, 1, 3, false, false)
-//| .. data:: BGR
-//|
-//| * **order** Blue, Green, Red
-//| * **bpp** 3
-//|
-//| Commonly used by Dotstar.
-PIXELBUF_BYTEORDER(BGR, 3, 2, 1, 0, 3, false, false)
-
-// RGBW
-//| .. data:: RGBW
-//|
-//| * **order** Red, Green, Blue, White
-//| * **bpp** 4
-//| * **has_white** True
-PIXELBUF_BYTEORDER(RGBW, 4, 0, 1, 2, 3, true, false)
-//| .. data:: RBGW
-//|
-//| * **order** Red, Blue, Green, White
-//| * **bpp** 4
-//| * **has_white** True
-PIXELBUF_BYTEORDER(RBGW, 4, 0, 2, 1, 3, true, false)
-//| .. data:: GRBW
-//|
-//| * **order** Green, Red, Blue, White
-//| * **bpp** 4
-//| * **has_white** True
-//|
-//| Commonly used by RGBW NeoPixels.
-PIXELBUF_BYTEORDER(GRBW, 4, 1, 0, 2, 3, true, false)
-//| .. data:: GBRW
-//|
-//| * **order** Green, Blue, Red, White
-//| * **bpp** 4
-//| * **has_white** True
-PIXELBUF_BYTEORDER(GBRW, 4, 1, 2, 0, 3, true, false)
-//| .. data:: BRGW
-//|
-//| * **order** Blue, Red, Green, White
-//| * **bpp** 4
-//| * **has_white** True
-PIXELBUF_BYTEORDER(BRGW, 4, 2, 0, 1, 3, true, false)
-//| .. data:: BGRW
-//|
-//| * **order** Blue, Green, Red, White
-//| * **bpp** 4
-//| * **has_white** True
-PIXELBUF_BYTEORDER(BGRW, 4, 2, 1, 0, 3, true, false)
-
-// Luminosity + RGB (eg for Dotstar)
-// Luminosity chosen because the luminosity of a Dotstar at full bright
-// burns the eyes like looking at the Sun.
-// https://www.thesaurus.com/browse/luminosity?s=t
-//| .. data:: LRGB
-//|
-//| * **order** *Luminosity*, Red, Green, Blue
-//| * **bpp** 4
-//| * **has_luminosity** True
-PIXELBUF_BYTEORDER(LRGB, 4, 1, 2, 3, 0, false, true)
-//| .. data:: LRBG
-//|
-//| * **order** *Luminosity*, Red, Blue, Green
-//| * **bpp** 4
-//| * **has_luminosity** True
-PIXELBUF_BYTEORDER(LRBG, 4, 1, 3, 2, 0, false, true)
-//| .. data:: LGRB
-//|
-//| * **order** *Luminosity*, Green, Red, Blue
-//| * **bpp** 4
-//| * **has_luminosity** True
-PIXELBUF_BYTEORDER(LGRB, 4, 2, 1, 3, 0, false, true)
-//| .. data:: LGBR
-//|
-//| * **order** *Luminosity*, Green, Blue, Red
-//| * **bpp** 4
-//| * **has_luminosity** True
-PIXELBUF_BYTEORDER(LGBR, 4, 2, 3, 1, 0, false, true)
-//| .. data:: LBRG
-//|
-//| * **order** *Luminosity*, Blue, Red, Green
-//| * **bpp** 4
-//| * **has_luminosity** True
-PIXELBUF_BYTEORDER(LBRG, 4, 3, 1, 2, 0, false, true)
-//| .. data:: LBGR
-//|
-//| * **order** *Luminosity*, Blue, Green, Red
-//| * **bpp** 4
-//| * **has_luminosity** True
-//|
-//| Actual format commonly used by DotStar (5 bit luninance value)
-PIXELBUF_BYTEORDER(LBGR, 4, 3, 2, 1, 0, false, true)
-
STATIC const mp_rom_map_elem_t pixelbuf_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__pixelbuf) },
{ MP_ROM_QSTR(MP_QSTR_PixelBuf), MP_ROM_PTR(&pixelbuf_pixelbuf_type) },
@@ -223,7 +103,7 @@ STATIC const mp_rom_map_elem_t pixelbuf_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_GBRD), MP_ROM_QSTR(MP_QSTR_GBRD) },
{ MP_ROM_QSTR(MP_QSTR_BRGD), MP_ROM_QSTR(MP_QSTR_BRGD) },
{ MP_ROM_QSTR(MP_QSTR_BGRD), MP_ROM_QSTR(MP_QSTR_BGRD) },
- { MP_ROM_QSTR(MP_QSTR_wheel), MP_ROM_QSTR(&pixelbuf_wheel_obj) },
+ { MP_ROM_QSTR(MP_QSTR_wheel), MP_ROM_PTR(&pixelbuf_wheel_obj) },
};
STATIC MP_DEFINE_CONST_DICT(pixelbuf_module_globals, pixelbuf_module_globals_table);