Color: Add setters for the red, green and blue components.
This commit is contained in:
parent
1db169244a
commit
017c0f87b4
Notes:
sideshowbarker
2024-07-19 13:34:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/017c0f87b42
1 changed files with 18 additions and 0 deletions
|
@ -58,6 +58,24 @@ public:
|
|||
m_value |= value << 24;
|
||||
}
|
||||
|
||||
void set_red(byte value)
|
||||
{
|
||||
m_value &= 0xff00ffff;
|
||||
m_value |= value << 16;
|
||||
}
|
||||
|
||||
void set_green(byte value)
|
||||
{
|
||||
m_value &= 0xffff00ff;
|
||||
m_value |= value << 8;
|
||||
}
|
||||
|
||||
void set_blue(byte value)
|
||||
{
|
||||
m_value &= 0xffffff00;
|
||||
m_value |= value;
|
||||
}
|
||||
|
||||
Color with_alpha(byte alpha)
|
||||
{
|
||||
return Color((m_value & 0x00ffffff) | alpha << 24);
|
||||
|
|
Loading…
Add table
Reference in a new issue