27 * @param int $red Value of red component 0-255
28 * @param int $green Value of green component 0-255
29 * @param int $blue Value of blue component 0-255
30 * @param int $alpha A value between 0 and 127. 0 indicates completely opaque while 127 indicates completely transparent.
32 public function __construct($red = 0, $green = 0, $blue = 0, $alpha = null)
35 $this->green = $green;
37 $this->alpha = $alpha;
41 * @param resource $image GD image resource
42 * @return int Returns the index of the specified color+alpha in the palette of the image,
43 * or -1 if the color does not exist in the image's palette.
45 public function getIndex($image)
47 if ($this->hasAlphaChannel()) {
48 return imagecolorexactalpha(
56 return imagecolorexact(
66 * @return bool TRUE when alpha channel is specified, FALSE otherwise
68 public function hasAlphaChannel()
70 return $this->alpha !== null;