Grafika\Color::getRgba PHP Method

getRgba() public method

Get RGBA array
public getRgba ( ) : array
return array Contains array($r, $g, $b, $a)
    public function getRgba()
    {
        $rgba = $this->hexToRgb($this->hexString);
        $rgba[] = $this->alpha;
        return $rgba;
    }

Usage Example

Beispiel #1
0
 /**
  * Fill entire image with color.
  *
  * @param Image $image
  * @param Color $color Color object
  * @param int $x X-coordinate of start point
  * @param int $y Y-coordinate of start point
  *
  * @return Editor
  */
 public function fill(&$image, $color, $x = 0, $y = 0)
 {
     if ($image->isAnimated()) {
         // Ignore animated GIF for now
         return $this;
     }
     list($r, $g, $b, $alpha) = $color->getRgba();
     $colorResource = imagecolorallocatealpha($image->getCore(), $r, $g, $b, $this->gdAlpha($alpha));
     imagefill($image->getCore(), $x, $y, $colorResource);
     return $this;
 }