Add a contrast transformation

@param float $alpha Adjusts intensity differences between lighter and darker elements
@param float $beta Where the midpoint of the gradient will be. Range: 0 to 1
@return self
546307
public function contrast($alpha = null, $beta = null) {
        $params = array();

        if ($alpha !== null) {
            $params[] = 'alpha=' . (float) $alpha;
        }

        if ($beta !== null) {
            $params[] = 'beta=' . (float) min(1, max(0, $beta));
        }

        return $this->addTransformation(
            'contrast' . ($params ? ':' . implode(',', $params) : '')
        );
    }
673052
public function setAlpha(float $alpha, float $scale = 1.)
    {
        $this->alpha = $this->setComponent($alpha, $scale);
        return $this;
    }
64739
function(color, alpha) {
            color = color.toRGB();
            alpha = Math.min(Math.max(alpha, 0), 1);
            var rgb = this.clone();

            rgb.red = (rgb.red * (1 - alpha)) + (color.red * alpha);
            rgb.green = (rgb.green * (1 - alpha)) + (color.green * alpha);
            rgb.blue = (rgb.blue * (1 - alpha)) + (color.blue * alpha);
            rgb.alpha = (rgb.alpha * (1 - alpha)) + (color.alpha * alpha);

            return rgb;
        }
893001
public function colorize($color, $opacity)
    {
        $rgb = $this->hex2rgb($color);
        $alpha = $this->keep_within(127 - (127 * $opacity), 0, 127);
        imagefilter($this->image, IMG_FILTER_COLORIZE, $this->keep_within($rgb['r'], 0, 255), $this->keep_within($rgb['g'], 0, 255), $this->keep_within($rgb['b'], 0, 255), $alpha);

        return $this;
    }
715194
public void setBeta(javax.el.ValueExpression _beta) {
		getStateHelper().put(PropertyKeys.beta, _beta);
	}
380453
public static double regularizedIncompleteBetaFunction(double alpha, double beta, double x) {
        if (x < 0.0 || x > 1.0) {
            throw new IllegalArgumentException("Invalid x: " + x);
        }

        double ibeta = 0.0;
        if (x == 0.0) {
            ibeta = 0.0;
        } else {
            if (x == 1.0) {
                ibeta = 1.0;
            } else {
                // Term before continued fraction
                ibeta = Math.exp(Gamma.lgamma(alpha + beta) - Gamma.lgamma(alpha) - Gamma.lgamma(beta) + alpha * Math.log(x) + beta * Math.log(1.0D - x));
                // Continued fraction
                if (x < (alpha + 1.0) / (alpha + beta + 2.0)) {
                    ibeta = ibeta * incompleteFractionSummation(alpha, beta, x) / alpha;
                } else {
                    // Use symmetry relationship
                    ibeta = 1.0 - ibeta * incompleteFractionSummation(beta, alpha, 1.0 - x) / beta;
                }
            }
        }
        return ibeta;
    }
911247
@Override
    public void load(boolean alpha)
    {
        ImageBuffer surface = Graphics.getImageBuffer(media);

        if (0 != Double.compare(factorH, 1.0) || 0 != Double.compare(factorV, 1.0))
        {
            final int x = (int) (surface.getWidth() * factorH);
            final int y = (int) (surface.getHeight() * factorV);
            surface = Graphics.resize(surface, x, y);
        }

        lineWidth = (int) Math.floor(surface.getWidth() * sx / 100.0);
        lineHeight = (int) Math.floor(surface.getHeight() / (double) linesNumber * sy / 100.0);
        lines = Graphics.splitImage(surface, 1, linesNumber);

        final double factH = sx / 100.0 / AMPLITUDE_FACTOR;

        for (int i = 0; i < linesNumber; i++)
        {
            final int width = (int) Math.ceil(lines[i].getWidth() * (sx + i * 2 * factH) / 100);
            final int height = lines[i].getHeight() * sy / 100;
            lines[i] = Graphics.resize(lines[i], width, height);
        }
    }
1025034
public static void setTransparency(Element elem, int alpha) {

        float ieVersion = getIEVersion();
        // only IE 8 requires special treatment, older IE versions are no longer supported
        if (ieVersion < 9.0) {
            elem.getStyle().setProperty(
                "-ms-filter",
                "\"progid:DXImageTransform.Microsoft.Alpha(opacity=" + alpha + ")\"");
        } else {
            // Everyone else
            elem.getStyle().setOpacity((1.0 * alpha) / 100);
        }
    }
1079911
function( element, opacity, usesAlpha ) {

            var ieOpacity,
                ieFilter;

            element = $.getElement( element );

            if ( usesAlpha && !$.Browser.alpha ) {
                opacity = Math.round( opacity );
            }

            if ( $.Browser.opacity ) {
                element.style.opacity = opacity < 1 ? opacity : "";
            } else {
                if ( opacity < 1 ) {
                    ieOpacity = Math.round( 100 * opacity );
                    ieFilter  = "alpha(opacity=" + ieOpacity + ")";
                    element.style.filter = ieFilter;
                } else {
                    element.style.filter = "";
                }
            }
        }
274555
private function setGlowColor($color, $alpha, $type)
    {
        $this->glowProperties['color'] = $this->setColorProperties($color, $alpha, $type);

        return $this;
    }
428452
private void drawPreviousShadow(Canvas canvas) {
		final float degreesFlipped = getDegreesFlipped();
		if (degreesFlipped > 90) {
			final int alpha = (int) (((degreesFlipped - 90) / 90f) * MAX_SHADOW_ALPHA);
			mShadowPaint.setAlpha(alpha);
			canvas.drawPaint(mShadowPaint);
		}
	}
