1Prima::Drawable::GradieUnste(r3)Contributed Perl DocumenPtraitmiao:n:Drawable::Gradient(3)
2
3
4
6 Prima::Drawable::Gradient - gradient fills for primitives
7
9 Prima offers primitive gradient services to draw gradually changing
10 colors. A gradient is requested by setting of at least two colors and
11 optionally a set of quadratic spline points that, when, projected,
12 generate the transition curve between the colors.
13
14 The module augments the "Prima::Drawable" drawing functionality by
15 adding "new_gradient" function.
16
18 $canvas-> new_gradient(
19 palette => [ cl::White, cl::Blue, cl::White ],
20 )-> sector(50,50,100,100,0,360);
21
23 Methods
24 new $CANVAS, %OPTIONS
25 Here are %OPTIONS understood in the gradient request:
26
27 clone %OPTIONS
28 Creates a new gradient object with %OPTIONS replaced.
29
30 widgetClass INTEGER
31 Points to a widget class to resolve generic colors like
32 "cl::Back", that may differ from widget class to widget class.
33
34 palette @COLORS
35 Each color is a "cl::" value. The gradient is calculated as
36 polyline where each its vertex corresponds to a certain blend
37 between two neighbouring colors in the palette. F.ex. the
38 simplest palette going from "cl::White" to "cl::Black" over a
39 polyline 0..1 (default), produces pure white color at the start
40 and pure black color at the end, filling all available shades
41 of gray in between, and changing monotonically.
42
43 poly @VERTICES
44 Set of 2-integer polyline vertexes where the first integer is a
45 coordinate (x, y, or whatever required by the drawing
46 primitive) between 0 and 1, and the second is the color blend
47 value between 0 and 1.
48
49 Default: ((0,0),(1,1))
50
51 spline \@VERTICES, %OPTIONS
52 Serving same purpose as "poly" but vertexes are projected first
53 to a B-spline curve using render_spline and %OPTIONS. The
54 resulting polyline is treated as "poly".
55
56 vertical BOOLEAN
57 Only used in bar, to set gradient direction.
58
59 See also: bar, stripes .
60
61 bar X1, Y1, X2, Y2, VERTICAL = 0
62 Draws a filled rectangle within (X1,Y1) - (X2,Y2) extents
63
64 Context used: fillPattern, rop, rop2
65
66 ellipse X, Y, DIAM_X, DIAM_Y
67 Draws a filled ellipse with center in (X,Y) and diameters
68 (DIAM_X,DIAM_Y)
69
70 Context used: fillPattern, rop, rop2
71
72 sector X, Y, DIAM_X, DIAM_Y, START_ANGLE, END_ANGLE
73 Draws a filled sector with center in (X,Y) and diameters
74 (DIAM_X,DIAM_Y) from START_ANGLE to END_ANGLE
75
76 Context used: fillPattern, rop, rop2
77
78 stripes BREADTH
79 Returns an array consisting of integer pairs, where the first one
80 is a color value, and the second is the breadth of the color strip.
81 bar uses this information to draw a gradient fill, where each color
82 strip is drawn with its own color. Can be used for implementing
83 other gradient-aware primitives (see examples/f_fill.pl )
84
86 Dmitry Karasik, <dmitry@karasik.eu.org>.
87
89 Prima::Drawable, examples/f_fill.pl, examples/gradient.pl
90
91
92
93perl v5.28.0 2017-05-08 Prima::Drawable::Gradient(3)