opacity2Alpha() 공개 정적인 메소드

Convert opacity value to alpha
public static opacity2Alpha ( integer $opacity ) : integer
$opacity integer
리턴 integer
예제 #1
0
파일: Filter.php 프로젝트: JBZoo/Image
 /**
  * Set colorize
  *
  * @param resource  $image      Image GD resource
  * @param string    $color      Hex color string, array(red, green, blue) or array(red, green, blue, alpha).
  *                              Where red, green, blue - integers 0-255, alpha - integer 0-127
  * @param float|int $opacity    0-100
  * @return $this
  *
  * @throws \JBZoo\Utils\Exception
  */
 public static function colorize($image, $color, $opacity)
 {
     $rgba = Helper::normalizeColor($color);
     $alpha = Helper::opacity2Alpha($opacity);
     $red = Helper::color($rgba[0]);
     $green = Helper::color($rgba[1]);
     $blue = Helper::color($rgba[2]);
     imagefilter($image, IMG_FILTER_COLORIZE, $red, $green, $blue, $alpha);
 }