[nostalgia/core] Add redf, greenf, and bluef functions

This commit is contained in:
Gary Talent 2021-10-27 00:54:31 -05:00
parent badd07e27f
commit e2b9cd16b3

View File

@ -91,6 +91,22 @@ constexpr uint8_t blue32(Color32 c) noexcept {
}
[[nodiscard]]
constexpr float redf(Color16 c) noexcept {
return static_cast<float>(red16(c)) / 31.f;
}
[[nodiscard]]
constexpr float greenf(Color16 c) noexcept {
return static_cast<float>(green16(c)) / 31.f;
}
[[nodiscard]]
constexpr float bluef(Color16 c) noexcept {
return static_cast<float>(blue16(c)) / 31.f;
}
[[nodiscard]]
constexpr Color16 color16(uint8_t r, uint8_t g, uint8_t b) noexcept {
return r | (g << 5) | (b << 10);