From 549bbdc31cbe64a7a340ed069c36966563690fa2 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 8 Aug 2023 12:42:48 -0700 Subject: [PATCH 01/11] Alphablend changes --- shared-bindings/bitmaptools/__init__.c | 62 ++++++++++++++- shared-bindings/bitmaptools/__init__.h | 11 ++- shared-module/bitmaptools/__init__.c | 101 ++++++++++++++++++++----- 3 files changed, 153 insertions(+), 21 deletions(-) diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index 2eb966ef8d..505c3885de 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -273,6 +273,28 @@ STATIC mp_obj_t bitmaptools_obj_rotozoom(size_t n_args, const mp_obj_t *pos_args } MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom); + +MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, NORMAL, BITMAPTOOLS_BLENDMODE_NORMAL); +MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, SCREEN, BITMAPTOOLS_BLENDMODE_SCREEN); + +//| class BlendMode: +//| """The blend mode for `alphablend` to operate use""" +//| +//| NORMAL: Blendmode +//| """Blend with equal parts of the two source bitmaps""" +//| +//| SCREEN: Blendmode +//| """Blend based on the value in each color channel. The result keeps the lighter colors and discards darker colors.""" +//| +MAKE_ENUM_MAP(bitmaptools_blendmode) { + MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, NORMAL), + MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, SCREEN), +}; +STATIC MP_DEFINE_CONST_DICT(bitmaptools_blendmode_locals_dict, bitmaptools_blendmode_locals_table); + +MAKE_PRINTER(bitmaptools, bitmaptools_blendmode); +MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); + // requires at least 2 arguments (destination bitmap and source bitmap) //| def alphablend( @@ -282,6 +304,9 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom //| colorspace: displayio.Colorspace, //| factor1: float = 0.5, //| factor2: Optional[float] = None, +//| blendmode: Optional[Blendmode] = Blendmode.NORMAL, +//| skip_source1_index: int, +//| skip_source2_index: int, //| ) -> None: //| """Alpha blend the two source bitmaps into the destination. //| @@ -294,13 +319,18 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom //| :param float factor1: The proportion of bitmap 1 to mix in //| :param float factor2: The proportion of bitmap 2 to mix in. If specified as `None`, ``1-factor1`` is used. Usually the proportions should sum to 1. //| :param displayio.Colorspace colorspace: The colorspace of the bitmaps. They must all have the same colorspace. Only the following colorspaces are permitted: ``L8``, ``RGB565``, ``RGB565_SWAPPED``, ``BGR565`` and ``BGR565_SWAPPED``. +//| :param bitmaptools.BlendMode blendmode: The blend mode to use. Default is NORMAL. +//| :param int skip_source1_index: bitmap palette index in the source that will not be blended, +//| set to None to blended all pixels +//| :param int skip_source2_index: bitmap palette index in the source that will not be blended, +//| set to None to blended all pixels //| //| For the L8 colorspace, the bitmaps must have a bits-per-value of 8. //| For the RGB colorspaces, they must have a bits-per-value of 16.""" //| STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum {ARG_dest_bitmap, ARG_source_bitmap_1, ARG_source_bitmap_2, ARG_colorspace, ARG_factor_1, ARG_factor_2}; + enum {ARG_dest_bitmap, ARG_source_bitmap_1, ARG_source_bitmap_2, ARG_colorspace, ARG_factor_1, ARG_factor_2, ARG_blendmode, ARG_skip_source1_index, ARG_skip_source2_index}; static const mp_arg_t allowed_args[] = { {MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = NULL}}, @@ -309,6 +339,9 @@ STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args, {MP_QSTR_colorspace, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = NULL}}, {MP_QSTR_factor_1, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE}}, {MP_QSTR_factor_2, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE}}, + {MP_QSTR_blendmode, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = (void *)&bitmaptools_blendmode_NORMAL_obj}}, + {MP_QSTR_skip_source1_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + {MP_QSTR_skip_source2_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, }; 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); @@ -321,6 +354,7 @@ STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args, mp_float_t factor2 = (args[ARG_factor_2].u_obj == mp_const_none) ? 1 - factor1 : mp_obj_get_float(args[ARG_factor_2].u_obj); displayio_colorspace_t colorspace = (displayio_colorspace_t)cp_enum_value(&displayio_colorspace_type, args[ARG_colorspace].u_obj, MP_QSTR_colorspace); + bitmaptools_blendmode_t blendmode = (bitmaptools_blendmode_t)cp_enum_value(&bitmaptools_blendmode_type, args[ARG_blendmode].u_obj, MP_QSTR_blendmode); if (destination->width != source1->width || destination->height != source1->height @@ -352,7 +386,30 @@ STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args, mp_raise_ValueError(translate("Unsupported colorspace")); } - common_hal_bitmaptools_alphablend(destination, source1, source2, colorspace, factor1, factor2); + uint32_t skip_source1_index; + bool skip_source1_index_none; // flag whether skip_value was None + + if (args[ARG_skip_source1_index].u_obj == mp_const_none) { + skip_source1_index = 0; + skip_source1_index_none = true; + } else { + skip_source1_index = mp_obj_get_int(args[ARG_skip_source1_index].u_obj); + skip_source1_index_none = false; + } + + uint32_t skip_source2_index; + bool skip_source2_index_none; // flag whether skip_self_value was None + + if (args[ARG_skip_source2_index].u_obj == mp_const_none) { + skip_source2_index = 0; + skip_source2_index_none = true; + } else { + skip_source2_index = mp_obj_get_int(args[ARG_skip_source2_index].u_obj); + skip_source2_index_none = false; + } + + common_hal_bitmaptools_alphablend(destination, source1, source2, colorspace, factor1, factor2, blendmode, skip_source1_index, + skip_source1_index_none, skip_source2_index, skip_source2_index_none); return mp_const_none; } @@ -1080,6 +1137,7 @@ STATIC const mp_rom_map_elem_t bitmaptools_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&bitmaptools_readinto_obj) }, { MP_ROM_QSTR(MP_QSTR_rotozoom), MP_ROM_PTR(&bitmaptools_rotozoom_obj) }, { MP_ROM_QSTR(MP_QSTR_arrayblit), MP_ROM_PTR(&bitmaptools_arrayblit_obj) }, + { MP_ROM_QSTR(MP_QSTR_Blendmode), MP_ROM_PTR(&bitmaptools_blendmode_type) }, { MP_ROM_QSTR(MP_QSTR_alphablend), MP_ROM_PTR(&bitmaptools_alphablend_obj) }, { MP_ROM_QSTR(MP_QSTR_fill_region), MP_ROM_PTR(&bitmaptools_fill_region_obj) }, { MP_ROM_QSTR(MP_QSTR_boundary_fill), MP_ROM_PTR(&bitmaptools_boundary_fill_obj) }, diff --git a/shared-bindings/bitmaptools/__init__.h b/shared-bindings/bitmaptools/__init__.h index be0811cb80..c7a8df0c99 100644 --- a/shared-bindings/bitmaptools/__init__.h +++ b/shared-bindings/bitmaptools/__init__.h @@ -40,6 +40,11 @@ typedef enum { extern const mp_obj_type_t bitmaptools_dither_algorithm_type; +typedef enum bitmaptools_blendmode { + BITMAPTOOLS_BLENDMODE_NORMAL, + BITMAPTOOLS_BLENDMODE_SCREEN, +} bitmaptools_blendmode_t; + void common_hal_bitmaptools_rotozoom(displayio_bitmap_t *self, int16_t ox, int16_t oy, int16_t dest_clip0_x, int16_t dest_clip0_y, int16_t dest_clip1_x, int16_t dest_clip1_y, @@ -78,6 +83,10 @@ void common_hal_bitmaptools_readinto(displayio_bitmap_t *self, mp_obj_t *file, i void common_hal_bitmaptools_arrayblit(displayio_bitmap_t *self, void *data, int element_size, int x1, int y1, int x2, int y2, bool skip_specified, uint32_t skip_index); void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bitmap_t *source_bitmap, displayio_colorspace_t colorspace, bitmaptools_dither_algorithm_t algorithm); -void common_hal_bitmaptools_alphablend(displayio_bitmap_t *destination, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, mp_float_t factor1, mp_float_t factor2); +void common_hal_bitmaptools_alphablend(displayio_bitmap_t *destination, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, mp_float_t factor1, mp_float_t factor2, + bitmaptools_blendmode_t blendmode, uint32_t skip_source1_index, bool skip_source1_index_none, uint32_t skip_source2_index, bool skip_source2_index_none); + +extern const mp_obj_type_t bitmaptools_blendmode_type; +extern const cp_enum_obj_t bitmaptools_blendmode_NORMAL_obj; #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BITMAPTOOLS__INIT__H diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index e6c0a9439d..4497231785 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -861,26 +861,53 @@ void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bi displayio_bitmap_set_dirty_area(dest_bitmap, &a); } -void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, mp_float_t factor1, mp_float_t factor2) { +void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, mp_float_t factor1, mp_float_t factor2, + bitmaptools_blendmode_t blendmode, uint32_t skip_source1_index, bool skip_source1_index_none, uint32_t skip_source2_index, bool skip_source2_index_none) { displayio_area_t a = {0, 0, dest->width, dest->height, NULL}; displayio_bitmap_set_dirty_area(dest, &a); int ifactor1 = (int)(factor1 * 256); int ifactor2 = (int)(factor2 * 256); + bool blend_source1, blend_source2; if (colorspace == DISPLAYIO_COLORSPACE_L8) { for (int y = 0; y < dest->height; y++) { uint8_t *dptr = (uint8_t *)(dest->data + y * dest->stride); uint8_t *sptr1 = (uint8_t *)(source1->data + y * source1->stride); uint8_t *sptr2 = (uint8_t *)(source2->data + y * source2->stride); + int pixel; for (int x = 0; x < dest->width; x++) { - // This is round(l1*f1 + l2*f2) & clip to range in fixed-point - int pixel = (*sptr1++ *ifactor1 + *sptr2++ *ifactor2 + 128) / 256; + blend_source1 = skip_source1_index_none || *sptr1 != (uint8_t)skip_source1_index; + blend_source2 = skip_source2_index_none || *sptr2 != (uint8_t)skip_source2_index; + if (blend_source1 && blend_source2) { + // Premultiply by the alpha factor + int sca1 = *sptr1++ * ifactor1; + int sca2 = *sptr2++ * ifactor2; + // Blend + int blend; + if (blendmode == BITMAPTOOLS_BLENDMODE_SCREEN) { + blend = sca2 + sca1 - sca2 * sca1; + } else { + blend = sca2 + sca1 * (256 - ifactor2); + } + // Divide by the alpha factor + pixel = (blend / (256 * ifactor1 + 256 * ifactor2 - ifactor1 * ifactor2)); + } else if (blend_source1) { + // Apply iFactor1 to source1 only + pixel = *sptr1++ *ifactor1 / 256; + } else if (blend_source2) { + // Apply iFactor2 to source1 only + pixel = *sptr2++ *ifactor2 / 256; + } else { + // Use the destination value + pixel = *dptr; + } *dptr++ = MIN(255, MAX(0, pixel)); } } } else { bool swap = (colorspace == DISPLAYIO_COLORSPACE_RGB565_SWAPPED) || (colorspace == DISPLAYIO_COLORSPACE_BGR565_SWAPPED); + uint16_t pixel; for (int y = 0; y < dest->height; y++) { uint16_t *dptr = (uint16_t *)(dest->data + y * dest->stride); uint16_t *sptr1 = (uint16_t *)(source1->data + y * source1->stride); @@ -897,25 +924,63 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma const int g_mask = 0x07e0; const int b_mask = 0x001f; // (or r mask, if BGR) - // This is round(r1*f1 + r2*f2) & clip to range in fixed-point - // but avoiding shifting it down to start at bit 0 - int r = ((spix1 & r_mask) * ifactor1 - + (spix2 & r_mask) * ifactor2 + r_mask / 2) / 256; - r = MIN(r_mask, MAX(0, r)) & r_mask; + blend_source1 = skip_source1_index_none || spix1 != (int)skip_source1_index; + blend_source2 = skip_source2_index_none || spix2 != (int)skip_source2_index; - // ditto - int g = ((spix1 & g_mask) * ifactor1 - + (spix2 & g_mask) * ifactor2 + g_mask / 2) / 256; - g = MIN(g_mask, MAX(0, g)) & g_mask; + if (blend_source1 && blend_source2) { + // Blend based on the SVG alpha compositing specs + // https://dev.w3.org/SVG/modules/compositing/master/#alphaCompositing - int b = ((spix1 & b_mask) * ifactor1 - + (spix2 & b_mask) * ifactor2 + b_mask / 2) / 256; - b = MIN(b_mask, MAX(0, b)) & b_mask; + int ifactor_blend = ifactor1 + ifactor2 - ifactor1 * ifactor2 / 256; - uint16_t pixel = r | g | b; - if (swap) { - pixel = __builtin_bswap16(pixel); + // Premultiply the colors by the alpha factor + int red_sca1 = ((spix1 & r_mask) >> 11) * ifactor1; + int green_sca1 = ((spix1 & g_mask) >> 5) * ifactor1; + int blue_sca1 = (spix1 & b_mask) * ifactor1; + + int red_sca2 = ((spix2 & r_mask) >> 11) * ifactor2; + int green_sca2 = ((spix2 & g_mask) >> 5) * ifactor2; + int blue_sca2 = (spix2 & b_mask) * ifactor2; + + int red_blend, green_blend, blue_blend; + if (blendmode == BITMAPTOOLS_BLENDMODE_SCREEN) { + // Perform a screen blend + red_blend = red_sca2 + red_sca1 - (red_sca2 * red_sca1); + green_blend = green_sca2 + green_sca1 - (green_sca2 * green_sca1); + blue_blend = blue_sca2 + blue_sca1 - (blue_sca2 * blue_sca1); + } else { + // Perform a normal blend + red_blend = red_sca2 + red_sca1 * (256 - ifactor2) / 256; + green_blend = green_sca2 + green_sca1 * (256 - ifactor2) / 256; + blue_blend = blue_sca2 + blue_sca1 * (256 - ifactor2) / 256; + } + + // Divide by the alpha factor + int r = ((red_blend / ifactor_blend) << 11) & r_mask; + int g = ((green_blend / ifactor_blend) << 5) & g_mask; + int b = (blue_blend / ifactor_blend) & b_mask; + + // Clamp to the appropriate range + r = MIN(r_mask, MAX(0, r)) & r_mask; + g = MIN(g_mask, MAX(0, g)) & g_mask; + b = MIN(b_mask, MAX(0, b)) & b_mask; + + pixel = r | g | b; + + if (swap) { + pixel = __builtin_bswap16(pixel); + } + } else if (blend_source1) { + // Apply iFactor1 to source1 only + pixel = spix1 * ifactor1 / 256; + } else if (blend_source2) { + // Apply iFactor2 to source1 only + pixel = spix2 * ifactor2 / 256; + } else { + // Use the destination value + pixel = *dptr; } + *dptr++ = pixel; } } From b25d3131a3fd756e5b5784008092c4949109db47 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 8 Aug 2023 12:54:14 -0700 Subject: [PATCH 02/11] Update doc string --- shared-bindings/bitmaptools/__init__.c | 48 ++++++++++++-------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index 505c3885de..90ed663e5f 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -126,6 +126,27 @@ STATIC void validate_clip_region(displayio_bitmap_t *bitmap, mp_obj_t clip0_tupl } +MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, NORMAL, BITMAPTOOLS_BLENDMODE_NORMAL); +MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, SCREEN, BITMAPTOOLS_BLENDMODE_SCREEN); + +//| class BlendMode: +//| """The blend mode for `alphablend` to operate use""" +//| +//| NORMAL: Blendmode +//| """Blend with equal parts of the two source bitmaps""" +//| +//| SCREEN: Blendmode +//| """Blend based on the value in each color channel. The result keeps the lighter colors and discards darker colors.""" +//| +MAKE_ENUM_MAP(bitmaptools_blendmode) { + MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, NORMAL), + MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, SCREEN), +}; +STATIC MP_DEFINE_CONST_DICT(bitmaptools_blendmode_locals_dict, bitmaptools_blendmode_locals_table); + +MAKE_PRINTER(bitmaptools, bitmaptools_blendmode); +MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); + //| def rotozoom( //| dest_bitmap: displayio.Bitmap, //| source_bitmap: displayio.Bitmap, @@ -274,27 +295,6 @@ STATIC mp_obj_t bitmaptools_obj_rotozoom(size_t n_args, const mp_obj_t *pos_args MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom); -MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, NORMAL, BITMAPTOOLS_BLENDMODE_NORMAL); -MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, SCREEN, BITMAPTOOLS_BLENDMODE_SCREEN); - -//| class BlendMode: -//| """The blend mode for `alphablend` to operate use""" -//| -//| NORMAL: Blendmode -//| """Blend with equal parts of the two source bitmaps""" -//| -//| SCREEN: Blendmode -//| """Blend based on the value in each color channel. The result keeps the lighter colors and discards darker colors.""" -//| -MAKE_ENUM_MAP(bitmaptools_blendmode) { - MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, NORMAL), - MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, SCREEN), -}; -STATIC MP_DEFINE_CONST_DICT(bitmaptools_blendmode_locals_dict, bitmaptools_blendmode_locals_table); - -MAKE_PRINTER(bitmaptools, bitmaptools_blendmode); -MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); - // requires at least 2 arguments (destination bitmap and source bitmap) //| def alphablend( @@ -320,10 +320,8 @@ MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); //| :param float factor2: The proportion of bitmap 2 to mix in. If specified as `None`, ``1-factor1`` is used. Usually the proportions should sum to 1. //| :param displayio.Colorspace colorspace: The colorspace of the bitmaps. They must all have the same colorspace. Only the following colorspaces are permitted: ``L8``, ``RGB565``, ``RGB565_SWAPPED``, ``BGR565`` and ``BGR565_SWAPPED``. //| :param bitmaptools.BlendMode blendmode: The blend mode to use. Default is NORMAL. -//| :param int skip_source1_index: bitmap palette index in the source that will not be blended, -//| set to None to blended all pixels -//| :param int skip_source2_index: bitmap palette index in the source that will not be blended, -//| set to None to blended all pixels +//| :param int skip_source1_index: bitmap palette index in source_bitmap_1 that will not be blended, set to None to blend all pixels +//| :param int skip_source2_index: bitmap palette index in source_bitmap_2 that will not be blended, set to None to blend all pixels //| //| For the L8 colorspace, the bitmaps must have a bits-per-value of 8. //| For the RGB colorspaces, they must have a bits-per-value of 16.""" From c9c7f02ba40200812fe4c824ecf9235da17437aa Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 8 Aug 2023 13:03:09 -0700 Subject: [PATCH 03/11] Fix formatting --- shared-module/bitmaptools/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index 4497231785..5d120861fb 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -894,10 +894,10 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma pixel = (blend / (256 * ifactor1 + 256 * ifactor2 - ifactor1 * ifactor2)); } else if (blend_source1) { // Apply iFactor1 to source1 only - pixel = *sptr1++ *ifactor1 / 256; + pixel = *sptr1++ * ifactor1 / 256; } else if (blend_source2) { // Apply iFactor2 to source1 only - pixel = *sptr2++ *ifactor2 / 256; + pixel = *sptr2++ * ifactor2 / 256; } else { // Use the destination value pixel = *dptr; From 5393bc4ed0c9e666e6b2ad395c6eeabfcc5c7634 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 8 Aug 2023 13:07:50 -0700 Subject: [PATCH 04/11] More formatting --- shared-module/bitmaptools/__init__.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index 5d120861fb..ecfe10c01c 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -881,8 +881,8 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma blend_source2 = skip_source2_index_none || *sptr2 != (uint8_t)skip_source2_index; if (blend_source1 && blend_source2) { // Premultiply by the alpha factor - int sca1 = *sptr1++ * ifactor1; - int sca2 = *sptr2++ * ifactor2; + int sca1 = *sptr1++ *ifactor1; + int sca2 = *sptr2++ *ifactor2; // Blend int blend; if (blendmode == BITMAPTOOLS_BLENDMODE_SCREEN) { @@ -894,10 +894,10 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma pixel = (blend / (256 * ifactor1 + 256 * ifactor2 - ifactor1 * ifactor2)); } else if (blend_source1) { // Apply iFactor1 to source1 only - pixel = *sptr1++ * ifactor1 / 256; + pixel = *sptr1++ *ifactor1 / 256; } else if (blend_source2) { // Apply iFactor2 to source1 only - pixel = *sptr2++ * ifactor2 / 256; + pixel = *sptr2++ *ifactor2 / 256; } else { // Use the destination value pixel = *dptr; From ea39d7089f5c2971500b59f54967f4aa71ebb981 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 8 Aug 2023 14:21:55 -0700 Subject: [PATCH 05/11] Updated docstring stuff --- shared-bindings/bitmaptools/__init__.c | 54 +++++++++++++------------- shared-bindings/bitmaptools/__init__.h | 11 +++--- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index 90ed663e5f..c828e8e250 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -126,27 +126,6 @@ STATIC void validate_clip_region(displayio_bitmap_t *bitmap, mp_obj_t clip0_tupl } -MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, NORMAL, BITMAPTOOLS_BLENDMODE_NORMAL); -MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, SCREEN, BITMAPTOOLS_BLENDMODE_SCREEN); - -//| class BlendMode: -//| """The blend mode for `alphablend` to operate use""" -//| -//| NORMAL: Blendmode -//| """Blend with equal parts of the two source bitmaps""" -//| -//| SCREEN: Blendmode -//| """Blend based on the value in each color channel. The result keeps the lighter colors and discards darker colors.""" -//| -MAKE_ENUM_MAP(bitmaptools_blendmode) { - MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, NORMAL), - MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, SCREEN), -}; -STATIC MP_DEFINE_CONST_DICT(bitmaptools_blendmode_locals_dict, bitmaptools_blendmode_locals_table); - -MAKE_PRINTER(bitmaptools, bitmaptools_blendmode); -MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); - //| def rotozoom( //| dest_bitmap: displayio.Bitmap, //| source_bitmap: displayio.Bitmap, @@ -295,6 +274,27 @@ STATIC mp_obj_t bitmaptools_obj_rotozoom(size_t n_args, const mp_obj_t *pos_args MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom); +//| class BlendMode: +//| """The blend mode for `alphablend` to operate use""" +//| +//| Normal: BlendMode +//| """Blend with equal parts of the two source bitmaps""" +//| +//| Screen: BlendMode +//| """Blend based on the value in each color channel. The result keeps the lighter colors and discards darker colors.""" +//| +MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, Normal, BITMAPTOOLS_BLENDMODE_NORMAL); +MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, Screen, BITMAPTOOLS_BLENDMODE_SCREEN); + +MAKE_ENUM_MAP(bitmaptools_blendmode) { + MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, Normal), + MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, Screen), +}; +STATIC MP_DEFINE_CONST_DICT(bitmaptools_blendmode_locals_dict, bitmaptools_blendmode_locals_table); + +MAKE_PRINTER(bitmaptools, bitmaptools_blendmode); +MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); + // requires at least 2 arguments (destination bitmap and source bitmap) //| def alphablend( @@ -304,9 +304,9 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom //| colorspace: displayio.Colorspace, //| factor1: float = 0.5, //| factor2: Optional[float] = None, -//| blendmode: Optional[Blendmode] = Blendmode.NORMAL, -//| skip_source1_index: int, -//| skip_source2_index: int, +//| blendmode: Optional[BlendMode] = BlendMode.Normal, +//| skip_source1_index: Union[int, None] = None, +//| skip_source2_index: Union[int, None] = None, //| ) -> None: //| """Alpha blend the two source bitmaps into the destination. //| @@ -319,7 +319,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom //| :param float factor1: The proportion of bitmap 1 to mix in //| :param float factor2: The proportion of bitmap 2 to mix in. If specified as `None`, ``1-factor1`` is used. Usually the proportions should sum to 1. //| :param displayio.Colorspace colorspace: The colorspace of the bitmaps. They must all have the same colorspace. Only the following colorspaces are permitted: ``L8``, ``RGB565``, ``RGB565_SWAPPED``, ``BGR565`` and ``BGR565_SWAPPED``. -//| :param bitmaptools.BlendMode blendmode: The blend mode to use. Default is NORMAL. +//| :param bitmaptools.BlendMode blendmode: The blend mode to use. Default is Normal. //| :param int skip_source1_index: bitmap palette index in source_bitmap_1 that will not be blended, set to None to blend all pixels //| :param int skip_source2_index: bitmap palette index in source_bitmap_2 that will not be blended, set to None to blend all pixels //| @@ -337,7 +337,7 @@ STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args, {MP_QSTR_colorspace, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = NULL}}, {MP_QSTR_factor_1, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE}}, {MP_QSTR_factor_2, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE}}, - {MP_QSTR_blendmode, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = (void *)&bitmaptools_blendmode_NORMAL_obj}}, + {MP_QSTR_blendmode, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = (void *)&bitmaptools_blendmode_Normal_obj}}, {MP_QSTR_skip_source1_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, {MP_QSTR_skip_source2_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, }; @@ -1135,7 +1135,6 @@ STATIC const mp_rom_map_elem_t bitmaptools_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&bitmaptools_readinto_obj) }, { MP_ROM_QSTR(MP_QSTR_rotozoom), MP_ROM_PTR(&bitmaptools_rotozoom_obj) }, { MP_ROM_QSTR(MP_QSTR_arrayblit), MP_ROM_PTR(&bitmaptools_arrayblit_obj) }, - { MP_ROM_QSTR(MP_QSTR_Blendmode), MP_ROM_PTR(&bitmaptools_blendmode_type) }, { MP_ROM_QSTR(MP_QSTR_alphablend), MP_ROM_PTR(&bitmaptools_alphablend_obj) }, { MP_ROM_QSTR(MP_QSTR_fill_region), MP_ROM_PTR(&bitmaptools_fill_region_obj) }, { MP_ROM_QSTR(MP_QSTR_boundary_fill), MP_ROM_PTR(&bitmaptools_boundary_fill_obj) }, @@ -1144,6 +1143,7 @@ STATIC const mp_rom_map_elem_t bitmaptools_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_draw_circle), MP_ROM_PTR(&bitmaptools_draw_circle_obj) }, { MP_ROM_QSTR(MP_QSTR_blit), MP_ROM_PTR(&bitmaptools_blit_obj) }, { MP_ROM_QSTR(MP_QSTR_dither), MP_ROM_PTR(&bitmaptools_dither_obj) }, + { MP_ROM_QSTR(MP_QSTR_BlendMode), MP_ROM_PTR(&bitmaptools_blendmode_type) }, { MP_ROM_QSTR(MP_QSTR_DitherAlgorithm), MP_ROM_PTR(&bitmaptools_dither_algorithm_type) }, }; STATIC MP_DEFINE_CONST_DICT(bitmaptools_module_globals, bitmaptools_module_globals_table); diff --git a/shared-bindings/bitmaptools/__init__.h b/shared-bindings/bitmaptools/__init__.h index c7a8df0c99..7e1011d06d 100644 --- a/shared-bindings/bitmaptools/__init__.h +++ b/shared-bindings/bitmaptools/__init__.h @@ -40,11 +40,13 @@ typedef enum { extern const mp_obj_type_t bitmaptools_dither_algorithm_type; -typedef enum bitmaptools_blendmode { - BITMAPTOOLS_BLENDMODE_NORMAL, - BITMAPTOOLS_BLENDMODE_SCREEN, +typedef enum { + BITMAPTOOLS_BLENDMODE_NORMAL, BITMAPTOOLS_BLENDMODE_SCREEN, } bitmaptools_blendmode_t; +extern const mp_obj_type_t bitmaptools_blendmode_type; +extern const cp_enum_obj_t bitmaptools_blendmode_Normal_obj; + void common_hal_bitmaptools_rotozoom(displayio_bitmap_t *self, int16_t ox, int16_t oy, int16_t dest_clip0_x, int16_t dest_clip0_y, int16_t dest_clip1_x, int16_t dest_clip1_y, @@ -86,7 +88,4 @@ void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bi void common_hal_bitmaptools_alphablend(displayio_bitmap_t *destination, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, mp_float_t factor1, mp_float_t factor2, bitmaptools_blendmode_t blendmode, uint32_t skip_source1_index, bool skip_source1_index_none, uint32_t skip_source2_index, bool skip_source2_index_none); -extern const mp_obj_type_t bitmaptools_blendmode_type; -extern const cp_enum_obj_t bitmaptools_blendmode_NORMAL_obj; - #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BITMAPTOOLS__INIT__H From 78d1ebb52972e6e9d94cfc46ea88078239bc06ec Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 8 Aug 2023 18:33:09 -0700 Subject: [PATCH 06/11] Fix calculations --- shared-module/bitmaptools/__init__.c | 46 ++++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index ecfe10c01c..eebb7f7c24 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -881,17 +881,17 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma blend_source2 = skip_source2_index_none || *sptr2 != (uint8_t)skip_source2_index; if (blend_source1 && blend_source2) { // Premultiply by the alpha factor - int sca1 = *sptr1++ *ifactor1; - int sca2 = *sptr2++ *ifactor2; + int sda = *sptr1++ *ifactor1; + int sca = *sptr2++ *ifactor2; // Blend int blend; if (blendmode == BITMAPTOOLS_BLENDMODE_SCREEN) { - blend = sca2 + sca1 - sca2 * sca1; + blend = sca + sda - (sca * sda / 65536); } else { - blend = sca2 + sca1 * (256 - ifactor2); + blend = sca + sda * (256 - ifactor2) / 256; } // Divide by the alpha factor - pixel = (blend / (256 * ifactor1 + 256 * ifactor2 - ifactor1 * ifactor2)); + pixel = (blend / (ifactor1 + ifactor2 - ifactor1 * ifactor2 / 256)); } else if (blend_source1) { // Apply iFactor1 to source1 only pixel = *sptr1++ *ifactor1 / 256; @@ -934,31 +934,31 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma int ifactor_blend = ifactor1 + ifactor2 - ifactor1 * ifactor2 / 256; // Premultiply the colors by the alpha factor - int red_sca1 = ((spix1 & r_mask) >> 11) * ifactor1; - int green_sca1 = ((spix1 & g_mask) >> 5) * ifactor1; - int blue_sca1 = (spix1 & b_mask) * ifactor1; + int red_dca = ((spix1 & r_mask) >> 8) * ifactor1; + int grn_dca = ((spix1 & g_mask) >> 3) * ifactor1; + int blu_dca = ((spix1 & b_mask) << 3) * ifactor1; - int red_sca2 = ((spix2 & r_mask) >> 11) * ifactor2; - int green_sca2 = ((spix2 & g_mask) >> 5) * ifactor2; - int blue_sca2 = (spix2 & b_mask) * ifactor2; + int red_sca = ((spix2 & r_mask) >> 8) * ifactor2; + int grn_sca = ((spix2 & g_mask) >> 3) * ifactor2; + int blu_sca = ((spix2 & b_mask) << 3) * ifactor2; - int red_blend, green_blend, blue_blend; + int red_blend, grn_blend, blu_blend; if (blendmode == BITMAPTOOLS_BLENDMODE_SCREEN) { - // Perform a screen blend - red_blend = red_sca2 + red_sca1 - (red_sca2 * red_sca1); - green_blend = green_sca2 + green_sca1 - (green_sca2 * green_sca1); - blue_blend = blue_sca2 + blue_sca1 - (blue_sca2 * blue_sca1); + // Perform a screen blend Sca + Dca - Sca × Dca + red_blend = red_sca + red_dca - (red_sca * red_dca / 65536); + grn_blend = grn_sca + grn_dca - (grn_sca * grn_dca / 65536); + blu_blend = blu_sca + blu_dca - (blu_sca * blu_dca / 65536); } else { - // Perform a normal blend - red_blend = red_sca2 + red_sca1 * (256 - ifactor2) / 256; - green_blend = green_sca2 + green_sca1 * (256 - ifactor2) / 256; - blue_blend = blue_sca2 + blue_sca1 * (256 - ifactor2) / 256; + // Perform a normal (src-over) blend + red_blend = red_sca + red_dca * (256 - ifactor2) / 256; + grn_blend = grn_sca + grn_dca * (256 - ifactor2) / 256; + blu_blend = blu_sca + blu_dca * (256 - ifactor2) / 256; } // Divide by the alpha factor - int r = ((red_blend / ifactor_blend) << 11) & r_mask; - int g = ((green_blend / ifactor_blend) << 5) & g_mask; - int b = (blue_blend / ifactor_blend) & b_mask; + int r = ((red_blend / ifactor_blend) << 8) & r_mask; + int g = ((grn_blend / ifactor_blend) << 3) & g_mask; + int b = ((blu_blend / ifactor_blend) >> 3) & b_mask; // Clamp to the appropriate range r = MIN(r_mask, MAX(0, r)) & r_mask; From db23a9c9fe7198e207f6e262c6bb367b48f2934c Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 9 Aug 2023 09:15:17 -0700 Subject: [PATCH 07/11] Disable floppyio for feather m4 express + update docstring --- ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk | 1 + shared-bindings/bitmaptools/__init__.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk index c763fa44d5..d24e4c0deb 100644 --- a/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk @@ -11,6 +11,7 @@ EXTERNAL_FLASH_DEVICES = GD25Q16C LONGINT_IMPL = MPZ CIRCUITPY__EVE = 1 +CIRCUITPY_FLOPPYIO = 0 CIRCUITPY_SYNTHIO = 0 # We don't have room for the fonts for terminalio for certain languages, diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index c828e8e250..befa1b298e 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -320,8 +320,8 @@ MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); //| :param float factor2: The proportion of bitmap 2 to mix in. If specified as `None`, ``1-factor1`` is used. Usually the proportions should sum to 1. //| :param displayio.Colorspace colorspace: The colorspace of the bitmaps. They must all have the same colorspace. Only the following colorspaces are permitted: ``L8``, ``RGB565``, ``RGB565_SWAPPED``, ``BGR565`` and ``BGR565_SWAPPED``. //| :param bitmaptools.BlendMode blendmode: The blend mode to use. Default is Normal. -//| :param int skip_source1_index: bitmap palette index in source_bitmap_1 that will not be blended, set to None to blend all pixels -//| :param int skip_source2_index: bitmap palette index in source_bitmap_2 that will not be blended, set to None to blend all pixels +//| :param int skip_source1_index: Bitmap palette or luminance index in source_bitmap_1 that will not be blended, set to None to blend all pixels +//| :param int skip_source2_index: Bitmap palette or luminance index in source_bitmap_2 that will not be blended, set to None to blend all pixels //| //| For the L8 colorspace, the bitmaps must have a bits-per-value of 8. //| For the RGB colorspaces, they must have a bits-per-value of 16.""" From ce61fd857b721f7a044a25845c3e8ee3cee1e245 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Thu, 10 Aug 2023 08:15:18 -0700 Subject: [PATCH 08/11] Bug fix for skip on only one bmp --- shared-module/bitmaptools/__init__.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index eebb7f7c24..2054ff9cab 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -972,10 +972,16 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma } } else if (blend_source1) { // Apply iFactor1 to source1 only - pixel = spix1 * ifactor1 / 256; + int r = (spix1 & r_mask) * ifactor1 / 256; + int g = (spix1 & g_mask) * ifactor1 / 256; + int b = (spix1 & b_mask) * ifactor1 / 256; + pixel = r | g | b; } else if (blend_source2) { // Apply iFactor2 to source1 only - pixel = spix2 * ifactor2 / 256; + int r = (spix2 & r_mask) * ifactor2 / 256; + int g = (spix2 & g_mask) * ifactor2 / 256; + int b = (spix2 & b_mask) * ifactor2 / 256; + pixel = r | g | b; } else { // Use the destination value pixel = *dptr; From 29a7a9e63ba9d0e17df21f2a191b1a9db7961e65 Mon Sep 17 00:00:00 2001 From: Luc Date: Fri, 11 Aug 2023 08:27:33 +0000 Subject: [PATCH 09/11] Translated using Weblate (German) Currently translated at 98.2% (981 of 998 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/de/ --- locale/de_DE.po | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/locale/de_DE.po b/locale/de_DE.po index d30229687e..f615ab9aa9 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-07-19 21:06+0000\n" +"PO-Revision-Date: 2023-08-12 10:50+0000\n" "Last-Translator: Luc \n" "Language: de_DE\n" "MIME-Version: 1.0\n" @@ -1501,7 +1501,7 @@ msgstr "Kein laufende Aufzeichnung" #: shared-module/usb/core/Device.c msgid "No configuration set" -msgstr "" +msgstr "Keine Konfiguration vorhanden" #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" @@ -2112,7 +2112,7 @@ msgstr "Zu viele Kanäle im sample." #: shared-module/displayio/__init__.c msgid "Too many display busses; forgot displayio.release_displays() ?" -msgstr "" +msgstr "Zu viele Display-Busse, displayio.release_displays() vergessen?" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -2849,7 +2849,7 @@ msgstr "Kann Instanz nicht erstellen" #: extmod/ulab/code/ndarray.c msgid "cannot delete array elements" -msgstr "" +msgstr "Array-Elemente können nicht gelöscht werden" #: py/runtime.c msgid "cannot import name %q" @@ -3318,7 +3318,7 @@ msgstr "inline assembler muss eine function sein" #: extmod/ulab/code/numpy/vector.c msgid "input and output dimensions differ" -msgstr "" +msgstr "Eingabe- und Ausgabedimensionen unterscheiden sich" #: extmod/ulab/code/numpy/vector.c msgid "input and output shapes differ" @@ -3764,7 +3764,7 @@ msgstr "nicht implementiert für komplexe dtype" #: extmod/ulab/code/numpy/bitwise.c msgid "not supported for input types" -msgstr "" +msgstr "nicht unterstützt für Eingabetypen" #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" @@ -3924,7 +3924,7 @@ msgstr "" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for function" -msgstr "" +msgstr "out-Schlüsselwort wird nicht unterstützt für Funktion" #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" @@ -3932,11 +3932,11 @@ msgstr "Ausgabe muss ein floatdichtes Array sein" #: extmod/ulab/code/numpy/vector.c msgid "out must be an ndarray" -msgstr "" +msgstr "out muss ein ndarray sein" #: extmod/ulab/code/numpy/vector.c msgid "out must be of float dtype" -msgstr "" +msgstr "out muss vom Typ dtype sein" #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" From c0f39076dc52619a1f6cacb6b633c04ade0f5aa9 Mon Sep 17 00:00:00 2001 From: Andi Chandler Date: Sun, 13 Aug 2023 01:11:52 +0000 Subject: [PATCH 10/11] Translated using Weblate (English (United Kingdom)) Currently translated at 100.0% (998 of 998 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/en_GB/ --- locale/en_GB.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/locale/en_GB.po b/locale/en_GB.po index 085c7e7b47..90bea5884c 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-08-06 17:45+0000\n" +"PO-Revision-Date: 2023-08-14 01:48+0000\n" "Last-Translator: Andi Chandler \n" "Language-Team: none\n" "Language: en_GB\n" @@ -266,19 +266,19 @@ msgstr "%q=%q" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts in more bits than pin count" -msgstr "" +msgstr "%q[%u] shifts in more bits than pin count" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts out more bits than pin count" -msgstr "" +msgstr "%q[%u] shifts out more bits than pin count" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] uses extra pin" -msgstr "" +msgstr "%q[%u] uses extra pin" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] waits on input outside of count" -msgstr "" +msgstr "%q[%u] waits on input outside of count" #: ports/espressif/common-hal/espidf/__init__.c #, c-format @@ -1370,31 +1370,31 @@ msgstr "Mismatched swap flag" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] reads pin(s)" -msgstr "" +msgstr "Missing first_in_pin. %q[%u] reads pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" -msgstr "" +msgstr "Missing first_in_pin. %q[%u] shifts in from pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] waits based on pin" -msgstr "" +msgstr "Missing first_in_pin. %q[%u] waits based on pin" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" -msgstr "" +msgstr "Missing first_out_pin. %q[%u] shifts out to pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] writes pin(s)" -msgstr "" +msgstr "Missing first_out_pin. %q[%u] writes pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_set_pin. %q[%u] sets pin(s)" -msgstr "" +msgstr "Missing first_set_pin. %q[%u] sets pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing jmp_pin. %q[%u] jumps on pin" -msgstr "" +msgstr "Missing jmp_pin. %q[%u] jumps on pin" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." From 3012c275e747b9fd40ffd4c83c6820c4bf4965ef Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Tue, 15 Aug 2023 18:09:42 -0400 Subject: [PATCH 11/11] Add SD_CS pin. --- ports/espressif/boards/adafruit_metro_esp32s3/pins.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c index dfad4381ef..3e0f65d335 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c +++ b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c @@ -72,6 +72,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_GPIO48) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO48),MP_ROM_PTR(&pin_GPIO48) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS),MP_ROM_PTR(&pin_GPIO21) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },