Reference
pixels
template<typename T, std::size_t N>
struct basic_pixel;
template<typename T>
struct basic_pixel<T, 1>
{
public:
using value_type = T;
static constexpr std::size_t colors = 1;
basic_pixel() = default;
~basic_pixel() = default;
basic_pixel(const basic_pixel&) = default;
basic_pixel(basic_pixel&&) = default;
basic_pixel& operator=(const basic_pixel&) = default;
basic_pixel& operator=(basic_pixel&&) = default;
// noexcept if T is nothrow constructible
basic_pixel(const value_type& v);
basic_pixel(value_type&& v);
value_type value;
};
template<typename T>
struct basic_pixel<T, 3>
{
public:
using value_type = T;
static constexpr std::size_t colors = 3;
basic_pixel() = default;
~basic_pixel() = default;
basic_pixel(const basic_pixel&) = default;
basic_pixel(basic_pixel&&) = default;
basic_pixel& operator=(const basic_pixel&) = default;
basic_pixel& operator=(basic_pixel&&) = default;
// noexcept if T is nothrow constructible
basic_pixel(const value_type& R, const value_type& G, const value_type& B);
basic_pixel(value_type&& R, value_type&& G, value_type&& B);
basic_pixel(const std::array<value_type, 3>& values);
value_type red;
value_type green;
value_type blue;
};
using bit_pixel = basic_pixel<bool, 1>;
using gray_pixel = basic_pixel<std::uint8_t, 1>;
using rgb_pixel = basic_pixel<std::uint8_t, 3>;
namespace literals
{
inline namespace pixel_literals
{
bit_pixel operator"" _bit (unsigned long long x);
gray_pixel operator"" _gray(unsigned long long x);
rgb_pixel operator"" _rgb (unsigned long long x);
}
}
template<typename T> struct is_pixel;
template<typename From, typename To> struct is_narrowing_conversion;
template<typename ToPixel, typename FromPixel>
ToPixel convert_to(FromPixel&& pixel);images
IO
Last updated