86    static const std::vector<COLOR_SCALAR_CASE> cases = {
 
   87        { { 0.0, 0.25, 1.0, 1.0 }, 0.0, { 1.0, 0.75, 0.0, 1.0 } },
 
   90    for( 
const auto& c : cases )
 
   94        const auto inverted = col.Inverted();
 
 
  109    static const std::vector<COLOR_SCALAR_CASE> cases = {
 
  110        { { 0.0, 0.0, 0.0, 1.0 }, 0.5, { 0.5, 0.5, 0.5, 1.0 } },
 
  111        { { 0.0, 0.5, 1.0, 1.0 }, 0.5, { 0.5, 0.75, 1.0, 1.0 } },
 
  114    for( 
const auto& c : cases )
 
  118        const auto brightened = col.Brightened( c.factor );
 
  122        col.Brighten( c.factor );
 
 
  133    static const std::vector<COLOR_SCALAR_CASE> cases = {
 
  134        { { 0.0, 0.0, 0.0, 1.0 }, 0.5, { 0.0, 0.0, 0.0, 1.0 } },
 
  135        { { 1.0, 1.0, 1.0, 1.0 }, 0.5, { 0.5, 0.5, 0.5, 1.0 } },
 
  138    for( 
const auto& c : cases )
 
  142        const auto brightened = col.Darkened( c.factor );
 
  146        col.Darken( c.factor );
 
 
  157    static const std::vector<COLOR_SCALAR_CASE> cases = {
 
  158        { { 0.0, 0.0, 0.0, 1.0 }, 0.5, { 0.0, 0.0, 0.0, 0.5 } },
 
  159        { { 0.0, 0.5, 1.0, 1.0 }, 0.5, { 0.0, 0.5, 1.0, 0.5 } },
 
  162    for( 
const auto& c : cases )
 
  166        const auto with_alpha = col.WithAlpha( c.factor );
 
 
  191    static const std::vector<FROM_HSV_TO_HEX_CASE> cases = {
 
  192        {  10, 0.71, 0.66, 168,  69,  49 },
 
  193        {  15, 0.96, 0.34,  87,  24,   3 },
 
  194        { 120, 0.50, 0.50,  64, 128,  64 },
 
  195        { 190, 0.32, 0.97, 168, 234, 247 },
 
  196        { 240, 0.15, 0.75, 163, 163, 191 },
 
  197        { 240, 0.90, 0.75,  19,  19, 191 },
 
  198        { 310, 0.71, 0.66, 168,  49, 148 },
 
  199        { 331, 0.15, 0.85, 217, 184, 200 },
 
  202    for( 
const auto& c : cases )
 
  206        double new_h, new_s, new_v;
 
  207        col.ToHSV( new_h, new_s, new_v );
 
  208        const unsigned char alpha = 0xFF;
 
  211        BOOST_CHECK_CLOSE( c.h, new_h, 0.0001 );
 
  212        BOOST_CHECK_CLOSE( c.s, new_s, 0.0001 );
 
  213        BOOST_CHECK_CLOSE( c.v, new_v, 0.0001 );
 
 
  233    static const std::vector<FROM_HSL_TO_HEX_CASE> cases = {
 
  234        {  10, 0.71, 0.66, 230, 127, 107 },
 
  235        {  15, 0.96, 0.34, 170,  45,   3 },
 
  236        { 120, 0.5,  0.5,   64, 191,  64 },
 
  237        { 190, 0.32, 0.97, 245, 249, 250 },
 
  238        { 240, 0.15, 0.75, 182, 182, 201 },
 
  239        { 240, 0.90, 0.75, 134, 134, 249 },
 
  240        { 310, 0.71, 0.66, 230, 107, 209 },
 
  241        { 331, 0.15, 0.85, 222, 211, 217 },
 
  244    for( 
const auto& c : cases )
 
  248        double new_h, new_s, new_l;
 
  249        col.ToHSL( new_h, new_s, new_l );
 
  250        const unsigned char alpha = 0xFF;
 
  253        BOOST_CHECK_CLOSE( c.h, new_h, 0.0001 );
 
  254        BOOST_CHECK_CLOSE( c.s, new_s, 0.0001 );
 
  255        BOOST_CHECK_CLOSE( c.l, new_l, 0.0001 );
 
 
  268    { { 0x00, 0x00, 0x00, 0x00 }, { 0.0, 0.0, 0.0, 0.0 } },
 
  269    { { 0x66, 0x80, 0x99, 0xB3 }, { 0.4, 0.5, 0.6, 0.7 } },
 
  270    { { 0xFF, 0xFF, 0xFF, 0xFF }, { 1.0, 1.0, 1.0, 1.0 } },
 
  271    { { 0xFF, 0x00, 0x00, 0xFF }, { 0.999, 0.001, 0.0, 1.0 } },
 
 
void FromHSV(double aInH, double aInS, double aInV)
Changes currently used color to the one given by hue, saturation and value parameters.
 
void FromHSL(double aInHue, double aInSaturation, double aInLightness)
Change currently used color to the one given by hue, saturation and lightness parameters.
 
bool IsColorNearHex(const KIGFX::COLOR4D &aCol, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Checks if a COLOR4D is close enough to a given RGB char value.
 
BOOST_CHECK_EQUAL(result, "25.4")