#include "Color.hpp" namespace vkvm { constexpr int maxValue = 255; Color::Color() noexcept : red(0), green(0), blue(0) {} Color::Color(int red, int green, int blue) noexcept { setRed(red); setGreen(green); setBlue(blue); } Color::Color(unsigned int hex) noexcept { red = static_cast(hex >> 16 & 0xFF); green = static_cast(hex >> 8U & 0xFF); blue = static_cast((hex & 0xFF)); } auto Color::getRed() -> unsigned char { return red; } auto Color::getGreen() -> unsigned char { return green; } auto Color::getBlue() -> unsigned char { return blue; } auto Color::setRed(int value) -> void { if(value > maxValue) { value = maxValue; } red = value; } auto Color::setGreen(int value) -> void { if(value > maxValue) { value = maxValue; } green = value; } auto Color::setBlue(int value) -> void { if(value > maxValue) { value = maxValue; } blue = value; } bool Color::operator==(const Color &other) const { return this->blue == other.blue && this->green == other.green && this->red == other.red; } bool Color::operator!=(const Color &other) const { return this->blue != other.blue || this->green != other.green || this->red != other.red; } }