1.::SWF::Gradient(3) User Contributed Perl Documentation .::SWF::Gradient(3)
2
3
4
6 SWF::Gradient - SWF gradient class
7
9 use SWF::Gradient;
10 use SWF::Constants qw(:Gradient);
11 use SWF::Shape;
12 $g = new SWF::Gradient();
13 $g->addEntry(0.0,255,0,0,200);
14 $g->addEntry(0.16,255,255,0,200);
15 $g->addEntry(0.32,0,255,0,200);
16 $g->addEntry(0.5,0,255,255,200);
17 $g->addEntry(0.66,0,50,255,200);
18 $g->addEntry(0.83 ,255,0,255,200);
19 $g->addEntry(1.0,255,0,0,200);
20 # ..make some kind of rainbow..
21 $sh = new SWF::Shape();
22 $fill = $sh->addGradientFill($g,SWFFILL_LINEAR_GRADIENT);
23
25 SWF::Gradient is a helper class most useful for filling shapes (i.e.
26 SWF::Shape objects), and also for filtering via SWF::DisplayItem
27 methods using GradientGlowFilter or GradientBevelFilter, both are
28 SWF::Filter objects.
29
31 new SWF::Gradient()
32 Creates and returns a gradient object. This object is an 'empty'
33 gradient, to be filled with control point entries via up to 15
34 addEntry() method calls. (For SWF version 7 are only 8 control
35 points possible.) For gradients used for filters also only 8
36 control points are possible.
37
38 addEntry($ratio, $r, $g, $b [, $a])
39 Adds a gradient control point. The ratio parameter is a floating
40 point value for controlling the position of the following RGBA-
41 color value (consiting of red, green, blue and optional alpha
42 parts) in an increasing row between 0.0 and 1.0 . Adding more than
43 15 entries will be useless and ignored.
44
45 setSpreadMode($mode)
46 For version >= 8 only: set a gradient spread mode: one of
47 SWF_GRADIENT_PAD (default), SWF_GRADIENT_REPEAT,
48 SWF_GRADIENT_REFLECT .
49
50 setInterpolationMode($mode)
51 For version >= 8 only: set a gradient interpolation mode: one of
52 SWF_GRADIENT_NORMAL (default), SWF_GRADIENT_LINEAR .
53
54 setFocalPoint($focalpoint)
55 Makes a focal gradient 'asymetric'. A focalpoint value of -1.0
56 means the focal point is close to the left border, 0.0 is in the
57 center and 1.0 is close to the right border. Also this feature is
58 available for version >= 8 only. For best results use the
59 SWFFILL_FOCAL_GRADIENT flag when adding to v4 shapes, i.e. like
60
61 $g = new SWF::Gradient();
62 $g->setFocalPoint(-0.9);
63 $g->addEntry(0.000000,0xff,0x00,0x00,0xff);
64 $g->addEntry(1.000000,0x00,0xff,0x00,0xff);
65 $shape->useVersion(4);
66 $shape->addGradientFill($g,SWFFILL_FOCAL_GRADIENT);
67
69 developers of
70 ming.sourceforge.net
71
73 SWF, SWF::Shape, SWF::Fill, SWF::Filter, SWF::Constants
74
75
76
77perl v5.32.0 2020-07-28 .::SWF::Gradient(3)