Merge remote-tracking branch 'adafruit/main' into merge-micropython-v1.19.1

This commit is contained in:
Dan Halbert 2023-08-18 13:29:39 -04:00
commit 6851faacaa
7 changed files with 180 additions and 42 deletions

View File

@ -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 <some_physics@live.com>\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"

View File

@ -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 <andi@gowling.com>\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."

View File

@ -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,

View File

@ -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) },

View File

@ -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);
//| 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(
@ -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: Union[int, None] = None,
//| skip_source2_index: Union[int, None] = None,
//| ) -> None:
//| """Alpha blend the two source bitmaps into the destination.
//|
@ -294,13 +319,16 @@ 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 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."""
//|
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 +337,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 +352,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 +384,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;
}
@ -1088,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);

View File

@ -40,6 +40,13 @@ typedef enum {
extern const mp_obj_type_t bitmaptools_dither_algorithm_type;
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,
@ -78,6 +85,7 @@ 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);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BITMAPTOOLS__INIT__H

View File

@ -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 sda = *sptr1++ *ifactor1;
int sca = *sptr2++ *ifactor2;
// Blend
int blend;
if (blendmode == BITMAPTOOLS_BLENDMODE_SCREEN) {
blend = sca + sda - (sca * sda / 65536);
} else {
blend = sca + sda * (256 - ifactor2) / 256;
}
// Divide by the alpha factor
pixel = (blend / (ifactor1 + ifactor2 - ifactor1 * ifactor2 / 256));
} 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,69 @@ 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_dca = ((spix1 & r_mask) >> 8) * ifactor1;
int grn_dca = ((spix1 & g_mask) >> 3) * ifactor1;
int blu_dca = ((spix1 & b_mask) << 3) * ifactor1;
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, grn_blend, blu_blend;
if (blendmode == BITMAPTOOLS_BLENDMODE_SCREEN) {
// 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 (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) << 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;
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
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
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;
}
*dptr++ = pixel;
}
}