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
Notes:
sideshowbarker
2024-07-17 03:27:40 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/120e5b6b6f Pull-request: https://github.com/SerenityOS/serenity/pull/18927
1 changed files with 5 additions and 0 deletions
|
@ -331,6 +331,11 @@ public:
|
|||
alpha());
|
||||
}
|
||||
|
||||
constexpr Color with_opacity(float opacity) const
|
||||
{
|
||||
return with_alpha(alpha() * opacity);
|
||||
}
|
||||
|
||||
constexpr Color darkened(float amount = 0.5f) const
|
||||
{
|
||||
return Color(red() * amount, green() * amount, blue() * amount, alpha());
|
||||
|
|
Loading…
Add table
Reference in a new issue