imagecolorresolvealpha
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
imagecolorresolvealpha — 取得指定顏色 + alpha 的索引值或有可能得到的最接近的替代值
說明
imagecolorresolvealpha(
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.
返回值
Returns a color index.
範例
示例 #1 Using imagecoloresolvealpha() to get colors from an image
<?php
// Load an image
$im = imagecreatefromgif('phplogo.gif');
// Get closest colors from the image
$colors = array();
$colors[] = imagecolorresolvealpha($im, 255, 255, 255, 0);
$colors[] = imagecolorresolvealpha($im, 0, 0, 200, 127);
// Output
print_r($colors);
imagedestroy($im);
?>
以上例程的輸出類似於:
Array
(
[0] => 89
[1] => 85
)