Exemple #1
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            UnityEngine.Color col1      = SourceModule.GetColour(x, y);
            float             satChange = (float)SaturationModule.GetValue(x, y);

            // Read hsl:
            float h = col1.r;
            float s = col1.g;
            float l = col1.b;

            HslRgb.ToHsl(ref h, ref s, ref l);

            // Boost sat:
            s *= (1f + satChange);

            // Back to colour:
            HslRgb.ToRgb(ref h, ref s, ref l);

            // Now RGB:
            col1.r = h;
            col1.g = s;
            col1.b = l;

            return(col1);
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            UnityEngine.Color col1             = SourceModule.GetColour(x, y);
            float             brightnessChange = (float)BrightnessModule.GetValue(x, y);

            // Read hsl:
            float h = col1.r;
            float s = col1.g;
            float l = col1.b;

            HslRgb.ToHsl(ref h, ref s, ref l);

            // Boost brightness:
            l *= 1f + brightnessChange;

            // Back to colour:
            HslRgb.ToRgb(ref h, ref s, ref l);

            // Now RGB:
            col1.r = h;
            col1.g = s;
            col1.b = l;

            return(col1);
        }
Exemple #3
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            UnityEngine.Color col1      = SourceModule.GetColour(x, y);
            float             hueChange = (float)HueModule.GetValue(x, y);

            // Read hsl:
            float h = col1.r;
            float s = col1.g;
            float l = col1.b;

            HslRgb.ToHsl(ref h, ref s, ref l);

            // Cycle the hue:
            h = (h + hueChange) % 1f;

            // Back to colour:
            HslRgb.ToRgb(ref h, ref s, ref l);

            // Now RGB:
            col1.r = h;
            col1.g = s;
            col1.b = l;

            return(col1);
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            UnityEngine.Color col1      = SourceModule.GetColour(x, y);
            float             hueChange = (float)HueModule.GetValue(x, y);
            float             satChange = (float)SatModule.GetValue(x, y);
            float             lumChange = (float)LumModule.GetValue(x, y);

            // Read hsl:
            float h = col1.r;
            float s = col1.g;
            float l = col1.b;

            HslRgb.ToHsl(ref h, ref s, ref l);

            // Boost all 3:
            h  = (h + hueChange) % 1f;
            s *= 1f + satChange;
            l *= 1f + lumChange;

            // Back to colour:
            HslRgb.ToRgb(ref h, ref s, ref l);

            // Now RGB:
            col1.r = h;
            col1.g = s;
            col1.b = l;

            return(col1);
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read:
            Color colour = SourceModule.GetColour(x, y);

            // Get:
            float channel = HslRgb.Saturation(colour.r, colour.g, colour.b);

            return(new Color(channel, channel, channel, 1f));
        }
        public override double GetValue(double x, double y)
        {
            // Read:
            Color colour = SourceModule.GetColour(x, y);

            // Get:
            float channel = HslRgb.Saturation(colour.r, colour.g, colour.b);

            return(channel);
        }
        public override double GetWrapped(double x, double y, int wrap)
        {
            // Read:
            Color colour = SourceModule.GetColour(x, y);

            // Get:
            float channel = HslRgb.Luminance(colour.r, colour.g, colour.b);

            return(channel);
        }
Exemple #8
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read H:
            float h = (float)HueModule.GetValue(x, y);

            // Read S:
            float s = (float)SaturationModule.GetValue(x, y);

            // Read L:
            float l = (float)LumModule.GetValue(x, y);

            // Convert to RGB:
            HslRgb.ToRgb(ref h, ref s, ref l);

            // Now RGB.
            return(new Color(h, s, l, 1f));
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Base colour is..
            UnityEngine.Color col1 = SourceModule.GetColour(x, y);

            // Map to HSL:
            float r = col1.r;
            float g = col1.g;
            float b = col1.b;

            HslRgb.ToHsl(ref r, ref g, ref b);

            // RGB is now HSL.


            // Get a H range value:
            double hPoint = PerlinH.GetValue(x, y);

            // Get an S range value:
            double sPoint = PerlinS.GetValue(x, y);

            // Get an L range value:
            double lPoint = PerlinL.GetValue(x, y);

            // Read ranges:
            double halfHRange = RangeHModule.GetValue(x, y) * 0.5;
            double halfSRange = RangeSModule.GetValue(x, y) * 0.5;
            double halfLRange = RangeLModule.GetValue(x, y) * 0.5;

            // Slightly awkward naming here; this is all currently in HSL.
            // Map the hsl into the available range:
            r = r + (float)(halfHRange * hPoint);
            g = g + (float)(halfSRange * sPoint);
            b = b + (float)(halfLRange * lPoint);

            // Map to RGB:
            HslRgb.ToRgb(ref r, ref g, ref b);

            return(new UnityEngine.Color(r, g, b, col1.a));
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            UnityEngine.Color col1 = SourceModule.GetColour(x, y);
            float             result;

            switch (Method)
            {
            case DesaturateMethod.YChannel:                     // HSY model

                result = HsyRgb.Luminance(col1.r, col1.g, col1.b);

                break;

            case DesaturateMethod.LChannel:                     // HSL model

                result = HslRgb.Luminance(col1.r, col1.g, col1.b);

                break;

            case DesaturateMethod.VChannel:                     // HSV model

                result = HsvRgb.Luminance(col1.r, col1.g, col1.b);

                break;

            default:
            case DesaturateMethod.Greyscale:                     // Greyscale RGB average

                result = (col1.r + col1.g + col1.b) / 3f;

                break;
            }

            // Grey colour:
            return(new Color(result, result, result, col1.a));
        }