TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ hslToRgb() [1/2]

static Color Terraria.Main.hslToRgb ( float Hue,
float Saturation,
float Luminosity,
byte a = byte::MaxValue )
inlinestatic

Definition at line 61856 of file Main.cs.

61857 {
61858 //IL_00f4: Unknown result type (might be due to invalid IL or missing references)
61859 byte r;
61860 byte g;
61861 byte b;
61862 if (Saturation == 0f)
61863 {
61864 r = (byte)Math.Round((double)Luminosity * 255.0);
61865 g = (byte)Math.Round((double)Luminosity * 255.0);
61866 b = (byte)Math.Round((double)Luminosity * 255.0);
61867 }
61868 else
61869 {
61870 double num3 = Hue;
61871 double num2 = ((!((double)Luminosity < 0.5)) ? ((double)(Luminosity + Saturation - Luminosity * Saturation)) : ((double)Luminosity * (1.0 + (double)Saturation)));
61872 double t = 2.0 * (double)Luminosity - num2;
61873 double c = num3 + 1.0 / 3.0;
61874 double c2 = num3;
61875 double c3 = num3 - 1.0 / 3.0;
61876 c = hue2rgb(c, t, num2);
61877 c2 = hue2rgb(c2, t, num2);
61878 double num4 = hue2rgb(c3, t, num2);
61879 r = (byte)Math.Round(c * 255.0);
61880 g = (byte)Math.Round(c2 * 255.0);
61881 b = (byte)Math.Round(num4 * 255.0);
61882 }
61883 return new Color((int)r, (int)g, (int)b, (int)a);
61884 }
static double hue2rgb(double c, double t1, double t2)
Definition Main.cs:61886

References Terraria.Graphics.Light.Color, and Terraria.Main.hue2rgb().

+ Here is the call graph for this function: