mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
Color: Add setters for the red, green and blue components.
This commit is contained in:
parent
1db169244a
commit
017c0f87b4
1 changed files with 18 additions and 0 deletions
|
@ -58,6 +58,24 @@ public:
|
||||||
m_value |= value << 24;
|
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)
|
Color with_alpha(byte alpha)
|
||||||
{
|
{
|
||||||
return Color((m_value & 0x00ffffff) | alpha << 24);
|
return Color((m_value & 0x00ffffff) | alpha << 24);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue