SparrowSharp.Filters.ColorMatrix.AdjustContrast C# (CSharp) Method

AdjustContrast() public method

Changes the contrast. Typical values are in the range [-1, 1]. Values above zero will raise, values below zero will reduce the contrast.
public AdjustContrast ( float contrast ) : void
contrast float
return void
        public void AdjustContrast(float contrast)
        {
            float s = contrast + 1.0f;
            float o = 128 * (1.0f - s);

            float[] mtx =
            {
                s, 0, 0, 0, o,
                0, s, 0, 0, o,
                0, 0, s, 0, o,
                0, 0, 0, s, 0
            };

            ConcatMatrix(this, mtx);
        }