1Prima::Drawable::Path(3U)ser Contributed Perl DocumentatiPornima::Drawable::Path(3)
2
3
4

NAME

6       Prima::Drawable::Path - stroke and fill complex paths
7

DESCRIPTION

9       The module augments the "Prima::Drawable" drawing and plotting
10       functionality by implementing paths that allow arbitrary combination of
11       polylines, splines, and arcs, to be used for drawing or clipping
12       shapes.
13

SYNOPSIS

15               # draws elliptic spiral
16               my ( $d1, $dx ) = ( 0.8, 0.05 );
17               $canvas-> new_path->
18                       rotate(45)->
19                       translate(200, 100)->
20                       scale(200, 100)->
21                       arc( 0, 0, $d1 + $dx * 0, $d1 + $dx * 1, 0, 90)->
22                       arc( 0, 0, $d1 + $dx * 2, $d1 + $dx * 1, 90, 180)->
23                       arc( 0, 0, $d1 + $dx * 2, $d1 + $dx * 3, 180, 270)->
24                       arc( 0, 0, $d1 + $dx * 4, $d1 + $dx * 3, 270, 360)->
25               stroke;
26

API

28   Primitives
29       All primitives come in two versions, with absolute and relative
30       coordinates.  The absolute version draws a graphic primitive so that
31       its starting point (or a reference point) is at (0,0). The relative
32       version, called with an 'r' (f.ex. "line" vs "rline") has its starting
33       point as the ending point of the previous primitive (or (0,0) if
34       there's none).
35
36       arc CENTER_X, CENTER_Y, DIAMETER_X, DIAMETER_Y, ANGLE_START, ANGLE_END,
37       TILT = 0
38           Adds elliptic arc to path centered around (CENTER_X,CENTER_Y).
39
40           Important: if the intention is an immediate rendering, especially
41           with 1-pixel line width, consider decreasing diameters by 1. This
42           is because all arc calculations are made with floating point, where
43           diameter is also given not in pixels but in geometrical
44           coordinates, to allow for matrix transformations.  Before rendering
45           is performed, arcs are tranformed into spline vertices and then
46           transformation matrix is applied, and by that time the notion of an
47           arc diameter is lost to be successfully converted into pixel size
48           minus one.
49
50       close, open
51           Closes the current shape and opens a new one close() is same as
52           open() but makes sure the shape's first point is equal to its last
53           point.
54
55       circular_arc ANGLE_START, ANGLE_END
56           Adds circular arc to the path. Note that adding transformations
57           will effectively make it into elliptic arc, which is used
58           internally by "arc" and "rarc".
59
60       chord CENTER_X, CENTER_Y, DIAMETER_X, DIAMETER_Y, ANGLE_START,
61       ANGLE_END.
62           Adds chord to the path. Is there only for compatibility with
63           "Prima::Drawable".
64
65       ellipse CENTER_X, CENTER_Y, DIAMETER_X, DIAMETER_Y = DIAMETER_X, TILT =
66       0
67           Adds full ellipse to the path.
68
69       glyph INDEX, %OPTIONS
70           Adds glyph outline to the path. %OPTIONS are passed as is to
71           "renger_glyph" in Prima::Drawable.  Note that filled glyphs require
72           "fillMode" without the "fm::Overlay" bit set and "fill" option set
73           to generate proper shapes with holes.
7