mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2026-11-11 04:56:44 +00:00
Added gamma-value to brushes to allow a simple color correction
This commit is contained in:
1 parent
17d05d9527
commit
1b4af74b14
3 files changed
+37
-1
No files matched your search
@@ -99,6 +99,23 @@ namespace CUE.NET.Helper
|
||||
|
||||
#endregion
|
||||
|
||||
#region Color-Correction
|
||||
|
||||
/// <summary>
|
||||
/// Corrects the color using the specified gamma.
|
||||
/// </summary>
|
||||
/// <param name="color">The color to correct.</param>
|
||||
/// <param name="gamma">The gamma value to apply.</param>
|
||||
public static void CorrectGamma(CorsairColor color, float gamma)
|
||||
{
|
||||
double value = 1.0 / gamma;
|
||||
color.R = GetIntColorFromFloat((float)Math.Pow(color.GetFloatR(), value));
|
||||
color.G = GetIntColorFromFloat((float)Math.Pow(color.GetFloatG(), value));
|
||||
color.B = GetIntColorFromFloat((float)Math.Pow(color.GetFloatB(), value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RGB/HSV conversion
|
||||
// https://en.wikipedia.org/wiki/HSL_and_HSV
|
||||
|
||||
|
||||
Reference in new issue
Block a user