mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[kandinsky] Inline KDColor::red, green and blue
Change-Id: Ief45fa20155c5857be36e2acd7351dfdf71639cb
This commit is contained in:
@@ -16,10 +16,21 @@ public:
|
||||
static constexpr KDColor RGB888(uint8_t r, uint8_t g, uint8_t b) {
|
||||
return KDColor((r>>3)<<11 | (g>>2) << 5 | (b>>3));
|
||||
}
|
||||
uint8_t red() const {
|
||||
uint8_t r5 = (m_value>>11)&0x1F;
|
||||
return r5 << 3;
|
||||
}
|
||||
|
||||
uint8_t green() const {
|
||||
uint8_t g6 = (m_value>>5)&0x3F;
|
||||
return g6 << 2;
|
||||
}
|
||||
|
||||
uint8_t blue() const {
|
||||
uint8_t b5 = m_value&0x1F;
|
||||
return b5 << 3;
|
||||
}
|
||||
|
||||
uint8_t red();
|
||||
uint8_t green();
|
||||
uint8_t blue();
|
||||
static KDColor blend(KDColor first, KDColor second, uint8_t alpha);
|
||||
operator uint16_t() const { return m_value; }
|
||||
private:
|
||||
|
||||
@@ -26,18 +26,3 @@ KDColor KDColor::blend(KDColor first, KDColor second, uint8_t alpha) {
|
||||
// white.red() = 0x1F << 3 = 0xF8
|
||||
// white.red() * 0xFF = 0xF708, we wanted 0xF800
|
||||
}
|
||||
|
||||
uint8_t KDColor::red() {
|
||||
uint8_t r5 = (m_value>>11)&0x1F;
|
||||
return r5 << 3;
|
||||
}
|
||||
|
||||
uint8_t KDColor::green() {
|
||||
uint8_t g6 = (m_value>>5)&0x3F;
|
||||
return g6 << 2;
|
||||
}
|
||||
|
||||
uint8_t KDColor::blue() {
|
||||
uint8_t b5 = m_value&0x1F;
|
||||
return b5 << 3;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user