array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'function.imagecolorsforindex.php', 1 => 'imagecolorsforindex', ), 'up' => array ( 0 => 'ref.image.php', 1 => 'GD ve Görüntü İşlevleri', ), 'prev' => array ( 0 => 'function.imagecolorset.php', 1 => 'imagecolorset', ), 'next' => array ( 0 => 'function.imagecolorstotal.php', 1 => 'imagecolorstotal', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'tr', 'path' => 'reference/image/functions/imagecolorsforindex.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
imagecolorsforindex — Bir renk indisinin renk bilgisini döndürür
görüntü
imagecreatetruecolor() gibi bir görüntü oluşturma işlevinden dönen bir GdImage nesnesi.
renk
Renk indisi.
Belirtilen renk indisi ile ilişkili "red", "green", "blue" ve "alpha" (kırmızı, yeşil, mavi ve alfa) anahtarlarını içeren bir ilişkisel dizi döndürür.
Sürüm: | Açıklama |
---|---|
8.0.0 |
imagecolorsforindex() işlevi
renk kapsam dışında ise artık
ValueError istisnası oluşturuyor;
evvelce bu durumda false dönerdi.
|
8.0.0 |
görüntü bağımsız değişkeninde artık
bir GdImage nesnesi aktarmak gerekiyor; evvelce
resource türünde geçerli bir gd değeri
gerekirdi.
|
Örnek 1 - imagecolorsforindex() örneği
<?php
// Bir görüntü açalım
$im = imagecreatefrompng('nexen.png');
// Bir noktanın renk indisini alalım
$start_x = 40;
$start_y = 50;
$color_index = imagecolorat($im, $start_x, $start_y);
// Renk bilgisini insan okuyabilir biçeme dönüştürelim
$color_tran = imagecolorsforindex($im, $color_index);
// Sonucu görelim
print_r($color_tran);
?>
Yukarıdaki örnek şuna benzer bir çıktı üretir:
Array ( [red] => 226 [green] => 222 [blue] => 252 [alpha] => 0 )