コード例 #1
0
ファイル: Block.php プロジェクト: onyxnz/quartzpos
 protected function _render_outline(AbstractFrameDecorator $frame, $border_box = null, $corner_style = "bevel")
 {
     $style = $frame->get_style();
     $props = array("width" => $style->outline_width, "style" => $style->outline_style, "color" => $style->outline_color);
     if (!$props["style"] || $props["style"] === "none" || $props["width"] <= 0) {
         return;
     }
     if (empty($border_box)) {
         $border_box = $frame->get_border_box();
     }
     $offset = $style->length_in_pt($props["width"]);
     $pattern = $this->_get_dash_pattern($props["style"], $offset);
     // If the outline style is "solid" we'd better draw a rectangle
     if (in_array($props["style"], array("solid", "dashed", "dotted"))) {
         $border_box[0] -= $offset / 2;
         $border_box[1] -= $offset / 2;
         $border_box[2] += $offset;
         $border_box[3] += $offset;
         list($x, $y, $w, $h) = $border_box;
         $this->_canvas->rectangle($x, $y, $w, $h, $props["color"], $offset, $pattern);
         return;
     }
     $border_box[0] -= $offset;
     $border_box[1] -= $offset;
     $border_box[2] += $offset * 2;
     $border_box[3] += $offset * 2;
     $method = "_border_" . $props["style"];
     $widths = array_fill(0, 4, $props["width"]);
     $sides = array("top", "right", "left", "bottom");
     $length = 0;
     foreach ($sides as $side) {
         list($x, $y, $w, $h) = $border_box;
         switch ($side) {
             case "top":
                 $length = $w;
                 break;
             case "bottom":
                 $length = $w;
                 $y += $h;
                 break;
             case "left":
                 $length = $h;
                 break;
             case "right":
                 $length = $h;
                 $x += $w;
                 break;
             default:
                 break;
         }
         $this->{$method}($x, $y, $length, $props["color"], $widths, $side, $corner_style);
     }
 }