示例#1
0
        /// <summary>
        /// Finalizes the color by appliing the overall brightness and opacity.<br/>
        /// This method should always be the last call of a <see cref="GetColorAtPoint" /> implementation.
        /// </summary>
        /// <param name="color">The color to finalize.</param>
        /// <returns>The finalized color.</returns>
        protected virtual Color FinalizeColor(Color color)
        {
            if (ColorCorrections.Count > 0)
            {
                foreach (IColorCorrection colorCorrection in ColorCorrections)
                {
                    color = colorCorrection.ApplyTo(color);
                }
            }

            // Since we use HSV to calculate there is no way to make a color 'brighter' than 100%
            // Be carefull with the naming: Since we use HSV the correct term is 'value' but outside we call it 'brightness'
            // THIS IS NOT A HSB CALCULATION!!!
            if (Brightness < 1)
            {
                color = color.MultiplyHSV(value: Brightness.Clamp(0, 1));
            }

            if (Opacity < 1)
            {
                color = color.MultiplyA(Opacity.Clamp(0, 1));
            }

            return(color);
        }