Create pattern
This commit is contained in:
@@ -38,7 +38,7 @@ namespace GPU {
|
||||
}
|
||||
};
|
||||
|
||||
class Color16 {
|
||||
class Color {
|
||||
private:
|
||||
static constexpr auto RedRange = BitRange<uint16_t>::from_to(0, 4);
|
||||
static constexpr auto BlueRange = BitRange<uint16_t>::from_to(5, 9);
|
||||
@@ -48,26 +48,27 @@ namespace GPU {
|
||||
ComplexBitMap<uint16_t> value = {0};
|
||||
|
||||
public:
|
||||
constexpr Color16() = default;
|
||||
constexpr Color16(uint8_t r, uint8_t g, uint8_t b) {
|
||||
Color16::set_red(r);
|
||||
Color16::set_green(g);
|
||||
Color16::set_blue(b);
|
||||
static constexpr Color from_rgb(uint8_t r, uint8_t g, uint8_t b) {
|
||||
return Color().set_red(r).set_green(g).set_blue(b);
|
||||
}
|
||||
|
||||
constexpr Color16(const Color24& color) : Color16(color.red, color.green, color.blue) {
|
||||
static constexpr Color from(const Color24& color) {
|
||||
return Color::from_rgb(color.red, color.green, color.blue);
|
||||
}
|
||||
|
||||
constexpr void set_red(uint8_t red) {
|
||||
constexpr Color& set_red(uint8_t red) {
|
||||
this->value.set_value(static_cast<uint16_t>(red), RedRange);
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr void set_green(uint8_t green) {
|
||||
constexpr Color& set_green(uint8_t green) {
|
||||
this->value.set_value(static_cast<uint16_t>(green), GreenRange);
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr void set_blue(uint8_t blue) {
|
||||
constexpr Color& set_blue(uint8_t blue) {
|
||||
this->value.set_value(static_cast<uint16_t>(blue), BlueRange);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user