mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-17 11:28:16 +00:00
Move inverse function into color_t
This commit is contained in:
parent
3f0485aaa4
commit
9f102269bc
@ -19,6 +19,7 @@
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include "global.hpp"
|
||||
|
||||
struct SDL_Color;
|
||||
|
||||
@ -223,6 +224,15 @@ struct color_t
|
||||
std::max<uint8_t>(a, c.a),
|
||||
};
|
||||
}
|
||||
|
||||
CONSTEXPR color_t inverse() const {
|
||||
return {
|
||||
static_cast<uint8_t>(255 - r),
|
||||
static_cast<uint8_t>(255 - g),
|
||||
static_cast<uint8_t>(255 - b),
|
||||
a
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, const color_t& c)
|
||||
|
@ -16,17 +16,6 @@
|
||||
|
||||
namespace font {
|
||||
|
||||
// TODO: evalulate whether this should become a color_t member
|
||||
static color_t inverse(const color_t& color)
|
||||
{
|
||||
return {
|
||||
static_cast<uint8_t>(255 - color.r),
|
||||
static_cast<uint8_t>(255 - color.g),
|
||||
static_cast<uint8_t>(255 - color.b),
|
||||
255 // TODO: should we respect alpha?
|
||||
};
|
||||
}
|
||||
|
||||
const color_t
|
||||
NORMAL_COLOR {0xDD, 0xDD, 0xDD},
|
||||
GRAY_COLOR {0x77, 0x77, 0x77},
|
||||
@ -41,7 +30,7 @@ const color_t
|
||||
LABEL_COLOR {0x6B, 0x8C, 0xFF},
|
||||
BIGMAP_COLOR {0xFF, 0xFF, 0xFF};
|
||||
|
||||
const color_t DISABLED_COLOR = inverse(PETRIFIED_COLOR);
|
||||
const color_t DISABLED_COLOR = PETRIFIED_COLOR.inverse();
|
||||
|
||||
const color_t
|
||||
weapon_color {245, 230, 193},
|
||||
|
Loading…
x
Reference in New Issue
Block a user