477
478
blend(c: Color): Color {
480
>
481
>
// Convert to 0..1 opacity
482
>
const thisA = this.rgba.a;
483
>
const colorA = rgba.a;
484
>
485
>
const a = thisA + colorA * (1 - thisA);
486
>
if (a < 1e-6) {
487
return Color.transparent;
488
}
490
>
const r = this.rgba.r * thisA / a + rgba.r * colorA * (1 - thisA) / a;
491
>
const g = this.rgba.g * thisA / a + rgba.g * colorA * (1 - thisA) / a;
492
>
const b = this.rgba.b * thisA / a + rgba.b * colorA * (1 - thisA) / a;
493
>
494
>
return new Color(new RGBA(r, g, b, a));
495
>
}
496
497
/**