Skip to content
Dejan edited this page Jul 14, 2017 · 6 revisions

Formats

Internal memory representation of color can vary from format to format

  • Three consecutive float, double, std::uint8_t, std::uint16_t, ...

    By design there is guarantee that representation of color in memory will be three consecutive requested types.

    ::color::rgb<std::uint8_t>  a; //!< Component: std::uint8_t, first is red, then green and blue at the end.
    ::color::hsl<std::uint16_t> b; //!< Component: std::uint16_t, first is hue then saturation and lightens at the end. 
    ::color::yuv<std::uint32_t> c; //!< Component: std::uint32_t, first is y, then u and v at the end. 
    ::color::yiq<std::uint64_t> d; //!< Component: std::uint64_t, first is y, then i and q at the end. 
    
    ::color::hsv<float>        e;  //!< Component: float
    ::color::cmy<double>       f;  //!< Component: double
    ::color::cmyk<long double> g;  //!< Component: long double
  • Use std::uint8_t, std::uint16_t, std::uint32_t or std::uint64_t as data container.

    ::color::rgb<::color::type::split233_t> a; // Container: std::uint8_t,  lowest 2 - red, 3 - green, highest 3 - blue
    ::color::rgb<::color::type::split422_t> b; // Container: std::uint8_t,  lowest 4 - red, 2 - green, highest 2 - blue
    ::color::rgb<::color::type::split556_t> c; // Container: std::uint16_t, lowest 5 - red, 5 - green, highest 6 - blue
Clone this wiki locally