diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-06-16 15:09:11 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-06-16 15:09:11 +0200 |
commit | 017c0f87b428f735de2203957bfbc3f779faf2e7 (patch) | |
tree | 1263d5c1a8fc0ae9b6f6d2cfd1ff53ced0e8e1e8 /SharedGraphics | |
parent | 1db169244ab1201c07d86ace3991708cbdf01b72 (diff) | |
download | serenity-017c0f87b428f735de2203957bfbc3f779faf2e7.zip |
Color: Add setters for the red, green and blue components.
Diffstat (limited to 'SharedGraphics')
-rw-r--r-- | SharedGraphics/Color.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/SharedGraphics/Color.h b/SharedGraphics/Color.h index 630771087f..361f72fb16 100644 --- a/SharedGraphics/Color.h +++ b/SharedGraphics/Color.h @@ -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); |