This commit is contained in:
TinyHerm committed 2026-11-24 23:40:08 +03:00
commit 1c7a8cf25f
579 files changed
+83196

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
using System;
namespace VibranceHud;
public static class GammaCurve
{
public const int Entries = 256;
public static ushort[] Build(float gamma)
{
if (gamma <= 0f)
{
gamma = 1f;
}
ushort[] array = new ushort[768];
double y = 1.0 / (double)gamma;
for (int i = 0; i < 256; i++)
{
array[512 + i] = (array[256 + i] = (array[i] = (ushort)Math.Clamp(Math.Round(Math.Pow((double)i / 255.0, y) * 65535.0), 0.0, 65535.0)));
}
return array;
}
public static ushort[] Identity()
{
return Build(1f);
}
}