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 colors BREADTH
67 Returns a list of gradient colors for each step from 1 to BREADTH.
68
69 ellipse X, Y, DIAM_X, DIAM_Y
70 Draws a filled ellipse with center in (X,Y) and diameters
71 (DIAM_X,DIAM_Y)
72
73 Context used: fillPattern, rop, rop2
74
75 sector X, Y, DIAM_X, DIAM_Y, START_ANGLE, END_ANGLE
76 Draws a filled sector with center in (X,Y) and diameters
77 (DIAM_X,DIAM_Y) from START_ANGLE to END_ANGLE
78
79 Context used: fillPattern, rop, rop2
80
81 stripes BREADTH
82 Returns an array consisting of integer pairs, where the first one
83 is a color value, and the second is the breadth of the color strip.
84 bar uses this information to draw a gradient fill, where each color
85 strip is drawn with its own color. Can be used for implementing
86 other gradient-aware primitives (see examples/f_fill.pl )
87
89 Dmitry Karasik, <dmitry@karasik.eu.org>.
90
92 Prima::Drawable, examples/f_fill.pl, examples/gradient.pl
93
94
95
96perl v5.36.0 2022-07-22 Prima::Drawable::Gradient(3)