"Erase/Add Alpha" brush for float image erases/adds only alpha channel, just as it does for byte image.
I tested with the .blend file in T86868.
Non-float image means byte image in source code.
Bug (Note that there is a black area after "Add alpha" in float image.)
Fix ("Add alpha" returns to the original color.)
Reference
The implementation for byte image.
MINLINE void blend_color_erase_alpha_byte(uchar dst[4], const uchar src1[4], const uchar src2[4])
{
if (src2[3] != 0) {
/* straight so just modify alpha channel */
const int t = src2[3];
dst[0] = src1[0];
dst[1] = src1[1];
dst[2] = src1[2];
dst[3] = (uchar)max_ii(src1[3] - divide_round_i(t * src2[3], 255), 0);
}
else {
/* no op */
copy_v4_v4_uchar(dst, src1);
}
}
MINLINE void blend_color_add_alpha_byte(uchar dst[4], const uchar src1[4], const uchar src2[4])
{
if (src2[3] != 0) {
/* straight so just modify alpha channel */
const int t = src2[3];
dst[0] = src1[0];
dst[1] = src1[1];
dst[2] = src1[2];
dst[3] = (uchar)min_ii(src1[3] + divide_round_i(t * src2[3], 255), 255);
}
else {
/* no op */
copy_v4_v4_uchar(dst, src1);
}
}