abs($dy)) { if ($dx < 0) { [$x1, $x2] = [$x2, $x1]; $y1 = $y2; } for ($x = $x1, $y = $y1; $x <= $x2; $x++, $y = $y1 + ($x - $x1) * $dy / $dx) { $yint = floor($y); $yfrac = $y - $yint; if (LINE_TYPE_BOLD == $style) { $bc = imagecolorsforindex($image, imagecolorat($image, $x, $yint - 1)); $bc = [$bc['red'], $bc['green'], $bc['blue']]; imagesetpixel($image, $x, $yint - 1, zbx_colormix($image, $lc, $bc, $yfrac)); $bc = imagecolorsforindex($image, imagecolorat($image, $x, $yint + 1)); $bc = [$bc['red'], $bc['green'], $bc['blue']]; imagesetpixel($image, $x, $yint + 1, zbx_colormix($image, $lc, $bc, 1 - $yfrac)); imagesetpixel($image, $x, $yint, $color); } else { $bc = imagecolorsforindex($image, imagecolorat($image, $x, $yint)); $bc = [$bc['red'], $bc['green'], $bc['blue']]; imagesetpixel($image, $x, $yint, zbx_colormix($image, $lc, $bc, $yfrac)); $bc = imagecolorsforindex($image, imagecolorat($image, $x, $yint + 1)); $bc = [$bc['red'], $bc['green'], $bc['blue']]; imagesetpixel($image, $x, $yint + 1, zbx_colormix($image, $lc, $bc, 1 - $yfrac)); } } } else { if ($dy < 0) { $x1 = $x2; [$y1, $y2] = [$y2, $y1]; } for ($y = $y1, $x = $x1; $y <= $y2; $y++, $x = $x1 + ($y - $y1) * $dx / $dy) { $xint = floor($x); $xfrac = $x - $xint; if (LINE_TYPE_BOLD == $style) { $bc = imagecolorsforindex($image, imagecolorat($image, $xint - 1, $y)); $bc = [$bc['red'], $bc['green'], $bc['blue']]; imagesetpixel($image, $xint - 1, $y, zbx_colormix($image, $lc, $bc, $xfrac)); $bc = imagecolorsforindex($image, imagecolorat($image, $xint + 1, $y)); $bc = [$bc['red'], $bc['green'], $bc['blue']]; imagesetpixel($image, $xint + 1, $y, zbx_colormix($image, $lc, $bc, 1 - $xfrac)); imagesetpixel($image, $xint, $y, $color); } else { $bc = imagecolorsforindex($image, imagecolorat($image, $xint, $y)); $bc = [$bc['red'], $bc['green'], $bc['blue']]; imagesetpixel($image, $xint, $y, zbx_colormix($image, $lc, $bc, $xfrac)); $bc = imagecolorsforindex($image, imagecolorat($image, $xint + 1, $y)); $bc = [$bc['red'], $bc['green'], $bc['blue']]; imagesetpixel($image, $xint + 1, $y, zbx_colormix($image, $lc, $bc, 1 - $xfrac)); } } } }