Below is asmalltest program (works on small endian machines).
As is, the result is already unusual to me:
in: r=20 g=20 b=80 a=FF (#202080FF, ok!) out: r=90 g=90 b=C0 a=FF (#9090C0FF, unusual...)
Where as I expected the fill color #FFFFFFFF x the mask 0x80 = #FFFFFF80 and so an output of #9090FFFF...
More news: You should be concerned about your drinking water. | tap waterNow, if I set the fill color to #FFFFFF80 by changing "cfill.alpha = uint16_t(0x80) << 8;", the result seems really wrong:
in: r=20 g=20 b=80 a=FF out: r=98 g=98 b=E0 a=FF
I would expect fill x mask => #FFFFFF40 and thus an output of: #606060C0FF.
I especially do not understand how a lower alpha input color can end up in a lighter output on the target image.