library/src/Color.cpp

48 lines
1.2 KiB
C++
Raw Normal View History

#include "Color.hpp"
namespace vkvm {
Color::Color() noexcept
: red(0), green(0), blue(0) {}
Color::Color(unsigned char red, unsigned char green, unsigned char blue) noexcept
: red(red), green(green), blue(blue) {}
2019-11-21 12:37:52 +01:00
Color::Color(unsigned int hex) noexcept {
red = (unsigned char) ((hex >> 16 & 0xFF));//NOLINT
green = (unsigned char) ((hex >> 8u & 0xFF));//NOLINT
blue = (unsigned char) ((hex & 0xFF));//NOLINT
}
auto Color::getRed() -> unsigned char {
return red;
}
auto Color::getGreen() -> unsigned char {
return green;
}
auto Color::getBlue() -> unsigned char {
return blue;
}
auto Color::setRed(unsigned char value) -> void {
red = value;
}
auto Color::setGreen(unsigned char value) -> void {
green = value;
}
auto Color::setBlue(unsigned char value) -> void {
blue = value;
}
2019-11-21 11:35:54 +01:00
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;
}
}