1
0
mirror of https://github.com/DarthAffe/CUE.NET.git synced 2025-12-12 08:48:30 +00:00

Fixed stupid bug in the order of applying gamma-correction and brightness/alpha-values

This commit is contained in:
Darth Affe 2016-12-11 16:27:54 +01:00
parent 1b4af74b14
commit eb3f92d7b0

View File

@ -117,15 +117,15 @@ namespace CUE.NET.Brushes
/// <returns>The finalized color.</returns>
protected virtual CorsairColor FinalizeColor(CorsairColor color)
{
if (Math.Abs(Gamma - 1f) > float.Epsilon)
ColorHelper.CorrectGamma(color, Gamma);
// Since we use HSV to calculate there is no way to make a color 'brighter' than 100%
// Be carefull with the naming: Since we use HSV the correct term is 'value' but outside we call it 'brightness'
// THIS IS NOT A HSB CALCULATION!!!
float finalBrightness = color.GetHSVValue() * (Brightness < 0 ? 0 : (Brightness > 1f ? 1f : Brightness));
byte finalAlpha = (byte)(color.A * (Opacity < 0 ? 0 : (Opacity > 1f ? 1f : Opacity)));
if (Math.Abs(Gamma - 1f) > float.Epsilon)
ColorHelper.CorrectGamma(color, Gamma);
return ColorHelper.ColorFromHSV(color.GetHSVHue(), color.GetHSVSaturation(), finalBrightness, finalAlpha);
}