本文整理汇总了PHP中Image_Canvas::ellipse方法的典型用法代码示例。如果您正苦于以下问题:PHP Image_Canvas::ellipse方法的具体用法?PHP Image_Canvas::ellipse怎么用?PHP Image_Canvas::ellipse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image_Canvas
的用法示例。
在下文中一共展示了Image_Canvas::ellipse方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ellipse
/**
* Draw an ellipse
*
* Parameter array:
* 'x': int X center point
* 'y': int Y center point
* 'rx': int X radius
* 'ry': int Y radius
* 'fill': mixed [optional] The fill color
* 'line': mixed [optional] The line color
* @param array $params Parameter array
*/
function ellipse($params)
{
if (isset($this->_imageMap)) {
$this->_imageMap->ellipse($params);
}
parent::ellipse($params);
}
示例2: ellipse
/**
* Draw an ellipse
*
* Parameter array:
* 'x': int X center point
* 'y': int Y center point
* 'rx': int X radius
* 'ry': int Y radius
* 'fill': mixed [optional] The fill color
* 'line': mixed [optional] The line color
* @param array $params Parameter array
*/
function ellipse($params)
{
$x = $this->_getX($params['x']);
$y = $this->_getY($params['y']);
$rx = $this->_getX($params['rx']);
$ry = $this->_getY($params['ry']);
$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) {
if ($rx == $ry) {
pdf_circle($this->_pdf, $this->_getX($x), $this->_getY($y), $rx);
} else {
pdf_moveto($this->_pdf, $this->_getX($x - $rx), $this->_getY($y));
pdf_curveto($this->_pdf, $this->_getX($x - $rx), $this->_getY($y), $this->_getX($x - $rx), $this->_getY($y - $ry), $this->_getX($x), $this->_getY($y - $ry));
pdf_curveto($this->_pdf, $this->_getX($x), $this->_getY($y - $ry), $this->_getX($x + $rx), $this->_getY($y - $ry), $this->_getX($x + $rx), $this->_getY($y));
pdf_curveto($this->_pdf, $this->_getX($x + $rx), $this->_getY($y), $this->_getX($x + $rx), $this->_getY($y + $ry), $this->_getX($x), $this->_getY($y + $ry));
pdf_curveto($this->_pdf, $this->_getX($x), $this->_getY($y + $ry), $this->_getX($x - $rx), $this->_getY($y + $ry), $this->_getX($x - $rx), $this->_getY($y));
}
if ($line && $fill) {
pdf_fill_stroke($this->_pdf);
} elseif ($line) {
pdf_stroke($this->_pdf);
} elseif ($fill) {
pdf_fill($this->_pdf);
}
}
parent::ellipse($params);
}
示例3: ellipse
/**
* Draw an ellipse
*
* Parameter array:
* 'x': int X center point
* 'y': int Y center point
* 'rx': int X radius
* 'ry': int Y radius
* 'fill': mixed [optional] The fill color
* 'line': mixed [optional] The line color
* @param array $params Parameter array
*/
function ellipse($params)
{
if (isset($params['url'])) {
if ($params['rx'] == $params['ry']) {
$this->_addMapTag('circle', $this->_getX($params['x']) . ',' . $this->_getY($params['y']) . ',' . $this->_getX($params['rx']), $params);
} else {
$points = '';
for ($v = 0; $v <= 360; $v += 30) {
if ($points != '') {
$points .= ',';
}
$points .= round($this->_getX($params['x']) + $this->_getX($params['rx']) * cos(deg2rad($v % 360))) . ',' . round($this->_getY($params['y']) + $this->_getX($params['ry']) * sin(deg2rad($v % 360)));
}
$this->_addMapTag('polygon', $points, $params);
}
}
parent::ellipse($params);
}
示例4: ellipse
/**
* Draw an ellipse
*
* Parameter array:
* 'x': int X center point
* 'y': int Y center point
* 'rx': int X radius
* 'ry': int Y radius
* 'fill': mixed [optional] The fill color
* 'line': mixed [optional] The line color
* @param array $params Parameter array
*/
function ellipse($params)
{
$x = $this->_getX($params['x']);
$y = $this->_getY($params['y']);
$rx = $this->_getX($params['rx']);
$ry = $this->_getY($params['ry']);
$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('<ellipse ' . 'cx="' . round($x) . '" ' . 'cy="' . round($y) . '" ' . 'rx="' . round($rx) . '" ' . 'ry="' . round($ry) . '" ' . 'style="' . $style . '"' . '/>', $params);
}
parent::ellipse($params);
}
示例5: ellipse
/**
* Draw an ellipse
*
* Parameter array:
* 'x' : int X center point
* 'y' : int Y center point
* 'rx' : int X radius
* 'ry' : int Y radius
* 'fill' : mixed [optional] The fill color
* 'line' : mixed [optional] The line color
* 'url' : string [optional] Target URL
*
* @param array $params Parameter array
*
* @return void
*/
function ellipse($params)
{
$x = $this->_getX($params['x']);
$y = $this->_getY($params['y']);
$rx = $this->_getX($params['rx']);
$ry = $this->_getY($params['ry']);
// calculate scale factors
$scaleX = 1.0;
$scaleY = 1.0;
$moveX = 0;
$moveY = 0;
if ($rx > $ry) {
$scaleY = $ry / $rx;
$moveY = $ry * (1 - $scaleY);
} elseif ($rx < $ry) {
$scaleX = $rx / $ry;
$moveX = $rx * (1 - $scaleX);
}
$fillColor = isset($params['fill']) ? $params['fill'] : false;
$lineColor = isset($params['line']) ? $params['line'] : false;
$fillColor = $this->_getFillStyle($fillColor);
$lineColor = $this->_getLineStyle($lineColor);
$shape = new SWFShape();
$shape->setRightFill($fillColor[0], $fillColor[1], $fillColor[2]);
$shape->movePenTo($x, $y);
$shape->setLine(1, $lineColor[0], $lineColor[1], $lineColor[2]);
if (count($fillColor)) {
$shape->setRightFill($fillColor[0], $fillColor[1], $fillColor[2]);
}
$shape->drawCircle(max($rx, $ry));
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);
$ellipse = $this->_canvas->add($button);
} else {
$ellipse = $this->_canvas->add($shape);
}
$ellipse->move($moveX, $moveY);
$ellipse->scaleTo($scaleX, $scaleY);
parent::ellipse($params);
}