mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-16 00:34:19 +00:00
Correctly scale saturation value to 0-1 in HSL Colour constructor
This commit is contained in:
parent
b59d40b056
commit
f9f83fe3fa
1 changed files with 3 additions and 1 deletions
|
|
@ -84,7 +84,7 @@ namespace ColourHelpers
|
|||
if (lightness > 0.0f)
|
||||
hue = getHue (col);
|
||||
|
||||
saturation = (float) (hi - lo) / (1.0f - std::abs ((2.0f * lightness) - 1.0f));
|
||||
saturation = ((float) (hi - lo) / 255.0f) / (1.0f - std::abs ((2.0f * lightness) - 1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -691,6 +691,8 @@ public:
|
|||
testColour (red.withMultipliedSaturationHSL (0.0f), 128, 128, 128);
|
||||
testColour (red.withMultipliedBrightness (0.5f), 128, 0, 0);
|
||||
testColour (red.withMultipliedLightness (2.0f), 255, 255, 255);
|
||||
testColour (red.withMultipliedLightness (1.0f), 255, 0, 0);
|
||||
testColour (red.withLightness (red.getLightness()), 255, 0, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue