function triangletoParent($fromX, $fromY, $fromW, $toW, $textW) { if ($fromY == 0) { return; } $toX = $fromX; $fromTop = $this->row2Px($fromY); $fromCenter = $fromX + $fromW / 2 + B_SIDE; $fromLeft1 = $fromCenter + $textW / 2; $fromLeft2 = $fromCenter - $textW / 2; $toBot = $this->row2Px($fromY - 1) + $this->e_height; $toLeft = $toX + $toW / 2 + B_SIDE; if ($this->antialias) { imagesmoothline($this->im, $fromLeft1, $fromTop, $toLeft, $toBot, $this->col_line); imagesmoothline($this->im, $fromLeft2, $fromTop, $toLeft, $toBot, $this->col_line); imagesmoothline($this->im, $fromLeft1, $fromTop, $fromLeft2, $fromTop, $this->col_line); } else { imageline($this->im, $fromLeft1, $fromTop, $toLeft, $toBot, $this->col_line); imageline($this->im, $fromLeft2, $fromTop, $toLeft, $toBot, $this->col_line); imageline($this->im, $fromLeft1, $fromTop, $fromLeft2, $fromTop, $this->col_line); } }
P -114.8470, 163.5500, 84.9460, 127, 0, 0, 2, Orc_Trainer P -118.8650, 212.1990, 80.1880, 0, 0, 0, 3, Trainer_Hill P 95.1710, 78.4270, 0.0010, 0, 0, 0, 3, North_Wall P 316.6940, -94.5960, 0.0010, 0, 0, 0, 2, Safe_Spot P 213.2900, -134.7010, -13.2230, 0, 0, 0, 2, Slaver_Pits P 150.7150, -238.0460, 0.0010, 127, 0, 0, 2, Orc_Taskmaster x,y,z r,g,b ? description */ for ($i = 1; $i <= 2; $i++) { /* Parse Out Lines */ $handle = fopen("Maps/" . $_GET['zone'] . "_" . $i . ".txt", "r"); if ($handle) { while (($line = fgets($handle)) !== false) { if (substr($line, 0, 1) == 'L') { $line = str_replace('L ', '', $line); $ar = explode(",", $line); imagesmoothline($img, $ar[0] + abs($min_x + $offset), $ar[1] + abs($min_y + $offset), $ar[3] + abs($min_x + $offset), $ar[4] + abs($min_y + $offset), $line_color); # imageline($img, $ar[0] + abs($min_x + $offset), $ar[1] + abs($min_y + $offset), $ar[3] + abs($min_x + $offset), $ar[4] + abs($min_y + $offset), imagecolorallocate($img, $ar[6], $ar[7], $ar[8])); } if (substr($line, 0, 1) == 'P') { $line = str_replace('P ', '', $line); $ar = explode(",", $line); // imagestring($img, 8, $ar[0] + abs($min_x + $offset), $ar[1] + abs($min_y + $offset), $ar[7], $marker_color); } } } fclose($handle); } fclose($handle); header("Content-type: image/png"); imagepng($img);
function drawGraphs($img, $items, $y_min, $y_delta, $color1, $color2, $color3) { $count = count($items); $y_koeff = $y_delta ? DIAGRAM_HEIGHT / $y_delta : 0; $x_koeff = DIAGRAM_WIDTH / ($count - 1); $y_start = DIAGRAM_Y + DIAGRAM_HEIGHT; $old_x[0] = DIAGRAM_X; $old_x[1] = DIAGRAM_X; $old_x[2] = DIAGRAM_X; $old_y[0] = round($y_start - $items[0][0] * $y_koeff); $old_y[1] = round($y_start - $items[0][1] * $y_koeff); $old_y[2] = round($y_start - $items[0][2] * $y_koeff); for ($i = 1; $i < $count; $i++) { $x = round(DIAGRAM_X + $x_koeff * $i); $y = round($y_start - $items[$i][2] * $y_koeff); imagesmoothline($img, $old_x[2], $old_y[2], $x, $y, $color3); $old_x[2] = $x; $old_y[2] = $y; $x = round(DIAGRAM_X + $x_koeff * $i); $y = round($y_start - $items[$i][1] * $y_koeff); imagesmoothline($img, $old_x[1], $old_y[1], $x, $y, $color2); $old_x[1] = $x; $old_y[1] = $y; $x = round(DIAGRAM_X + $x_koeff * $i); $y = round($y_start - $items[$i][0] * $y_koeff); imageBoldLine($img, $old_x[0], $old_y[0], $x, $y, $color1, 1.5, "imagesmoothline"); $old_x[0] = $x; $old_y[0] = $y; } }