imagecolorexactalpha
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
imagecolorexactalpha — 取得指定的顏色加透明度的索引值
說明
imagecolorexactalpha(
resource
int
int
int
int
): int
resource
$image,int
$red,int
$green,int
$blue,int
$alpha): int
返回影象調色板中指定顏色加透明度的索引值。
參數
-
image -
由圖像建立函式(例如imagecreatetruecolor())返回的 GdImage 對象。
-
red -
紅色成分的值。
-
green -
綠色成分的值。
-
blue -
藍色成分的值。
-
alpha -
A value between
0and127.0indicates completely opaque while127indicates completely transparent.
返回值
返回影象調色板中指定顏色加透明度的索引值。 如果顏色不在影象的調色板中,返回 -1。
範例
示例 #1 Get colors from the GD logo
<?php
// Setup an image
$im = imagecreatefrompng('./gdlogo.png');
$colors = Array();
$colors[] = imagecolorexactalpha($im, 255, 0, 0, 0);
$colors[] = imagecolorexactalpha($im, 0, 0, 0, 127);
$colors[] = imagecolorexactalpha($im, 255, 255, 255, 55);
$colors[] = imagecolorexactalpha($im, 100, 255, 52, 20);
print_r($colors);
// Free from memory
imagedestroy($im);
?>
以上例程的輸出類似於:
Array
(
[0] => 16711680
[1] => 2130706432
[2] => 939524095
[3] => 342163252
)