The bug reported by 'michi at marel dot at' also exists in PHP version 5.1.1. This functions just works with vertical lines!
imagedashedline
(PHP 4, PHP 5)
imagedashedline — Kesikli çizgi çizer
Açıklama
bool imagedashedline
( resource $resim
, int $x1
, int $y1
, int $x2
, int $y2
, int $renk
)
Bu işlevin kullanımı önerilmemektedir. Yerine imagesetstyle() ve imageline() çiftini kullanın.
Değiştirgeler
- resim
-
imagecreatetruecolor() gibi bir resim oluşturma işlevinden dönen bir resim verisi.
- x1
-
Sol üst köşenin X konumu.
- y1
-
Sol üst köşenin Y konumu. Resmin sol üst köşesinin koordinatları 0, 0'dır.
- x2
-
Sağ alt köşenin X konumu.
- y2
-
Sağ alt köşenin Y konumu.
- renk
-
Dolgu rengi. imagecolorallocate() ile döndürülen bir renk tanıtıcısı.
Dönen Değerler
Daima TRUE döner.
Örnekler
Örnek 1 - imagedashedline() örneği
<?php
// 100x100 bir tuval oluşturalım
$im = imagecreatetruecolor(100, 100);
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
// Dikine bir kesikli çizgi çizelim
imagedashedline($im, 50, 25, 50, 75, $white);
// Resmi kaydedelim
imagepng($im, './dashedline.png');
imagedestroy($im);
?>
Yukarıdaki örnek şuna benzer bir çıktı üretir:
Örnek 2 - Başka bir imagedashedline() örneği
<?php
// 100x100 bir tuval oluşturalım
$im = imagecreatetruecolor(100, 100);
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
// Çizgi tarzını taımlayalım: İlk dört piksel beyaz,
// sonraki dört piksel renksiz. Bu, kesikli çizgi etkisi verir.
$style = Array(
$white,
$white,
$white,
$white,
IMG_COLOR_TRANSPARENT,
IMG_COLOR_TRANSPARENT,
IMG_COLOR_TRANSPARENT,
IMG_COLOR_TRANSPARENT
);
imagesetstyle($im, $style);
// Kesikli çizgimizi çizelim
imageline($im, 50, 25, 50, 75, IMG_COLOR_STYLED);
// Resmi kaydedelim
imagepng($im, './imageline.png');
imagedestroy($im);
?>
imagedashedline
ProfessorNeo at gmx dot de
16-Feb-2006 08:07
16-Feb-2006 08:07
alien-scripts.de
13-Jul-2005 09:17
13-Jul-2005 09:17
I make my own dashedline:
<?
for($l=50;$l<=550;$l+=5)
{
if($da == 0) { $da = 1; }
elseif($da == 1){
imageline($bild,$l,50,$l+5,50,$green);
$da = 0; }
}
?>
$l is the x-value
and we have a dashed line :)
michi at marel dot at
19-Nov-2003 02:49
19-Nov-2003 02:49
There's a bug till PHP 4.0.4 in this function. You can only draw vertical dashed lines. To draw other dashed lines you can set <ImageSetStyle> to a special dashed line and draw it by <ImageLine>.
Sample code:
<?php
function MDashedLine($image, $x0, $y0, $x1, $y1, $fg, $bg)
{
$st = array($fg, $fg, $fg, $fg, $bg, $bg, $bg, $bg);
ImageSetStyle($image, $st);
ImageLine($image, $x0, $y0, $x1, $y1, IMG_COLOR_STYLED);
}
?>
