本文整理汇总了PHP中Canvas::filled_rectangle方法的典型用法代码示例。如果您正苦于以下问题:PHP Canvas::filled_rectangle方法的具体用法?PHP Canvas::filled_rectangle怎么用?PHP Canvas::filled_rectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas::filled_rectangle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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;
}
}
示例2: _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;
}
}