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

LibGfx: Add Color::multiply() for component wise multiplication

This commit is contained in:
Stephan Unverwerth 2021-01-02 18:15:27 +01:00 committed by Andreas Kling
parent 179dba652e
commit e504d4ef96

View file

@ -159,6 +159,15 @@ public:
#endif
}
Color multiply(const Color& other) const
{
return Color(
red() * other.red() / 255,
green() * other.green() / 255,
blue() * other.blue() / 255,
alpha() * other.alpha() / 255);
}
Color to_grayscale() const
{
int gray = (red() + green() + blue()) / 3;