CairoContext::closePath

cairo_close_path

Closes the current path

Description

Object oriented style (method):

public void CairoContext::closePath ( void )

Procedural style:

void cairo_close_path ( CairoContext $context )

Adds a line segment to the path from the current point to the beginning of the current sub-path, (the most recent point passed to CairoContext::moveTo), and closes this sub-path. After this call the current point will be at the joined endpoint of the sub-path.

The behavior of close_path() is distinct from simply calling CairoContext::lineTo with the equivalent coordinate in the case of stroking. When a closed sub-path is stroked, there are no caps on the ends of the sub-path. Instead, there is a line join connecting the final and initial segments of the sub-path.

If there is no current point before the call to CairoContext::closePath, this function will have no effect.

Parameters

context

A valid CairoContext object created with CairoContext::__construct or cairo_create

Return Values

No value is returned.

Examples

Example #1 Object oriented style

<?php

$surface 
= new CairoImageSurface(CairoFormat::ARGB325050);

$context = new CairoContext($surface);

$context->closePath();

?>

Example #2 Procedural style

<?php

$surface 
cairo_image_surface_create(CAIRO_FORMAT_ARGB325050);

$context cairo_create($surface);

cairo_close_path($context);

?>

See Also

  • CairoContext::copyPath