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;