1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#pragma once
/// 4-element colour in single-byte precision (0 - 255)
struct Colour4b
{
unsigned char r, g, b, a;
Colour4b() :
r(0), g(0), b(0), a(0)
{}
Colour4b(unsigned char _r, unsigned char _g,
unsigned char _b, unsigned char _a) :
r(_r), g(_g), b(_b), a(_a)
{}
bool operator<(const Colour4b& other) const {
if (r != other.r) {
return r < other.r;
}
if (g != other.g) {
return g < other.g;
}
if (b != other.b) {
return b < other.b;
}
if (a != other.a) {
return a < other.a;
}
return false;
}
bool operator==(const Colour4b& other) const {
return r == other.r && g == other.g && b == other.b && a == other.a;
}
bool operator!=(const Colour4b& other) const {
return !operator==(other);
}
};
|