Add sRGB <-> linear conversion for pixmaps
This commit is contained in:
parent
565ab68682
commit
a3d5a424dd
1 changed files with 14 additions and 0 deletions
|
|
@ -27,4 +27,18 @@ namespace psemek::gfx
|
||||||
pixmap_rgba read_png(io::istream && is);
|
pixmap_rgba read_png(io::istream && is);
|
||||||
pixmap_monochrome read_png_monochrome(io::istream && is);
|
pixmap_monochrome read_png_monochrome(io::istream && is);
|
||||||
|
|
||||||
|
template <typename Pixel, std::size_t N>
|
||||||
|
auto to_srgb(util::array<Pixel, N> pm, float g = 1.f / 2.2f)
|
||||||
|
{
|
||||||
|
for (auto & c : pm)
|
||||||
|
c = to_srgb(c, g);
|
||||||
|
return pm;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Pixel, std::size_t N>
|
||||||
|
auto to_linear(util::array<Pixel, N> pm, float g = 1.f / 2.2f)
|
||||||
|
{
|
||||||
|
return to_srgb(std::move(pm), 1.f / g);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue