1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Colour: Remove restrictions on argument to brighter() and darker()

This commit is contained in:
reuk 2021-06-29 16:47:41 +01:00
parent 407966b2ca
commit dcd2ef93f9
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
2 changed files with 6 additions and 6 deletions

View file

@ -460,7 +460,7 @@ Colour Colour::withMultipliedLightness (float amount) const noexcept
//==============================================================================
Colour Colour::brighter (float amount) const noexcept
{
jassert (0.0f <= amount && amount <= 1.0f);
jassert (amount >= 0.0f);
amount = 1.0f / (1.0f + amount);
return Colour ((uint8) (255 - (amount * (255 - getRed()))),
@ -471,7 +471,7 @@ Colour Colour::brighter (float amount) const noexcept
Colour Colour::darker (float amount) const noexcept
{
jassert (0.0f <= amount && amount <= 1.0f);
jassert (amount >= 0.0f);
amount = 1.0f / (1.0f + amount);
return Colour ((uint8) (amount * getRed()),

View file

@ -351,15 +351,15 @@ public:
//==============================================================================
/** Returns a brighter version of this colour.
@param amountBrighter how much brighter to make it - a value from 0 to 1.0 where 0 is
unchanged, and higher values make it brighter
@param amountBrighter how much brighter to make it - a value greater than or equal to 0,
where 0 is unchanged, and higher values make it brighter
@see withMultipliedBrightness
*/
Colour brighter (float amountBrighter = 0.4f) const noexcept;
/** Returns a darker version of this colour.
@param amountDarker how much darker to make it - a value from 0 to 1.0 where 0 is
unchanged, and higher values make it darker
@param amountDarker how much darker to make it - a value greater than or equal to 0,
where 0 is unchanged, and higher values make it darker
@see withMultipliedBrightness
*/
Colour darker (float amountDarker = 0.4f) const noexcept;