ColorRGBA ColorRGBA::Decomposite(const ColorRGBA& foreground) const { ColorRGBA result = *this; result = (result - foreground * foreground.Alpha()) / (1 - foreground.Alpha()); result.SetAlpha(1.f); return result; }
ColorRGBA ColorRGBA::Composite(const ColorRGBA& foreground) const { ColorRGBA result = *this; result = result * (1 - foreground.Alpha()) + foreground * foreground.Alpha(); result.SetAlpha(1.f); return result; }