416658
public function brighter($shade = 0.7)
    {
        $r = $this->getRed();
        $g = $this->getGreen();
        $b = $this->getBlue();
        $alpha = $this->getAlpha();

        $i = (integer) (1.0 / (1.0 - $shade));

        if ($r == 0 && $g == 0 && $b == 0) {
            return new self($i, $i, $i, $alpha);
        }

        if ($r > 0 && $r < $i)
            $r = $i;
        if ($g > 0 && $g < $i)
            $g = $i;
        if ($b > 0 && $b < $i)
            $b = $i;

        return $this->setFromArray(array(
                    min(array((integer) ($r / $shade), 255))
                    , min(array((integer) ($g / $shade), 255))
                    , min(array((integer) ($b / $shade), 255))
                    , $alpha
        ));
    }
830443
public function alpha($error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::ALPHA, 'message' => $error]);
        }

        return $this;
    }
920952
public void setBeta(double beta)
    {
        if(beta <= 0 || beta >= 1 || Double.isNaN(beta))
            throw new IllegalArgumentException("shrinkage term must be in (0, 1), not " +  beta);
        this.beta = beta;
    }
327314
public function contrast($val='+')
	{
		if ( $this->test() )
		{
			if ( class_exists('\\Imagick') )
			{
				$p = ( $val == '-' ) ? 0 : 1;
				if ( !$this->img->contrastImage($p) ){
					$this->error = \defined('BBN_THERE_HAS_BEEN_A_PROBLEM') ?
						BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem';
				}
			}
			else if ( function_exists('imagefilter') )
			{
				$p = ( $val == '-' ) ? -20 : 20;
				if ( !imagefilter($this->img,IMG_FILTER_CONTRAST,-20) ){
					$this->error = \defined('BBN_THERE_HAS_BEEN_A_PROBLEM') ?
						BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem';
				}
			}
		}
		return $this;
	}
893543
function(obj, alpha)
              {
                obj.css({ visibility: alpha > 0 ? 'visible' : 'hidden' });
                if (alpha > 0 && alpha < 100)
                {
                  if (isLessThanIE7)
                  {
                    var src = obj.attr('pngSrc');
                    if (src != null && (src.indexOf('AlphaBar.png') != -1 || src.indexOf('Bars.png') != -1 || src.indexOf('Maps.png') != -1))
                      obj.css({ filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + src + '\', sizingMethod=\'scale\') progid:DXImageTransform.Microsoft.Alpha(opacity=' + alpha + ')' });
                    else obj.css({ opacity: Math.precision(alpha / 100, 4) });
                  }
                  else obj.css({ opacity: Math.precision(alpha / 100, 4) });
                }
                else if (alpha == 0 || alpha == 100)
                {
                  if (isLessThanIE7)
                  {
                    var src = obj.attr('pngSrc');
                    if (src != null && (src.indexOf('AlphaBar.png') != -1 || src.indexOf('Bars.png') != -1 || src.indexOf('Maps.png') != -1))
                      obj.css({ filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + src + '\', sizingMethod=\'scale\')' });
                    else obj.css({ opacity: '' });
                  }
                  else obj.css({ opacity: '' });
                }
              }
46633
public static double inverseRegularizedIncompleteBetaFunction(double alpha, double beta, double p) {
        final double EPS = 1.0E-8;

        double pp, t, u, err, x, al, h, w, afac;
        double a1 = alpha - 1.;
        double b1 = beta - 1.;

        if (p <= 0.0) {
            return 0.0;
        }

        if (p >= 1.0) {
            return 1.0;
        }

        if (alpha >= 1. && beta >= 1.) {
            pp = (p < 0.5) ? p : 1. - p;
            t = Math.sqrt(-2. * Math.log(pp));
            x = (2.30753 + t * 0.27061) / (1. + t * (0.99229 + t * 0.04481)) - t;
            if (p < 0.5) {
                x = -x;
            }
            al = (x * x - 3.) / 6.;
            h = 2. / (1. / (2. * alpha - 1.) + 1. / (2. * beta - 1.));
            w = (x * Math.sqrt(al + h) / h) - (1. / (2. * beta - 1) - 1. / (2. * alpha - 1.)) * (al + 5. / 6. - 2. / (3. * h));
            x = alpha / (alpha + beta * Math.exp(2. * w));
        } else {
            double lna = Math.log(alpha / (alpha + beta));
            double lnb = Math.log(beta / (alpha + beta));
            t = Math.exp(alpha * lna) / alpha;
            u = Math.exp(beta * lnb) / beta;
            w = t + u;
            if (p < t / w) {
                x = Math.pow(alpha * w * p, 1. / alpha);
            } else {
                x = 1. - Math.pow(beta * w * (1. - p), 1. / beta);
            }
        }
        afac = -Gamma.lgamma(alpha) - Gamma.lgamma(beta) + Gamma.lgamma(alpha + beta);
        for (int j = 0; j < 10; j++) {
            if (x == 0. || x == 1.) {
                return x;
            }
            err = regularizedIncompleteBetaFunction(alpha, beta, x) - p;
            t = Math.exp(a1 * Math.log(x) + b1 * Math.log(1. - x) + afac);
            u = err / t;
            x -= (t = u / (1. - 0.5 * Math.min(1., u * (a1 / x - b1 / (1. - x)))));
            if (x <= 0.) {
                x = 0.5 * (x + t);
            }
            if (x >= 1.) {
                x = 0.5 * (x + t + 1.);
            }
            if (Math.abs(t) < EPS * x && j > 0) {
                break;
            }
        }
        return x;
    }