mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:07:45 +00:00
LibGfx: Add Color::with_opacity(float opacity)
This returns the color with its alpha scaled by the opacity.
This commit is contained in:
parent
f0560fd087
commit
120e5b6b6f
1 changed files with 5 additions and 0 deletions
|
@ -331,6 +331,11 @@ public:
|
||||||
alpha());
|
alpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr Color with_opacity(float opacity) const
|
||||||
|
{
|
||||||
|
return with_alpha(alpha() * opacity);
|
||||||
|
}
|
||||||
|
|
||||||
constexpr Color darkened(float amount = 0.5f) const
|
constexpr Color darkened(float amount = 0.5f) const
|
||||||
{
|
{
|
||||||
return Color(red() * amount, green() * amount, blue() * amount, alpha());
|
return Color(red() * amount, green() * amount, blue() * amount, alpha());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue