mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
LibGfx: Add Color::multiply() for component wise multiplication
This commit is contained in:
parent
179dba652e
commit
e504d4ef96
1 changed files with 9 additions and 0 deletions
|
@ -159,6 +159,15 @@ public:
|
||||||
#endif
|
#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
|
Color to_grayscale() const
|
||||||
{
|
{
|
||||||
int gray = (red() + green() + blue()) / 3;
|
int gray = (red() + green() + blue()) / 3;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue