Colour::brighter()


#1

Is there any reason why Colour::brighter handles black in the form

    amount += 1.0f;
    if (getRed() + getGreen() + getBlue() == 0)
    {
        const uint8 lev = (uint8) roundFloatToInt (0x50 * amount);
        return Colour (lev, lev, lev, getAlpha());
    }

rather than say:

    amount += 1.0f;
    if (getRed() + getGreen() + getBlue() == 0)
    {
        const uint8 lev = (uint8) roundFloatToInt ((0x80 * amount) - 0x80); 
        return Colour (lev, lev, lev, getAlpha());
    }

'cos it seems that the current method makes the smallest increment on black somewhere around 40% brighter.


#2

Yeah, that’s pretty old code - I’ll take a look at tidying it up a bit. I’d recommend using the withMultipliedBrightness() method instead, TBH.


#3