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


PHP Canvas::arc方法代码示例

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


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

示例1: _border_line

 protected function _border_line($x, $y, $length, $color, $widths, $side, $corner_style = "bevel", $pattern_name, $r11 = 0, $r12 = 0, $r21 = 0, $r22)
 {
     // TODO: What is $corner_style for ?
     list($top, $right, $bottom, $left) = $widths;
     $width = ${$side};
     $pattern = $this->_get_dash_pattern($pattern_name, $width);
     $half_width = $width / 2;
     $r11 -= $half_width;
     $r12 -= $half_width;
     $r21 -= $half_width;
     $r22 -= $half_width;
     $length -= $width;
     $outdraw = 0.5;
     switch ($side) {
         case "top":
             $x += $half_width;
             $y += $half_width;
             if ($r11 and $r12) {
                 $this->_canvas->arc($x + $r12, $y + $r11, $r12, $r11, 90 - $outdraw, 135 + $outdraw, $color, $width, $pattern);
             }
             $this->_canvas->line($x + $r12, $y, $x + $length - $r21, $y, $color, $width, $pattern);
             if ($r21 and $r22) {
                 $this->_canvas->arc($x + $length - $r21, $y + $r22, $r21, $r22, 45 - $outdraw, 90 + $outdraw, $color, $width, $pattern);
             }
             break;
         case "bottom":
             $x += $half_width;
             $y -= $half_width;
             if ($r21 and $r22) {
                 $this->_canvas->arc($x + $r21, $y - $r22, $r21, $r22, 225 - $outdraw, 270 + $outdraw, $color, $width, $pattern);
             }
             $this->_canvas->line($x + $r21, $y, $x + $length - $r12, $y, $color, $width, $pattern);
             if ($r11 and $r12) {
                 $this->_canvas->arc($x + $length - $r12, $y - $r11, $r12, $r11, 270 - $outdraw, 315 + $outdraw, $color, $width, $pattern);
             }
             break;
         case "left":
             $y += $half_width;
             $x += $half_width;
             if ($r11 and $r12) {
                 $this->_canvas->arc($x + $r11, $y + $length - $r12, $r11, $r12, 180 - $outdraw, 225 + $outdraw, $color, $width, $pattern);
             }
             $this->_canvas->line($x, $y + $r21, $x, $y + $length - $r12, $color, $width, $pattern);
             if ($r21 and $r22) {
                 $this->_canvas->arc($x + $r22, $y + $r21, $r22, $r21, 135 - $outdraw, 180 + $outdraw, $color, $width, $pattern);
             }
             break;
         case "right":
             $y += $half_width;
             $x -= $half_width;
             if ($r21 and $r22) {
                 $this->_canvas->arc($x - $r22, $y + $length - $r21, $r22, $r21, 315 - $outdraw, 360 + $outdraw, $color, $width, $pattern);
             }
             $this->_canvas->line($x, $y + $r12, $x, $y + $length - $r21, $color, $width, $pattern);
             if ($r11 and $r12) {
                 $this->_canvas->arc($x - $r11, $y + $r12, $r11, $r12, 0 - $outdraw, 45 + $outdraw, $color, $width, $pattern);
             }
             break;
     }
 }
开发者ID:mezhenko,项目名称:dompdf,代码行数:60,代码来源:abstract_renderer.cls.php

示例2: _border_line

 protected function _border_line($x, $y, $length, $color, $widths, $side, $corner_style = "bevel", $pattern_name, $r1 = 0, $r2 = 0)
 {
     list($top, $right, $bottom, $left) = $widths;
     $width = ${$side};
     $pattern = $this->_get_dash_pattern($pattern_name, $width);
     $half_width = $width / 2;
     $r1 -= $half_width;
     $r2 -= $half_width;
     $adjust = $r1 / 80;
     $length -= $width;
     switch ($side) {
         case "top":
             $x += $half_width;
             $y += $half_width;
             if ($r1 > 0) {
                 $this->_canvas->arc($x + $r1, $y + $r1, $r1, $r1, 90 - $adjust, 135 + $adjust, $color, $width, $pattern);
             }
             $this->_canvas->line($x + $r1, $y, $x + $length - $r2, $y, $color, $width, $pattern);
             if ($r2 > 0) {
                 $this->_canvas->arc($x + $length - $r2, $y + $r2, $r2, $r2, 45 - $adjust, 90 + $adjust, $color, $width, $pattern);
             }
             break;
         case "bottom":
             $x += $half_width;
             $y -= $half_width;
             if ($r1 > 0) {
                 $this->_canvas->arc($x + $r1, $y - $r1, $r1, $r1, 225 - $adjust, 270 + $adjust, $color, $width, $pattern);
             }
             $this->_canvas->line($x + $r1, $y, $x + $length - $r2, $y, $color, $width, $pattern);
             if ($r2 > 0) {
                 $this->_canvas->arc($x + $length - $r2, $y - $r2, $r2, $r2, 270 - $adjust, 315 + $adjust, $color, $width, $pattern);
             }
             break;
         case "left":
             $y += $half_width;
             $x += $half_width;
             if ($r1 > 0) {
                 $this->_canvas->arc($x + $r1, $y + $r1, $r1, $r1, 135 - $adjust, 180 + $adjust, $color, $width, $pattern);
             }
             $this->_canvas->line($x, $y + $r1, $x, $y + $length - $r2, $color, $width, $pattern);
             if ($r2 > 0) {
                 $this->_canvas->arc($x + $r2, $y + $length - $r2, $r2, $r2, 180 - $adjust, 225 + $adjust, $color, $width, $pattern);
             }
             break;
         case "right":
             $y += $half_width;
             $x -= $half_width;
             if ($r1 > 0) {
                 $this->_canvas->arc($x - $r1, $y + $r1, $r1, $r1, 0 - $adjust, 45 + $adjust, $color, $width, $pattern);
             }
             $this->_canvas->line($x, $y + $r1, $x, $y + $length - $r2, $color, $width, $pattern);
             if ($r2 > 0) {
                 $this->_canvas->arc($x - $r2, $y + $length - $r2, $r2, $r2, 315 - $adjust, 360 + $adjust, $color, $width, $pattern);
             }
             break;
     }
 }
开发者ID:uab-balticode,项目名称:dpd-shipping-module-magento-2,代码行数:57,代码来源:abstract_renderer.cls.php


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