80 //! @brief Calculates the luma-value for the given color. |
80 //! @brief Calculates the luma-value for the given color. |
81 //! @details c.f. https://en.wikipedia.org/wiki/Luma_(video) |
81 //! @details c.f. https://en.wikipedia.org/wiki/Luma_(video) |
82 template<typename T> |
82 template<typename T> |
83 constexpr T luma(T r, T g, T b) |
83 constexpr T luma(T r, T g, T b) |
84 { |
84 { |
85 return 0.2126 * r + 0.7152 * g + 0.0722 * b; |
85 return static_cast<T>(0.2126 * r + 0.7152 * g + 0.0722 * b); |
86 } |
86 } |
87 |
87 |
88 //! @brief Checks whether or not the specified color index is a direct color |
88 //! @brief Checks whether or not the specified color index is a direct color |
89 constexpr bool isDirectColor(ColorIndex color) |
89 constexpr bool isDirectColor(ColorIndex color) |
90 { |
90 { |