The SWF::Gradient Module

A gradient consists of a list of color values, each value with a set position. The gradient can be scaled to fill a given region and can appear as a linear gradient or a radial gradient (illustrated back in Figure 9-4). The color of the points between the two defined end points gradually transforms from the color of the first point to the color of the second.

A gradient is constructed by adding color entries at particular positions:

my $gradient = new SWF::Gradient( );
$gradient->addEntry(0.0, 255, 0, 0);
$gradient->addEntry(1.0, 255,255,255);
my $fill = $s->addFill($gradient);
$fill->scaleTo(.1);            # A method of the SWF::Fill object

See The SWF::Fill Module for additional methods for controlling gradient fills.

Get Perl Graphics Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.