protected function _border_solid($x, $y, $length, $color, $widths, $side, $corner_style = "bevel", $r1 = 0, $r2 = 0) { // TODO: Solve rendering where one corner is beveled (radius == 0), one corner isn't. if ($corner_style !== "bevel" || $r1 > 0 || $r2 > 0) { // do it the simple way $this->_border_line($x, $y, $length, $color, $widths, $side, $corner_style, "solid", $r1, $r2); return; } list($top, $right, $bottom, $left) = $widths; // All this polygon business is for beveled corners... switch ($side) { case "top": $points = array($x, $y, $x + $length, $y, $x + $length - $right, $y + $top, $x + $left, $y + $top); $this->_canvas->polygon($points, $color, null, null, true); break; case "bottom": $points = array($x, $y, $x + $length, $y, $x + $length - $right, $y - $bottom, $x + $left, $y - $bottom); $this->_canvas->polygon($points, $color, null, null, true); break; case "left": $points = array($x, $y, $x, $y + $length, $x + $left, $y + $length - $bottom, $x + $left, $y + $top); $this->_canvas->polygon($points, $color, null, null, true); break; case "right": $points = array($x, $y, $x, $y + $length, $x - $right, $y + $length - $bottom, $x - $right, $y + $top); $this->_canvas->polygon($points, $color, null, null, true); break; default: return; } }
protected function _border_solid($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") { list($top, $right, $bottom, $left) = $widths; // All this polygon business is for beveled corners... switch ($side) { case "top": if ($corner_style === "bevel") { $points = array($x, $y, $x + $length, $y, $x + $length - $right, $y + $top, $x + $left, $y + $top); $this->_canvas->polygon($points, $color, null, null, true); } else { $this->_canvas->filled_rectangle($x, $y, $length, $top, $color); } break; case "bottom": if ($corner_style === "bevel") { $points = array($x, $y, $x + $length, $y, $x + $length - $right, $y - $bottom, $x + $left, $y - $bottom); $this->_canvas->polygon($points, $color, null, null, true); } else { $this->_canvas->filled_rectangle($x, $y - $bottom, $length, $bottom, $color); } break; case "left": if ($corner_style === "bevel") { $points = array($x, $y, $x, $y + $length, $x + $left, $y + $length - $bottom, $x + $left, $y + $top); $this->_canvas->polygon($points, $color, null, null, true); } else { $this->_canvas->filled_rectangle($x, $y, $left, $length, $color); } break; case "right": if ($corner_style === "bevel") { $points = array($x, $y, $x, $y + $length, $x - $right, $y + $length - $bottom, $x - $right, $y + $top); $this->_canvas->polygon($points, $color, null, null, true); } else { $this->_canvas->filled_rectangle($x - $right, $y, $right, $length, $color); } break; default: return; } }
protected function _border_double($x, $y, $length, $color, $widths, $side, $corner_style = "bevel") { list($top, $right, $bottom, $left) = $widths; $line_width = ${$side} / 4; // We draw the outermost edge first. Points are ordered: outer left, // outer right, inner right, inner left, or outer top, outer bottom, // inner bottom, inner top. switch ($side) { case "top": if ($corner_style === "bevel") { $left_line_width = $left / 4; $right_line_width = $right / 4; $points = array($x, $y, $x + $length, $y, $x + $length - $right_line_width, $y + $line_width, $x + $left_line_width, $y + $line_width); $this->_canvas->polygon($points, $color, null, null, true); $points = array($x + $left - $left_line_width, $y + $top - $line_width, $x + $length - $right + $right_line_width, $y + $top - $line_width, $x + $length - $right, $y + $top, $x + $left, $y + $top); $this->_canvas->polygon($points, $color, null, null, true); } else { $this->_canvas->filled_rectangle($x, $y, $length, $line_width, $color); $this->_canvas->filled_rectangle($x, $y + $top - $line_width, $length, $line_width, $color); } break; case "bottom": if ($corner_style === "bevel") { $left_line_width = $left / 4; $right_line_width = $right / 4; $points = array($x, $y, $x + $length, $y, $x + $length - $right_line_width, $y - $line_width, $x + $left_line_width, $y - $line_width); $this->_canvas->polygon($points, $color, null, null, true); $points = array($x + $left - $left_line_width, $y - $bottom + $line_width, $x + $length - $right + $right_line_width, $y - $bottom + $line_width, $x + $length - $right, $y - $bottom, $x + $left, $y - $bottom); $this->_canvas->polygon($points, $color, null, null, true); } else { $this->_canvas->filled_rectangle($x, $y - $line_width, $length, $line_width, $color); $this->_canvas->filled_rectangle($x, $y - $bottom, $length, $line_width, $color); } break; case "left": if ($corner_style === "bevel") { $top_line_width = $top / 4; $bottom_line_width = $bottom / 4; $points = array($x, $y, $x, $y + $length, $x + $line_width, $y + $length - $bottom_line_width, $x + $line_width, $y + $top_line_width); $this->_canvas->polygon($points, $color, null, null, true); $points = array($x + $left - $line_width, $y + $top - $top_line_width, $x + $left - $line_width, $y + $length - $bottom + $bottom_line_width, $x + $left, $y + $length - $bottom, $x + $left, $y + $top); $this->_canvas->polygon($points, $color, null, null, true); } else { $this->_canvas->filled_rectangle($x, $y, $line_width, $length, $color); $this->_canvas->filled_rectangle($x + $left - $line_width, $y, $line_width, $length, $color); } break; case "right": if ($corner_style === "bevel") { $top_line_width = $top / 4; $bottom_line_width = $bottom / 4; $points = array($x, $y, $x, $y + $length, $x - $line_width, $y + $length - $bottom_line_width, $x - $line_width, $y + $top_line_width); $this->_canvas->polygon($points, $color, null, null, true); $points = array($x - $right + $line_width, $y + $top - $top_line_width, $x - $right + $line_width, $y + $length - $bottom + $bottom_line_width, $x - $right, $y + $length - $bottom, $x - $right, $y + $top); $this->_canvas->polygon($points, $color, null, null, true); } else { $this->_canvas->filled_rectangle($x - $line_width, $y, $line_width, $length, $color); $this->_canvas->filled_rectangle($x - $right, $y, $line_width, $length, $color); } break; default: return; } }