Status: Very close to the first milestone.
Key features:
- No virtual functions
- Minimal memory footprint
- Ability to copy array/vector of colours with memcpy, memmove, initialize with memset.
- Conversions from/to different types ( and its formats ).
- Headers only
- No third parties
- No additional binaries
- One file to include to start the fun
- Out of the box ready
- No need to recompile or start some install process.
- Color models: CMY, CMYK, GRAY, HSL, HSV, RGB, XYZ, YIQ, YUV.
Code sample:
color::rgb<float> f( { 1.0, 0.55, 0.0 } ); //!< This will pack ONLY three consecutive floats in memory
color::rgb<std::uint8_t> u( { 127, 255, 212 } ); //!< Three consecutive std::uint8_t.
f = u; //!< Perform direct conversion from uint8_t to float.
color::rgb<double> d( { 0.1, 0.2, 0.3 } );
f = d; //!< Reformat RGB from double to float
u = f; //!< Reformat RGB from float to uint8_t
color::hsl<std::uint8_t> h( { 192, 64, 92 } );
h = f; //!< This is the way how to convert from RGB(float) to HSL(std::uint8_t).
Implemented Conversions:
l = r cmy cmyk gray hsl hsv rgb xyz yiq yuv cmy ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ cmyk ✅ ✅ ✅ ✅ gray ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ hsl ✅ ✅ ✅ ✅ ✅ hsv ✅ ✅ ✅ ✅ ✅ rgb ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ xyz ✅ ✅ yiq ✅ ✅ ✅ ✅ yuv ✅ ✅ ✅ ✅
Available Color Formats
- bool
- Each component is one bool.
- uint8_t
- Each component will be type uint8_t. Usual color storing precision.
- uint16_t
- Each component will be type uint16_t. For more precision.
- uint32_t
- Each component will be type uint32_t. For higher.
- uint64_t
- Each component will be type uint64_t.For the highest precision in unsigned format.
- float
- Each component will be type float.
- double
- Each component will be type double.
- long double
- Each component will be type long double. Best precision of all.