array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'function.imagesetpixel.php', 1 => 'imagesetpixel', ), 'up' => array ( 0 => 'ref.image.php', 1 => 'GD ve Görüntü İşlevleri', ), 'prev' => array ( 0 => 'function.imagesetinterpolation.php', 1 => 'imagesetinterpolation', ), 'next' => array ( 0 => 'function.imagesetstyle.php', 1 => 'imagesetstyle', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'tr', 'path' => 'reference/image/functions/imagesetpixel.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
imagesetpixel — Bir pikselin rengini değiştirir
imagesetpixel() işlevi koordinatları belirtilen pikselin rengini değiştirir.
görüntü
imagecreatetruecolor() gibi bir görüntü oluşturma işlevinden dönen bir GdImage nesnesi.
x
Pikselin X konumu.
y
Pikselin Y konumu.
renk
imagecolorallocate() işlevi le oluşturulmuş bir renk tanıtıcı.
Sürüm: | Açıklama |
---|---|
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 - imagesetpixel() örneği
Normal bir resimle sonuçlanan rasgele bir çizim.
<?php
$x = 200;
$y = 200;
$gd = imagecreatetruecolor($x, $y);
$corners[0] = array('x' => 100, 'y' => 10);
$corners[1] = array('x' => 0, 'y' => 190);
$corners[2] = array('x' => 200, 'y' => 190);
$red = imagecolorallocate($gd, 255, 0, 0);
for ($i = 0; $i < 100000; $i++) {
imagesetpixel($gd, round($x), round($y), $red);
$a = rand(0, 2);
$x = ($x + $corners[$a]['x']) / 2;
$y = ($y + $corners[$a]['y']) / 2;
}
header('Content-Type: image/png');
imagepng($gd);
?>
Yukarıdaki örnek şuna benzer bir çıktı üretir: