/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }