Graphics::Primitive::Path - Collection of primitives
Graphics::Primitive::Path is a shape defined by a list of primitives.
use Graphics::Primitive::Path; my $path = Graphics::Primitive::Path->new(); $path->add_primitive($line); $path->move_to($point);
Creates a new Graphics::Primitive::Path
- add_primitive ($prim)
Add a primitive to this Path.
- arc ($radius, $start, $end, [ $skip_line_to ])
$path->arc($radius, $start_angle_in_radians, $end_angle_in_radians);
Draw an arc based at the current point with the given radius from the given start angle to the given end angle. A line will be drawn from the current_point to the start point of the described arc. If you do not want this to happen, supply a true value as the last argument.
Clears the current point on this Path.
Clears all primitives from this Path. NOTE: This does not clear the current point.
Close the current path by drawing a line from the current_point back to the first point in the path.
Flag this path as being contiguous at this point. Continuity is important so some path-based drivers such as Cairo. You should not mess with this attribute unless you know what you are doing. It's used for driver hinting.
Returns the current -- or last -- point on this Path.
- curve_to ($control1, $control2, $end)
Creates a cubic Bézier curve from the current point to the $end point using $control1 and $control2 as control points.
- ellipse ($width, $height, [ $skip_line_to ])
Creates an ellipse at the current point with the specified width and height. Optional last argument, if true, skips drawing a line to the ellipse's starting point.
Get this path as a series of points.
Returns the primitive at the specified offset.
List of hint hashrefs. This hint arrayref matches the primitives arrayref one-to-one. Hints are tidbits of information that may assist drivers in optimizing (or successfully handling) primitives in this path's list. You should not mess with this structure unless you know what you are doing.
- line_to ($point | $x, $y)
Draw a line from the current point to the one provided. Accepts either a Geoemetry::Primitive::Point or two arguments for x and y.
- move_to ($point | $x, $y)
Move the current point to the one specified. This will not add any primitives to the path. Accepts either a Geoemetry::Primitive::Point or two arguments for x and y.
Returns the number of primitives on this Path.
- rectangle ($width, $height)
Draw a rectangle at current_position of the specified width and height.
- rel_curve_to ($x1, $y1, $x2, $y2, $x3, $y3)
Creates a cubic Bézier curve from the current point using the provided values as offsets:
start = current point control1 = current point + $x1,$y1 control1 = current point + $x2,$y2 end = current point + $x3,$y3
- rel_line_to ($x_amount, $y_amount)
Draw a line by adding the supplied x and y values to the current one. For example if the current point is 5,5 then calling rel_line_to(2, 2) would draw a line from the current point to 7,7.
- rel_move_to ($x_amount, $y_amount)
Move to a new point by adding the supplied x and y values to the current ones.
Cory Watson <firstname.lastname@example.org>
Copyright 2008-2010 by Cory G Watson.
You can redistribute and/or modify this code under the same terms as Perl itself.