示例#1
0
        /* Filter a pixel based on some parameters and return a color value */
        public override HColor FilterPixel(HColor source)
        {
            HSVA pixel = HueSaturationValue.ColorToHSV(source);

            pixel.h = (pixel.h + mHSVA.h) % 360;
            pixel.s = Mathf.Clamp01(pixel.s + mHSVA.s);
            pixel.v = Mathf.Clamp01(pixel.v * mHSVA.v);
            pixel.a = Mathf.Clamp01(pixel.a * mHSVA.a);

            return(HueSaturationValue.HSVToHColor(pixel));
        }
示例#2
0
        /* Filter a pixel based on some parameters and return a color value */
        public override HColor FilterPixel(HColor source)
        {
            HSVA pixel = HueSaturationValue.ColorToHSV(source);

            /* Set the source pixel Hue */
            pixel.h = mHSVA.h;

            pixel.s = pixel.s * mHSVA.s;
            pixel.v = pixel.v * mHSVA.v;

            /* Apply alpha as a multiplier */
            pixel.a *= mHSVA.a;

            return(HueSaturationValue.HSVToHColor(pixel));
        }
        /* Filter a pixel based on some parameters and return a color value */
        public override HColor FilterPixel(HColor source)
        {
            HSVA pixel = HueSaturationValue.ColorToHSV(source);

            /* Set the source pixel Hue */
            pixel.h = mHSVA.h;

            /*
             *      Assume the source pixel has saturation 1 and subtract inverse of saturation from it
             *      This subtractive process will not saturate white pixels like highlites
             */
            pixel.s = Mathf.Clamp01(pixel.s - (1 - mHSVA.s));

            /*
             *      Use the value as an exponent to darken pixels
             *      This method does not darken white pixels ( to maintain highlights )
             */
            pixel.v = Mathf.Clamp01(Mathf.Pow(pixel.v, 1 + (1 - (mHSVA.v)) * 2.5f));

            /* Apply alpha as a multiplier */
            pixel.a *= mHSVA.a;

            return(HueSaturationValue.HSVToHColor(pixel));
        }