ImagickDraw::arc
(PECL imagick 2.0.0)
ImagickDraw::arc — Draws an arc
Описание
bool ImagickDraw::arc
( float
$sx
, float $sy
, float $ex
, float $ey
, float $sd
, float $ed
)Внимание
К настоящему времени эта функция еще не была документирована; для ознакомления доступен только список аргументов.
Draws an arc falling within a specified bounding rectangle on the image.
Список параметров
-
sx
-
Starting x ordinate of bounding rectangle
-
sy
-
starting y ordinate of bounding rectangle
-
ex
-
ending x ordinate of bounding rectangle
-
ey
-
ending y ordinate of bounding rectangle
-
sd
-
starting degrees of rotation
-
ed
-
ending degrees of rotation
Возвращаемые значения
Эта функция не возвращает значения после выполнения.
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Обработка и генерация изображений
- Обработка изображений (ImageMagick)
- Функция ImagickDraw::affine() - Adjusts the current affine transformation matrix
- Функция ImagickDraw::annotation() - Draws text on the image
- Функция ImagickDraw::arc() - Draws an arc
- Функция ImagickDraw::bezier() - Draws a bezier curve
- Функция ImagickDraw::circle() - Draws a circle
- Функция ImagickDraw::clear() - Clears the ImagickDraw
- Функция ImagickDraw::clone() - Makes an exact copy of the specified ImagickDraw object
- Функция ImagickDraw::color() - Draws color on image
- Функция ImagickDraw::comment() - Adds a comment
- Функция ImagickDraw::composite() - Composites an image onto the current image
- Функция ImagickDraw::__construct() - The ImagickDraw constructor
- Функция ImagickDraw::destroy() - Frees all associated resources
- Функция ImagickDraw::ellipse() - Draws an ellipse on the image
- Функция ImagickDraw::getClipPath() - Obtains the current clipping path ID
- Функция ImagickDraw::getClipRule() - Returns the current polygon fill rule
- Функция ImagickDraw::getClipUnits() - Returns the interpretation of clip path units
- Функция ImagickDraw::getFillColor() - Returns the fill color
- Функция ImagickDraw::getFillOpacity() - Returns the opacity used when drawing
- Функция ImagickDraw::getFillRule() - Returns the fill rule
- Функция ImagickDraw::getFont() - Returns the font
- Функция ImagickDraw::getFontFamily() - Returns the font family
- Функция ImagickDraw::getFontSize() - Returns the font pointsize
- ImagickDraw::getFontStretch
- Функция ImagickDraw::getFontStyle() - Returns the font style
- Функция ImagickDraw::getFontWeight() - Returns the font weight
- Функция ImagickDraw::getGravity() - Returns the text placement gravity
- Функция ImagickDraw::getStrokeAntialias() - Returns the current stroke antialias setting
- Функция ImagickDraw::getStrokeColor() - Returns the color used for stroking object outlines
- Функция ImagickDraw::getStrokeDashArray() - Returns an array representing the pattern of dashes and gaps used to stroke paths
- Функция ImagickDraw::getStrokeDashOffset() - Returns the offset into the dash pattern to start the dash
- Функция ImagickDraw::getStrokeLineCap() - Returns the shape to be used at the end of open subpaths when they are stroked
- Функция ImagickDraw::getStrokeLineJoin() - Returns the shape to be used at the corners of paths when they are stroked
- Функция ImagickDraw::getStrokeMiterLimit() - Returns the stroke miter limit
- Функция ImagickDraw::getStrokeOpacity() - Returns the opacity of stroked object outlines
- Функция ImagickDraw::getStrokeWidth() - Returns the width of the stroke used to draw object outlines
- Функция ImagickDraw::getTextAlignment() - Returns the text alignment
- Функция ImagickDraw::getTextAntialias() - Returns the current text antialias setting
- Функция ImagickDraw::getTextDecoration() - Returns the text decoration
- Функция ImagickDraw::getTextEncoding() - Returns the code set used for text annotations
- ImagickDraw::getTextInterlineSpacing
- ImagickDraw::getTextInterwordSpacing
- ImagickDraw::getTextKerning
- Функция ImagickDraw::getTextUnderColor() - Returns the text under color
- Функция ImagickDraw::getVectorGraphics() - Returns a string containing vector graphics
- Функция ImagickDraw::line() - Draws a line
- Функция ImagickDraw::matte() - Paints on the image's opacity channel
- Функция ImagickDraw::pathClose() - Adds a path element to the current path
- Функция ImagickDraw::pathCurveToAbsolute() - Draws a cubic Bezier curve
- Функция ImagickDraw::pathCurveToQuadraticBezierAbsolute() - Draws a quadratic Bezier curve
- Функция ImagickDraw::pathCurveToQuadraticBezierRelative() - Draws a quadratic Bezier curve
- Функция ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute() - Draws a quadratic Bezier curve
- Функция ImagickDraw::pathCurveToQuadraticBezierSmoothRelative() - Draws a quadratic Bezier curve
- Функция ImagickDraw::pathCurveToRelative() - Draws a cubic Bezier curve
- Функция ImagickDraw::pathCurveToSmoothAbsolute() - Draws a cubic Bezier curve
- Функция ImagickDraw::pathCurveToSmoothRelative() - Draws a cubic Bezier curve
- Функция ImagickDraw::pathEllipticArcAbsolute() - Draws an elliptical arc
- Функция ImagickDraw::pathEllipticArcRelative() - Draws an elliptical arc
- Функция ImagickDraw::pathFinish() - Terminates the current path
- Функция ImagickDraw::pathLineToAbsolute() - Draws a line path
- Функция ImagickDraw::pathLineToHorizontalAbsolute() - Draws a horizontal line path
- Функция ImagickDraw::pathLineToHorizontalRelative() - Draws a horizontal line
- Функция ImagickDraw::pathLineToRelative() - Draws a line path
- Функция ImagickDraw::pathLineToVerticalAbsolute() - Draws a vertical line
- Функция ImagickDraw::pathLineToVerticalRelative() - Draws a vertical line path
- Функция ImagickDraw::pathMoveToAbsolute() - Starts a new sub-path
- Функция ImagickDraw::pathMoveToRelative() - Starts a new sub-path
- Функция ImagickDraw::pathStart() - Declares the start of a path drawing list
- Функция ImagickDraw::point() - Draws a point
- Функция ImagickDraw::polygon() - Draws a polygon
- Функция ImagickDraw::polyline() - Draws a polyline
- Функция ImagickDraw::pop() - Destroys the current ImagickDraw in the stack, and returns to the previously pushed ImagickDraw
- Функция ImagickDraw::popClipPath() - Terminates a clip path definition
- Функция ImagickDraw::popDefs() - Terminates a definition list
- Функция ImagickDraw::popPattern() - Terminates a pattern definition
- Функция ImagickDraw::push() - Clones the current ImagickDraw and pushes it to the stack
- Функция ImagickDraw::pushClipPath() - Starts a clip path definition
- Функция ImagickDraw::pushDefs() - Indicates that following commands create named elements for early processing
- Функция ImagickDraw::pushPattern() - Indicates that subsequent commands up to a ImagickDraw::opPattern() command comprise the definition of a named pattern
- Функция ImagickDraw::rectangle() - Draws a rectangle
- Функция ImagickDraw::render() - Renders all preceding drawing commands onto the image
- ImagickDraw::resetVectorGraphics
- Функция ImagickDraw::rotate() - Applies the specified rotation to the current coordinate space
- Функция ImagickDraw::roundRectangle() - Draws a rounded rectangle
- Функция ImagickDraw::scale() - Adjusts the scaling factor
- Функция ImagickDraw::setClipPath() - Associates a named clipping path with the image
- Функция ImagickDraw::setClipRule() - Set the polygon fill rule to be used by the clipping path
- Функция ImagickDraw::setClipUnits() - Sets the interpretation of clip path units
- Функция ImagickDraw::setFillAlpha() - Sets the opacity to use when drawing using the fill color or fill texture
- Функция ImagickDraw::setFillColor() - Sets the fill color to be used for drawing filled objects
- Функция ImagickDraw::setFillOpacity() - Sets the opacity to use when drawing using the fill color or fill texture
- Функция ImagickDraw::setFillPatternURL() - Sets the URL to use as a fill pattern for filling objects
- Функция ImagickDraw::setFillRule() - Sets the fill rule to use while drawing polygons
- Функция ImagickDraw::setFont() - Sets the fully-specified font to use when annotating with text
- Функция ImagickDraw::setFontFamily() - Sets the font family to use when annotating with text
- Функция ImagickDraw::setFontSize() - Sets the font pointsize to use when annotating with text
- Функция ImagickDraw::setFontStretch() - Sets the font stretch to use when annotating with text
- Функция ImagickDraw::setFontStyle() - Sets the font style to use when annotating with text
- Функция ImagickDraw::setFontWeight() - Sets the font weight
- Функция ImagickDraw::setGravity() - Sets the text placement gravity
- ImagickDraw::setResolution
- Функция ImagickDraw::setStrokeAlpha() - Specifies the opacity of stroked object outlines
- Функция ImagickDraw::setStrokeAntialias() - Controls whether stroked outlines are antialiased
- Функция ImagickDraw::setStrokeColor() - Sets the color used for stroking object outlines
- Функция ImagickDraw::setStrokeDashArray() - Specifies the pattern of dashes and gaps used to stroke paths
- Функция ImagickDraw::setStrokeDashOffset() - Specifies the offset into the dash pattern to start the dash
- Функция ImagickDraw::setStrokeLineCap() - Specifies the shape to be used at the end of open subpaths when they are stroked
- Функция ImagickDraw::setStrokeLineJoin() - Specifies the shape to be used at the corners of paths when they are stroked
- Функция ImagickDraw::setStrokeMiterLimit() - Specifies the miter limit
- Функция ImagickDraw::setStrokeOpacity() - Specifies the opacity of stroked object outlines
- Функция ImagickDraw::setStrokePatternURL() - Sets the pattern used for stroking object outlines
- Функция ImagickDraw::setStrokeWidth() - Sets the width of the stroke used to draw object outlines
- Функция ImagickDraw::setTextAlignment() - Specifies a text alignment
- Функция ImagickDraw::setTextAntialias() - Controls whether text is antialiased
- Функция ImagickDraw::setTextDecoration() - Specifies a decoration
- Функция ImagickDraw::setTextEncoding() - Specifies specifies the text code set
- ImagickDraw::setTextInterlineSpacing
- ImagickDraw::setTextInterwordSpacing
- ImagickDraw::setTextKerning
- Функция ImagickDraw::setTextUnderColor() - Specifies the color of a background rectangle
- Функция ImagickDraw::setVectorGraphics() - Sets the vector graphics
- Функция ImagickDraw::setViewbox() - Sets the overall canvas size
- Функция ImagickDraw::skewX() - Skews the current coordinate system in the horizontal direction
- Функция ImagickDraw::skewY() - Skews the current coordinate system in the vertical direction
- Функция ImagickDraw::translate() - Applies a translation to the current coordinate system
Коментарии
You can do a pie chart with a combination of arc and polygon functions (there really ought to be a built-in command for this)
<?php
// create a new canvas object and a white image
$canvas = new Imagick();
$canvas->newImage(600, 600, 'grey');
image_pie($canvas, 300, 300, 200, 0, 45, 'red');
image_pie($canvas, 300, 300, 200, 45, 125, 'green');
image_pie($canvas, 300, 300, 200, 125, 225, 'blue');
image_pie($canvas, 300, 300, 200, 225, 300, 'cyan');
image_pie($canvas, 300, 300, 200, 300, 360, 'orange');
// output the image
$canvas->setImageFormat('png');
header("Content-Type: image/png");
echo $canvas;
exit;
// FUNCTIONS
function image_arc( &$canvas, $sx, $sy, $ex, $ey, $sd, $ed, $color = 'black' ) {
// draw arc on canvas
// $sx, $sy, $ex, $ey specify a bounding rectangle of a circle with the origin in the middle
// $sd, and $ed specify start and end angles in degrees
$draw = new ImagickDraw();
$draw->setFillColor($color);
$draw->setStrokeColor($color);
$draw->setStrokeWidth(1);
$draw->arc($sx, $sy, $ex, $ey, $sd, $ed);
$canvas->drawImage($draw);
}
function image_pie( &$canvas, $ox, $oy, $radius, $sd, $ed, $color = 'black' ) {
// draw pie segment
// $ox, $oy specify the circle origin
// $sd, and $ed specify start and end angles in degrees
// degrees start from 0 = East, and go clockwise
// position 1 - convert degrees to radians and get first point on perimeter of circle
$x1 = $radius * cos($sd / 180 * 3.1416);
$y1 = $radius * sin($sd / 180 * 3.1416);
// position 2 - convert degrees to radians and get second point on perimeter of circle
$x2 = $radius * cos($ed / 180 * 3.1416);
$y2 = $radius * sin($ed / 180 * 3.1416);
// draw segment triangle - specify the 3 points and draw a polygon
$points = array(array('x' => $ox, 'y' => $oy), array('x' => $ox + $x1, 'y' => $oy + $y1), array('x' => $ox + $x2, 'y' => $oy + $y2));
image_polygon($canvas, $points, $color);
// draw corrsesponding arc to complete the "pie" segment
image_arc($canvas, $ox - $radius, $oy - $radius, $ox + $radius, $oy + $radius, $sd, $ed, $color);
}
function image_polygon( &$canvas, $points, $color = 'black' ) {
// draw a polygon on canvas
$draw = new ImagickDraw();
$draw->setFillColor($color);
$draw->setStrokeColor($color);
$draw->setStrokeWidth(1);
$draw->polygon($points);
$canvas->drawImage($draw);
}
?>