CairoContext::arc
cairo_arc
(PECL cairo >= 0.1.0)
CairoContext::arc -- cairo_arc — Adds a circular arc
Description
Object oriented style (method):
$x
, float $y
, float $radius
, float $angle1
, float $angle2
)Procedural style:
$context
, float $x
, float $y
, float $radius
, float $angle1
, float $angle2
)
Adds a circular arc of the given radius to the current path.
The arc is centered at (x
, y
), begins at
angle1
and proceeds in the direction of increasing angles to end at
angle2
.
If angle2
is less than angle1
it will be
progressively increased by 2*M_PI until it is greater than angle1
.
If there is a current point, an initial line segment will be added to the path to connect the
current point to the beginning of the arc. If this initial line is undesired,
it can be avoided by calling CairoContext::newSubPath() or procedural
cairo_new_sub_path() before calling CairoContext::arc()
or cairo_arc().
Angles are measured in radians. An angle of 0.0 is in the direction of the positive X axis
(in user space). An angle of M_PI/2.0 radians (90 degrees) is in the direction of the positive
Y axis (in user space). Angles increase in the direction from the positive X axis toward the
positive Y axis. So with the default transformation matrix, angles increase in a clockwise direction.
(To convert from degrees to radians, use degrees * (M_PI / 180.).)
This function gives the arc in the direction of increasing angles; see
CairoContext::arcNegative() or cairo_arc_negative()
to get the arc in the direction of decreasing angles.
Parameters
-
context
-
A valid CairoContext object
-
x
-
x position
-
y
-
y position
-
radius
-
Radius of the arc
-
angle1
-
start angle
-
angle2
-
end angle
Return Values
No value is returned.
Examples
Example #1 Object oriented style
<?php
$s = new CairoImageSurface(CairoFormat::ARGB32, 100, 100);
$c = new CairoContext($s);
$c->setSourceRgb(0, 0, 0);
$c->paint();
$c->setLineWidth(1);
$c->setSourceRgb(1, 1, 1);
for ($r = 50; $r > 0; $r -= 10) {
$c->arc(50, 50, $r, 0, 2 * M_PI);
$c->stroke();
$c->fill();
}
$s->writeToPng(dirname(__FILE__) . '/CairoContext__arc.png');
?>
Example #2 Procedural style
<?php
$s = cairo_image_surface_create(CAIRO_SURFACE_TYPE_IMAGE, 100, 100);
$c = cairo_create($s);
cairo_set_source_rgb($c, 0, 0, 0);
cairo_paint($c);
cairo_set_source_rgb($c, 1, 1, 1);
cairo_set_line_width($c, 1);
for ($r = 50; $r > 0; $r -= 10) {
cairo_arc($c, 50, 50, $r, 0, 2 * M_PI);
cairo_stroke($c);
cairo_fill($c);
}
cairo_surface_write_to_png($s, dirname(__FILE__) . '/cairo_arc.png');
?>
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Обработка и генерация изображений
- Cairo
- Функция CairoContext::appendPath() - Appends a path to current path
- Функция CairoContext::arc() - Adds a circular arc
- Функция CairoContext::arcNegative() - Adds a negative arc
- Функция CairoContext::clip() - Establishes a new clip region
- Функция CairoContext::clipExtents() - Computes the area inside the current clip
- Функция CairoContext::clipPreserve() - Establishes a new clip region from the current clip
- Функция CairoContext::clipRectangleList() - Retrieves the current clip as a list of rectangles
- Функция CairoContext::closePath() - Closes the current path
- Функция CairoContext::__construct() - Creates a new CairoContext
- Функция CairoContext::copyPage() - Emits the current page
- Функция CairoContext::copyPath() - Creates a copy of the current path
- Функция CairoContext::copyPathFlat() - Gets a flattened copy of the current path
- Функция CairoContext::curveTo() - Adds a curve
- Функция CairoContext::deviceToUser() - Transform a coordinate
- Функция CairoContext::deviceToUserDistance() - Transform a distance
- Функция CairoContext::fill() - Fills the current path
- Функция CairoContext::fillExtents() - Computes the filled area
- Функция CairoContext::fillPreserve() - Fills and preserve the current path
- Функция CairoContext::fontExtents() - Get the font extents
- Функция CairoContext::getAntialias() - Retrives the current antialias mode
- Функция CairoContext::getCurrentPoint() - The getCurrentPoint purpose
- Функция CairoContext::getDash() - The getDash purpose
- Функция CairoContext::getDashCount() - The getDashCount purpose
- Функция CairoContext::getFillRule() - The getFillRule purpose
- Функция CairoContext::getFontFace() - The getFontFace purpose
- Функция CairoContext::getFontMatrix() - The getFontMatrix purpose
- Функция CairoContext::getFontOptions() - The getFontOptions purpose
- Функция CairoContext::getGroupTarget() - The getGroupTarget purpose
- Функция CairoContext::getLineCap() - The getLineCap purpose
- Функция CairoContext::getLineJoin() - The getLineJoin purpose
- Функция CairoContext::getLineWidth() - The getLineWidth purpose
- Функция CairoContext::getMatrix() - The getMatrix purpose
- Функция CairoContext::getMiterLimit() - The getMiterLimit purpose
- Функция CairoContext::getOperator() - The getOperator purpose
- Функция CairoContext::getScaledFont() - The getScaledFont purpose
- Функция CairoContext::getSource() - The getSource purpose
- Функция CairoContext::getTarget() - The getTarget purpose
- Функция CairoContext::getTolerance() - The getTolerance purpose
- Функция CairoContext::glyphPath() - The glyphPath purpose
- Функция CairoContext::hasCurrentPoint() - The hasCurrentPoint purpose
- Функция CairoContext::identityMatrix() - The identityMatrix purpose
- Функция CairoContext::inFill() - The inFill purpose
- Функция CairoContext::inStroke() - The inStroke purpose
- Функция CairoContext::lineTo() - The lineTo purpose
- Функция CairoContext::mask() - The mask purpose
- Функция CairoContext::maskSurface() - The maskSurface purpose
- Функция CairoContext::moveTo() - The moveTo purpose
- Функция CairoContext::newPath() - The newPath purpose
- Функция CairoContext::newSubPath() - The newSubPath purpose
- Функция CairoContext::paint() - The paint purpose
- Функция CairoContext::paintWithAlpha() - The paintWithAlpha purpose
- Функция CairoContext::pathExtents() - The pathExtents purpose
- Функция CairoContext::popGroup() - The popGroup purpose
- Функция CairoContext::popGroupToSource() - The popGroupToSource purpose
- Функция CairoContext::pushGroup() - The pushGroup purpose
- Функция CairoContext::pushGroupWithContent() - The pushGroupWithContent purpose
- Функция CairoContext::rectangle() - The rectangle purpose
- Функция CairoContext::relCurveTo() - The relCurveTo purpose
- Функция CairoContext::relLineTo() - The relLineTo purpose
- Функция CairoContext::relMoveTo() - The relMoveTo purpose
- Функция CairoContext::resetClip() - The resetClip purpose
- Функция CairoContext::restore() - The restore purpose
- Функция CairoContext::rotate() - The rotate purpose
- Функция CairoContext::save() - The save purpose
- Функция CairoContext::scale() - The scale purpose
- Функция CairoContext::selectFontFace() - The selectFontFace purpose
- Функция CairoContext::setAntialias() - The setAntialias purpose
- Функция CairoContext::setDash() - The setDash purpose
- Функция CairoContext::setFillRule() - The setFillRule purpose
- Функция CairoContext::setFontFace() - The setFontFace purpose
- Функция CairoContext::setFontMatrix() - The setFontMatrix purpose
- Функция CairoContext::setFontOptions() - The setFontOptions purpose
- Функция CairoContext::setFontSize() - The setFontSize purpose
- Функция CairoContext::setLineCap() - The setLineCap purpose
- Функция CairoContext::setLineJoin() - The setLineJoin purpose
- Функция CairoContext::setLineWidth() - The setLineWidth purpose
- Функция CairoContext::setMatrix() - The setMatrix purpose
- Функция CairoContext::setMiterLimit() - The setMiterLimit purpose
- Функция CairoContext::setOperator() - The setOperator purpose
- Функция CairoContext::setScaledFont() - The setScaledFont purpose
- Функция CairoContext::setSource() - The setSource purpose
- Функция CairoContext::setSourceRGB() - The setSourceRGB purpose
- Функция CairoContext::setSourceRGBA() - The setSourceRGBA purpose
- Функция CairoContext::setSourceSurface() - The setSourceSurface purpose
- Функция CairoContext::setTolerance() - The setTolerance purpose
- Функция CairoContext::showPage() - The showPage purpose
- Функция CairoContext::showText() - The showText purpose
- Функция CairoContext::status() - The status purpose
- Функция CairoContext::stroke() - The stroke purpose
- Функция CairoContext::strokeExtents() - The strokeExtents purpose
- Функция CairoContext::strokePreserve() - The strokePreserve purpose
- Функция CairoContext::textExtents() - The textExtents purpose
- Функция CairoContext::textPath() - The textPath purpose
- Функция CairoContext::transform() - The transform purpose
- Функция CairoContext::translate() - The translate purpose
- Функция CairoContext::userToDevice() - The userToDevice purpose
- Функция CairoContext::userToDeviceDistance() - The userToDeviceDistance purpose
Коментарии
404 Not Found