LibGfx: Remove unused alpha premultiplication functions

This commit is contained in:
Tim Ledbetter 2025-11-05 10:04:59 +00:00 committed by Jelle Raaijmakers
parent d37eb3de32
commit 713191a078
Notes: github-actions[bot] 2025-11-05 14:40:20 +00:00

View file

@ -316,28 +316,6 @@ public:
return color_with_alpha;
}
constexpr Color to_premultiplied() const
{
u32 a = alpha();
u8 r = static_cast<u8>((red() * a + 127) / 255);
u8 g = static_cast<u8>((green() * a + 127) / 255);
u8 b = static_cast<u8>((blue() * a + 127) / 255);
return Color(r, g, b, a);
}
constexpr Color to_unpremultiplied() const
{
u32 a = alpha();
if (a == 0)
return Color(0, 0, 0, 0);
if (a == 255)
return *this;
u8 r = static_cast<u8>(min(255u, (red() * 255u + a / 2) / a));
u8 g = static_cast<u8>(min(255u, (green() * 255u + a / 2) / a));
u8 b = static_cast<u8>(min(255u, (blue() * 255u + a / 2) / a));
return Color(r, g, b, a);
}
constexpr Color blend(Color source) const
{
if (alpha() == 0 || source.alpha() == 255)