Prima::...Gradient(3)
π NAME π
Prima::Drawable::Gradient β gradient fills for primitives
Okay bestie, this manual page is Prima::...Gradient(3) from the User Contributed Perl Documentation, and it's here to make your primitives fade like a main character. π
β¨
π DESCRIPTION π
Prima has simple gradient services for drawing colors that gradually change. You make a gradient by setting at least two colors, and optionally a set of points that, when projected, generate the transition curve between the colors.
The module augments the Prima::Drawable drawing functionality by adding the new_gradient function.
π SYNOPSIS π
$canvas-> new_gradient(
palette => [ cl::White, cl::Blue, cl::White ],
)-> sector(50,50,100,100,0,360);
π§ API π§
π οΈ Methods π οΈ
clone %OPTIONSβ Creates a new gradient object with%OPTIONSreplaced.new $CANVAS, %OPTIONSβ Creates a new gradient object. These are the%OPTIONSavailable:dither BOOLEAN = 0β When set, it applies not only gradient colors but also different fill patterns, creating an even smoother transition effect between adjacent colors. It works significantly slower.palette @COLORSβ Each color is acl::value. The gradient is calculated as a polyline where each of its vertices corresponds to a certain blend between two adjacent colors in the palette. F.ex. the simplest palette going fromcl::Whitetocl::Blackover a transition line0..1(default), produces a pure white color at the start and a pure black color at the end, with all available shades of gray in between.poly @VERTICESβ A set of 2-integer polyline vertices where the first integer is a coordinate (x,y, or whatever is required by the drawing primitive) between0and1, and the second is the color blend value between0and1. Default:((0,0),(1,1))spline \@VERTICES, %OPTIONSβ Serving the same purpose as thepolyoption, but the vertices are projected first to a B-spline curve usingrender_splineand%OPTIONS. The resulting polyline is treated aspoly.vertical BOOLEANβ Only used in thebarprimitive, to set the gradient direction.widgetClass INTEGERβ Points to the widget class to resolve generic colors likecl::Backthat may differ between widget classes.
Also see bar and stripes.
bar X1, Y1, X2, Y2, VERTICAL = 0β Draws a filled rectangle with(X1,Y1)-(X2,Y2)extents.
Context used: fillPattern, rop, rop2
colors BREADTHβ Returns a list of gradient colors for each step from1toBREADTH. Whenditheris set, each color is an array of three items β the two adjacent colors and an integer value between0and63that reflects the amount of blending needed between the colors.ellipse X, Y, DIAM_X, DIAM_Yβ Draws a filled ellipse with the center in(X,Y)and diameters(DIAM_X,DIAM_Y).
Context used: fillPattern, rop, rop2
sector X, Y, DIAM_X, DIAM_Y, START_ANGLE, END_ANGLEβ Draws a filled sector with the center in(X,Y)and diameters(DIAM_X,DIAM_Y)fromSTART_ANGLEtoEND_ANGLE.
Context used: fillPattern, rop, rop2
stripes BREADTHβ Returns an array consisting of integer pairs, where the first one is a color value, and the second is the breadth of the color strip.baruses this information to draw a gradient fill, where each color strip is drawn with its own color. Can be used for implementing other gradient-aware primitives (seeexamples/f_fill.pl).
π AUTHOR π
The author is Dmitry Karasik, <dmitry@karasik.eu.org>.
π¦ SEE ALSO π¦
Go peek at Prima::Drawable, examples/f_fill.pl, and examples/gradient.pl.
Sign-off: this page is perl v5.42.0, dated 2024-08-20, and filed under Prima::...Gradient(3). Stay gradient, bestie ππ«Ά
π¦ where this page comes from
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms