本文整理汇总了PHP中Image_Canvas::rectangle方法的典型用法代码示例。如果您正苦于以下问题:PHP Image_Canvas::rectangle方法的具体用法?PHP Image_Canvas::rectangle怎么用?PHP Image_Canvas::rectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image_Canvas
的用法示例。
在下文中一共展示了Image_Canvas::rectangle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rectangle
/**
* Draw a rectangle
*
* Parameter array:
* 'x0': int X start point
* 'y0': int Y start point
* 'x1': int X end point
* 'y1': int Y end point
* 'fill': mixed [optional] The fill color
* 'line': mixed [optional] The line color
* @param array $params Parameter array
*/
function rectangle($params)
{
if (isset($this->_imageMap)) {
$this->_imageMap->rectangle($params);
}
parent::rectangle($params);
}
示例2: rectangle
/**
* Draw a rectangle
*
* Parameter array:
* 'x0': int X start point
* 'y0': int Y start point
* 'x1': int X end point
* 'y1': int Y end point
* 'fill': mixed [optional] The fill color
* 'line': mixed [optional] The line color
* @param array $params Parameter array
*/
function rectangle($params)
{
$x0 = $this->_getX($params['x0']);
$y0 = $this->_getY($params['y0']);
$x1 = $this->_getX($params['x1']);
$y1 = $this->_getY($params['y1']);
$fillColor = isset($params['fill']) ? $params['line'] : false;
$lineColor = isset($params['line']) ? $params['line'] : false;
$line = $this->_setLineStyle($lineColor);
$fill = $this->_setFillStyle($fillColor);
if ($line || $fill) {
pdf_rect($this->_pdf, $this->_getX(min($x0, $x1)), $this->_getY(max($y0, $y1)), abs($x1 - $x0), abs($y1 - $y0));
if ($line && $fill) {
pdf_fill_stroke($this->_pdf);
} elseif ($line) {
pdf_stroke($this->_pdf);
} elseif ($fill) {
pdf_fill($this->_pdf);
}
}
parent::rectangle($params);
}
示例3: rectangle
/**
* Draw a rectangle
*
* Parameter array:
* 'x0': int X start point
* 'y0': int Y start point
* 'x1': int X end point
* 'y1': int Y end point
* 'fill': mixed [optional] The fill color
* 'line': mixed [optional] The line color
* @param array $params Parameter array
*/
function rectangle($params)
{
if (isset($params['url'])) {
$this->_addMapTag('rect', $this->_getX($params['x0']) . ',' . $this->_getY($params['y0']) . ',' . $this->_getX($params['x1']) . ',' . $this->_getY($params['y1']), $params);
}
parent::rectangle($params);
}
示例4: rectangle
/**
* Draw a rectangle
*
* Parameter array:
* 'x0': int X start point
* 'y0': int Y start point
* 'x1': int X end point
* 'y1': int Y end point
* 'fill': mixed [optional] The fill color
* 'line': mixed [optional] The line color
* @param array $params Parameter array
*/
function rectangle($params)
{
$x0 = min($this->_getX($params['x0']), $this->_getX($params['x1']));
$y0 = min($this->_getY($params['y0']), $this->_getY($params['y1']));
$x1 = max($this->_getX($params['x0']), $this->_getX($params['x1']));
$y1 = max($this->_getY($params['y0']), $this->_getY($params['y1']));
$fillColor = isset($params['fill']) ? $params['line'] : false;
$lineColor = isset($params['line']) ? $params['line'] : false;
$style = $this->_getLineStyle($lineColor) . $this->_getFillStyle($fillColor);
if ($style != '') {
$this->_addElement('<rect ' . 'x="' . round($x0) . '" ' . 'y="' . round($y0) . '" ' . 'width="' . round(abs($x1 - $x0)) . '" ' . 'height="' . round(abs($y1 - $y0)) . '" ' . 'style="' . $style . '"' . '/>', $params);
}
parent::rectangle($params);
}
示例5: rectangle
/**
* Draw a rectangle
*
* Parameter array:
* 'x0' : int X start point
* 'y0' : int Y start point
* 'x1' : int X end point
* 'y1' : int Y end point
* 'fill' : The fill style
* 'line' : The line style
* 'url' : string [optional] Target URL
*
* @param array $params Parameter array
*
* @return void
*/
function rectangle($params)
{
$x0 = min($this->_getX($params['x0']), $this->_getX($params['x1']));
$y0 = min($this->_getY($params['y0']), $this->_getY($params['y1']));
$x1 = max($this->_getX($params['x0']), $this->_getX($params['x1']));
$y1 = max($this->_getY($params['y0']), $this->_getY($params['y1']));
$fillColor = isset($params['fill']) ? $params['fill'] : false;
$lineColor = isset($params['line']) ? $params['line'] : false;
$fillColor = $this->_getFillStyle($fillColor);
$lineColor = $this->_getLineStyle($lineColor);
// use fill color if no line color is set or transparent
if (count($lineColor) === 0) {
$lineColor = $fillColor;
}
$shape = new SWFShape();
$shape->setLine(1, $lineColor[0], $lineColor[1], $lineColor[2]);
if (count($fillColor)) {
$shape->setRightFill($fillColor[0], $fillColor[1], $fillColor[2]);
}
$shape->movePenTo($x0, $y0);
$shape->drawLine($x1 - $x0, 0);
$shape->drawLine(0, $y1 - $y0);
$shape->drawLine($x0 - $x1, 0);
$shape->drawLine(0, $y0 - $y1);
if (isset($params['url'])) {
$button = new SWFButton();
$button->addShape($shape, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER);
$button->addAction(new SWFAction("getURL('{$params['url']}');"), SWFBUTTON_MOUSEUP);
$this->_canvas->add($button);
} else {
$this->_canvas->add($shape);
}
parent::rectangle($params);
}