/** * Draws an arc on the handle * * @param GD-object $handle The handle on which the ellipse is drawn * @param Zend_Image_Action_DrawEllipse $ellipseObject The object that with all info */ public function perform(Zend_Image_Adapter_Gd $adapter, Zend_Image_Action_DrawArc $arcObject) { $color = $arcObject->getFillColor()->getRgb(); $colorAlphaAlloc = imagecolorallocatealpha($adapter->getHandle(), $color['red'], $color['green'], $color['blue'], 127 - $arcObject->getFillAlpha() * 1.27); if (!$arcObject->isFilled()) { $style = IMG_ARC_NOFILL + IMG_ARC_EDGED; } else { $style = IMG_ARC_PIE; } $location = $arcObject->getLocation($adapter); imagefilledarc($adapter->getHandle(), $location->getX(), $location->getY(), $arcObject->getWidth(), $arcObject->getHeight(), $arcObject->getCutoutStart() - 90, $arcObject->getCutoutEnd() - 90, $colorAlphaAlloc, $style); }
/** * Draws an arc on the handle * * @param Zend_Image_Adapter_ImageMagick $handle The handle on which the ellipse is drawn * @param Zend_Image_Action_DrawEllipse $ellipseObject The object that with all info */ public function perform(Zend_Image_Adapter_ImageMagick $adapter, Zend_Image_Action_DrawArc $arcObject) { $draw = new ImagickDraw(); $color = (string) $arcObject->getFillColor(); $draw->setStrokeColor($color); $location = $arcObject->getLocation($adapter); $cx = $location->getX(); $cy = $location->getY(); $width = $arcObject->getWidth(); $height = $arcObject->getHeight(); $sx = $cx - $width / 2; $ex = $cx + $width / 2; $sy = $cy - $height / 2; $ey = $cy + $height / 2; //$draw->arc($sx, $sy, $ex, $ey, $arcObject->getCutoutStart(), $arcObject->getCutoutEnd()); // $draw->arc($sx, $sy, $ex, $ey, 90, 315); $draw->arc($sx, $sy, $ex, $ey, 90, 270); $adapter->getHandle()->drawImage($draw); }