本文整理匯總了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);
}