Add gfx::luminance(color)
This commit is contained in:
parent
424bf5f533
commit
b1ea7bc763
1 changed files with 6 additions and 0 deletions
|
|
@ -382,6 +382,12 @@ namespace psemek::gfx
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <std::floating_point T, std::size_t N>
|
||||||
|
T luminance(math::vector<T, N> const & c)
|
||||||
|
{
|
||||||
|
return c[0] * T(0.299) + c[1] * T(0.587) + c[2] * T(0.114);
|
||||||
|
}
|
||||||
|
|
||||||
std::optional<color_rgba> parse_color(std::string_view const & text);
|
std::optional<color_rgba> parse_color(std::string_view const & text);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue