Clutter::Cogl::Path(3) Path primitives for Cogl

DESCRIPTION

There are three levels on which drawing with Clutter::Cogl can be used. The highest level functions construct various simple primitive shapes to be either filled or stroked. Using a lower-level set of functions more complex and arbitrary paths can be constructed by concatenating straight line, bezier curve and arc segments. Additionally there are utility functions that draw the most common primitives - rectangles and trapezoids - in a maximaly optimized fashion.

When constructing arbitrary paths, the current pen location is initialized using the " move_to " command. The subsequent path segments implicitly use the last pen location as their first vertex and move the pen location to the last vertex they produce at the end. Also there are special versions of functions that allow specifying the vertices of the path segments relative to the last pen location rather then in the absolute coordinates.

METHODS

Clutter::Cogl::Path->arc ($center_x, $center_y, $radius_x, $radius_y, $angle_start, $angle_end)

  • $center_x (double)
  • $center_y (double)
  • $radius_x (double)
  • $radius_y (double)
  • $angle_start (double)
  • $angle_end (double)

Adds an elliptical arc segment to the current path. A straight line segment will link the current pen location with the first vertex of the arc. If you perform a move_to to the arc start just before drawing it you create a free standing arc.

Clutter::Cogl::Path->clear

Clears the current path and starts a new one.

Clutter::Cogl::Path->close

Closes the path being constructed by adding a straight line segment to it that ends at the first vertex of the path

Clutter::Cogl::Path->curve_to ($x1, $y1, $x2, $y2, $x3, $y3)

  • $x1 (double)
  • $y1 (double)
  • $x2 (double)
  • $y2 (double)
  • $x3 (double)
  • $y3 (double)

Adds a cubic bezier curve segment to the current path with the given second, third and fourth control points and using current pen location as the first control point.

Clutter::Cogl::Path->ellipse ($center_x, $center_y, $radius_x, $radius_y)

  • $center_x (double)
  • $center_y (double)
  • $radius_x (double)
  • $radius_y (double)

Clears the previously constructed shape and constructs an ellipse shape

Clutter::Cogl::Path->fill

Fills the constructed shape using the current drawing color

Clutter::Cogl::Path->fill_preserve

Fills the constructed shape using the current drawing color and preserves the path to be used again.

Clutter::Cogl::Path->line ($x1, $y1, $x2, $y2)

  • $x1 (double)
  • $y1 (double)
  • $x2 (double)
  • $y2 (double)

Clears the previously constructed shape and constructs a straight line shape start and ending at the given coordinates

Clutter::Cogl::Path->line_to ($x, $y)

  • $x (double)
  • $y (double)

Adds a straight line segment to the current path that ends at the given coordinates

Clutter::Cogl::Path->move_to ($x, $y)

  • $x (double)
  • $y (double)

Clears the previously constructed shape and begins a new path contour by moving the pen to the given coordinates

Clutter::Cogl::Path->rectangle ($x1, $y1, $x2, $y2)

  • $x1 (double)
  • $y1 (double)
  • $x2 (double)
  • $y2 (double)

Clears the previously constructed shape and constructs a rectangular shape at the given coordinates

Clutter::Cogl::Path->rel_curve_to ($x1, $y1, $x2, $y2, $x3, $y3)

  • $x1 (double)
  • $y1 (double)
  • $x2 (double)
  • $y2 (double)
  • $x3 (double)
  • $y3 (double)

Adds a cubic bezier curve segment to the current path with the given second, third and fourth control points and using current pen location as the first control point. The given coordinates are relative to the current pen location

Clutter::Cogl::Path->rel_line_to ($x, $y)

  • $x (double)
  • $y (double)

Adds a straight line segment to the current path that ends at the given coordinates relative to the current pen location

Clutter::Cogl::Path->rel_move_to ($x, $y)

  • $x (double)
  • $y (double)

Clears the previously constructed shape and begins a new path contour by moving the pen to the given coordinates relative to the current pen location

Clutter::Cogl::Path->round_rectangle ($x1, $y1, $x2, $y2, $radius, $arc_step)

  • $x1 (double)
  • $y1 (double)
  • $x2 (double)
  • $y2 (double)
  • $radius (double)
  • $arc_step (double)

Clears the previously constructed shape and constructs a rectangular shape with rounded corners

Clutter::Cogl::Path->stroke

Strokes the constructed shape using the current drawing color and a width of 1 pixel (regardless of the current transformation matrix)

Clutter::Cogl::Path->stroke_preserve

Strokes the constructed shape using the current drawing color and preserves the path to be used again.

COPYRIGHT

Copyright (C) 2006, 2007, 2008 OpenedHand Ltd

Copyright (C) 2009 Intel Corporation

This module is free software; you can redistribute it and/or modify it under the terms of either:

  • the GNU Lesser General Public Library version 2.1; or
  • the Artistic License, version 2.0.

See Clutter for the full copyright notice.