34 lines
No EOL
656 B
C++
34 lines
No EOL
656 B
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
|
|
namespace Raven {
|
|
|
|
class RGB {
|
|
private:
|
|
double m_r {0.0};
|
|
double m_g {0.0};
|
|
double m_b {0.0};
|
|
public:
|
|
RGB() {}
|
|
RGB(double r, double g, double b)
|
|
: m_r(r)
|
|
, m_g(g)
|
|
, m_b(b) {}
|
|
|
|
RGB(unsigned int hex) {
|
|
m_r = (((hex) >> (2 * 8)) & 0xFF) / 255.0;
|
|
m_g = (((hex) >> (1 * 8)) & 0xFF) / 255.0;
|
|
m_b = (((hex) >> (0 * 8)) & 0xFF) / 255.0;
|
|
}
|
|
|
|
void set_r(double r) { m_r = r; }
|
|
void set_g(double g) { m_g = g; }
|
|
void set_b(double b) { m_b = b; }
|
|
|
|
double r() { return m_r; }
|
|
double g() { return m_g; }
|
|
double b() { return m_b; }
|
|
};
|
|
|
|
} |