Пример #1
0
        /// <summary>
        /// Merges two <see cref="GammaPalette"/> values together, merging the foreground value with the background value by a specified strength.
        /// </summary>
        public static GammaPalette Merge(GammaPalette background, GammaPalette foreground, float strength)
        {
            List <ImmutableColor> colors = new List <ImmutableColor>();

            for (int g = 0; g < RequiredLength; g++)
            {
                colors.Add(ImmutableColor.Blend(background.Values[g], foreground.Values[g], strength));
            }

            return(new GammaPalette(colors.ToArray()));
        }
Пример #2
0
        /// <summary>
        /// Smears two <see cref="GammaPalette"/> values together, slowly transitioning the primary palette to the secondary palette.
        /// </summary>
        public static GammaPalette Smear(GammaPalette a, GammaPalette b)
        {
            var colors = new List <ImmutableColor>();

            float mergeStrength = 1.0f / (RequiredLength - 1);

            for (int g = 0; g < RequiredLength; g++)
            {
                var strength = mergeStrength * g;

                //if (g == 0)
                //    strength = 0.1f;

                colors.Add(ImmutableColor.Blend(a[g], b[g], strength));
            }

            return(new GammaPalette(colors.ToArray()));
        }