imagedashedline

(PHP 3, PHP 4, PHP 5)

imagedashedline -- 画一虚线

说明

bool imagedashedline ( resource image, int x1, int y1, int x2, int y2, int color )

反对使用本函数。应该用 imagesetstyle()imageline() 的组合替代之。


add a note add a note User Contributed Notes
ProfessorNeo at gmx dot de
17-Feb-2006 04:07
The bug reported by 'michi at marel dot at' also exists in PHP version 5.1.1. This functions just works with vertical lines!
alien-scripts.de
14-Jul-2005 05: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 10: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);
}
?>