#pragma once #include #include #include #include #include namespace pixel { struct Pixel { std::uint8_t red{}; std::uint8_t green{}; std::uint8_t blue{}; bool operator==(const Pixel&) const = default; }; enum class ChannelError { non_finite, outside_unit_interval }; struct PixelError { std::size_t channel; ChannelError reason; }; [[nodiscard]] std::string_view describe(ChannelError error) noexcept; // An intentionally bounded SDR example using a gamma-2 approximation, not sRGB. [[nodiscard]] std::expected encode_channel(double linear); [[nodiscard]] std::expected prepare_pixel(std::array linear); // Intentional in-out operation: replace only after all three channels succeed. [[nodiscard]] std::expected replace_pixel( Pixel& current, std::array linear); }