当前位置: 首页>>代码示例>>PHP>>正文


PHP Canvas::polygon方法代码示例

本文整理汇总了PHP中Canvas::polygon方法的典型用法代码示例。如果您正苦于以下问题:PHP Canvas::polygon方法的具体用法?PHP Canvas::polygon怎么用?PHP Canvas::polygon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Canvas的用法示例。


在下文中一共展示了Canvas::polygon方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _border_solid

 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;
     }
 }
开发者ID:uab-balticode,项目名称:dpd-shipping-module-magento-2,代码行数:31,代码来源:abstract_renderer.cls.php

示例2: _border_solid

 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;
     }
 }
开发者ID:rmuyinda,项目名称:dms-1,代码行数:41,代码来源:abstract_renderer.cls.php

示例3: _border_double

 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;
     }
 }
开发者ID:kuwox,项目名称:buenavista,代码行数:64,代码来源:abstract_renderer.cls.php


注:本文中的Canvas::polygon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。