1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 05:27:45 +00:00

LibWeb+LibGfx: Move premultiplied alpha mixing to color.mixed_with()

This will be needed for mixing filters in LibGfx (and may be
generally useful elsewhere).
This commit is contained in:
MacDue 2022-09-15 08:31:22 +01:00 committed by Sam Atkins
parent ec4de1e07d
commit 7bc0c66290
3 changed files with 33 additions and 35 deletions

View file

@ -235,6 +235,8 @@ public:
#endif
}
Color mixed_with(Color const& other, float weight) const;
Color interpolate(Color const& other, float weight) const noexcept
{
u8 r = red() + round_to<u8>(static_cast<float>(other.red() - red()) * weight);