summaryrefslogtreecommitdiff
path: root/SharedGraphics
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-16 15:09:11 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-16 15:09:11 +0200
commit017c0f87b428f735de2203957bfbc3f779faf2e7 (patch)
tree1263d5c1a8fc0ae9b6f6d2cfd1ff53ced0e8e1e8 /SharedGraphics
parent1db169244ab1201c07d86ace3991708cbdf01b72 (diff)
downloadserenity-017c0f87b428f735de2203957bfbc3f779faf2e7.zip
Color: Add setters for the red, green and blue components.
Diffstat (limited to 'SharedGraphics')
-rw-r--r--SharedGraphics/Color.h18
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);