Forum und email

imagesetpixel

(PHP 4, PHP 5)

imagesetpixel โ€” Set a single pixel

์„ค๋ช…

bool imagesetpixel ( resource $image , int $x , int $y , int $color )

imagesetpixel() draws a pixel at the specified coordinate.

๋งค๊ฐœ๋ณ€์ˆ˜

font

๋‚ด์žฅ ๊ธ€๊ผด 1, 2, 3, 4, 5(ํฐ ์ˆซ์ž๊ฐ€ ํฐ ๊ธ€๊ผด)๋‚˜ imageloadfont()๋กœ ๋“ฑ๋กํ•œ ๊ธ€๊ผด ์‹๋ณ„์ž๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

x

x-coordinate

y

y-coordinate

color

A color identifier created with imagecolorallocate()

๋ฐ˜ํ™˜๊ฐ’

์„ฑ๊ณตํ•  ๊ฒฝ์šฐ TRUE๋ฅผ, ์‹คํŒจํ•  ๊ฒฝ์šฐ FALSE๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

Example#1 imagesetpixel() example

A random drawing that ends with a regular picture.

<?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($gd25500); 

for (
$i 0$i 100000$i++) {
  
imagesetpixel($gdround($x),round($y), $red);
  
$a rand(02);
  
$x = ($x $corners[$a]['x']) / 2;
  
$y = ($y $corners[$a]['y']) / 2;
}
 
header('Content-Type: image/png');
imagepng($gd);

?>

์œ„ ์˜ˆ์ œ์˜ ์ถœ๋ ฅ ์˜ˆ: