1.::SWF::Shape(3) User Contributed Perl Documentation .::SWF::Shape(3)
2
3
4
6 SWF::Shape - Shape class
7
9 use SWF::Shape;
10 $shape = new SWF::Shape();
11 $dispitem = $movie->add($shape);
12
14 SWF::Shape is the fundamental object of a flash movie.
15
17 new SWF::Shape()
18 Creates a new Shape object.
19
20 $shape->movePenTo($x, $y)
21 Move the Shape's (imaginary) pen location to ($x, $y) in the
22 Shape's coordinate space.
23
24 $shape->movePen($dx, $dy)
25 Add ($dx, $dy) to the Shape's pen current location.
26
27 $x = $shape->getPenX()
28 Returns Pen's x-coordinates
29
30 $y = $shape->getPenY()
31 Returns Pen's y-coordinates
32
33 ($x, $y) = $shape->getPen()
34 Returns Pen's (x,y) coordinates
35
36 $shape->drawLineTo($x, $y)
37 Draw a line (using current line style, set by one of the
38 setLine...() methods) from the current position to ($x, $y).
39
40 $shape->drawLine($dx, $dy)
41 Draw a line (using current line style set by one of the
42 setLine...() methods) from the current position to displacement
43 ($dx, $dy).
44
45 $shape->drawCurveTo($controlx, $controly, $anchorx, $anchory)
46 Draw a quadratic curve (using current line style, set by one of the
47 setLine...() methods) from current pen position to ($anchorx,
48 $anchory) using control point ($controlx, $controly).
49
50 $shape->drawCurve($controldx, $controly, $anchorx, $anchory)
51 Draw a quadratic curve (using current line style, set by one of the
52 setLine...() methods) from current pen position to displacement
53 ($anchordx, $anchordy) using displacement control point
54 ($controldx, $controldy).
55
56 $shape->drawCubicTo($bx,$by,$cx,$cx,$dx,$dy)
57 $shape->drawCubic($bx,$by,$cx,$cx,$dx,$dy)
58 Draw a cubic curve (using current line style). [ToDo: Add some
59 more details and demo code]
60
61 $shape->setLine($width, $r, $g, $b [,$a])
62 Sets Shape's line width and color (RGB). To remove the Shape's line
63 style call $shape->hideLine(). The used line width for drawing is
64 a product of $width argument and scale value set, see
65 SWF::setScale($scale). Arguments $r, $g, $b stand for red, green
66 and blue color parts, optional $a for alpha value.
67
68 $shape->setLineStyle($width, $r, $g, $b [,$a])
69 This OLD deprecated method is documented here only for
70 compatibility reason. The line width -in TWIPS units- is
71 independent of Ming scale value (more bug than feature).
72
73 $shape->setLine2($width, $r, $g, $b ,$a, $flags, $miterLimit)
74 A new method available for SWF version >=8 setting shape's line
75 width and color (RGBA) with additional control flags (see below)
76 and miter limit. To remove the Shape's line style call
77 $shape->hideLine(). The used line width for drawing is a product
78 of $width argument and scale value set, see SWF::setScale($scale).
79 Arguments $r, $g, $b, $a stand for red, green, blue and alpha color
80 parts. $a is not optional here.
81
82 Available flags are: Line cap style: select one of the following
83 flags (default is round cap style)
84
85 SWF_LINESTYLE_CAP_ROUND
86 SWF_LINESTYLE_CAP_NONE
87 SWF_LINESTYLE_CAP_SQUARE
88
89 Line join style: select one of the following flags (default is
90 round join style)
91
92 SWF_LINESTYLE_JOIN_ROUND
93 SWF_LINESTYLE_JOIN_BEVEL
94 SWF_LINESTYLE_JOIN_MITER
95
96 Scaling flags: disable horizontal / vertical scaling
97
98 SWF_LINESTYLE_FLAG_NOHSCALE
99 SWF_LINESTYLE_FLAG_NOVSCALE
100
101 Enable pixel hinting to correct blurry vertical / horizontal lines:
102 all anchors will be aligned to full pixels
103
104 SWF_LINESTYLE_FLAG_HINTING
105
106 Disable stroke closure: if no-close flag is set caps will be
107 applied instead of joins.
108
109 SWF_LINESTYLE_FLAG_NOCLOSE
110
111 End-cap style: default round
112
113 SWF_LINESTYLE_FLAG_ENDCAP_ROUND
114 SWF_LINESTYLE_FLAG_ENDCAP_NONE
115 SWF_LINESTYLE_FLAG_ENDCAP_SQUARE
116
117 If join style is SWF_LINESTYLE_JOIN_MITER a miter limit factor must
118 be set. Miter max length is then calculated as: max miter len =
119 miter limit * width. If join style is not miter, this value will be
120 ignored.
121
122 $shape->setLineStyle2($width, $r, $g, $b ,$a, $flags, $miterLimit)
123 This OLD deprecated method is mentioned here only for compatibility
124 reason, you'd better use setLine2().
125
126 $shape->setLine2Filled($width, $fill, $flags, $miterLimit)
127 A new method available for SWF version >=8 setting shape's line
128 width and fill style, $fill is an object of SWF::Fill class. For
129 other argument details see item $shape->setLine2().
130
131 $shape->setLine2StyleFilled($width, $fill, $flags, $miterLimit)
132 This OLD deprecated method is mentioned here only for compatibility
133 reason, you'd better use setLine2Filled().
134
135 $shape->hideLine()
136 Remove the Shape's line, i.e. make lines painted after this method
137 call invisible.
138
139 $fill = $shape->addSolidFill($r, $g, $b [,$a])
140 $fill = $shape->addFill($r, $g, $b [,$a])
141 Adds a solid fill to $shape list of fill styles and returns an
142 SWF::Fill object. This object is used with the "setLine()" method
143 described below. The default value of $a is 0.
144
145 $fill = $shape->addBitmapFill($bitmap [,FLAG])
146 $fill = $shape->addFill($bitmap [,FLAG])
147 Adds a bitmap fill to $shape list of fill styles and returns an
148 SWF::Fill object. This object is used with the "setLine()" method
149 described below.
150
151 $bitmap is an SWF::Bitmap object while FLAG argument can be
152 SWFFILL_TILED_BITMAP or SWFFILL_CLIPPED_BITMAP. Make sure to import
153 these constants to your package before useing it, i.e. use the
154 following statement:
155
156 use SWF::Fill <list of constants>;
157
158 The default value of FLAG is SWFFILL_TILED_BITMAP.
159
160 $fill = $shape->addGradientFill($gradient [,FLAG])
161 $fill = $shape->addFill($gradient [,FLAG])
162 Adds a gradient fill to $shape list of fill styles and returns an
163 SWF::Fill object. This object is used with the "setLine()" method
164 described below.
165
166 $gradient is an SWF::Gradient object while FLAG argument can be
167 SWFFILL_LINEAR_GRADIENT or SWFFILL_RADIAL_GRADIENT, plus
168 SWFFILL_FOCAL_GRADIENT for V8. Make sure to import these constants
169 to your package before useing it, i.e. use the following statement:
170
171 use SWF::Fill <list of constants>;
172
173 The default value of FLAG is SWFFILL_LINEAR_GRADIENT.
174
175 $shape->xs_setLeftFill($fill)
176 $shape->setLeftFill($fill)
177 Sets the fill on the left side of the edge. $fill is an SWF::Fill
178 object returned from "addFill" method.
179
180 $shape->setLeftFill($r, $g, $b [,$a])
181 This is another way of saying:
182
183 my $fill = $shape->addSolidFill($r, $g, $b [,$a]);
184 $shape->setLeftFill($fill);
185
186 $shape->xs_setRightFill($fill)
187 $shape->setRightFill($fill)
188 Sets the fill on the right side of the edge. $fill is an SWF::Fill
189 object returned from "addFill" method.
190
191 $shape->setRightFill($r, $g, $b [,$a])
192 This is another way of saying:
193
194 my $fill = $shape->addSolidFill($r, $g, $b [,$a]);
195 $shape->setRightFill($fill);
196
197 $shape->drawCircle($r)
198 Draws a circle with radious $r, also changes current position.
199
200 $shape->drawArc($r, $startAngle, $endAngle)
201 Draws an arc with radious $r form start to end.
202
203 $shape->useVersion(version)
204 This function allows to set the shapes version information. The
205 version is only a hint. If necessary the version is upgraded. Valid
206 values: are 3 and 4. Value of 3 is default, but 4 if linestyle2 is
207 used. Some shape features are available only for shape version 4
208 and SWF file version>=8. One example is the usage of focal
209 gradients:
210
211 $g = new SWF::Gradient();
212 $g->setFocalPoint(-0.9);
213 $g->addEntry(0.000000,0xff,0x00,0x00,0xff);
214 $g->addEntry(1.000000,0x00,0xff,0x00,0xff);
215 $shape->useVersion(4);
216 $shape->addGradientFill($g,SWFFILL_FOCAL_GRADIENT);
217
218 $version = $shape->getVersion()
219 Gets the current shape object version.
220
221 $shape->dumpOutline()
222 Returns a string describing shape's outline. After drawing in a
223 shape expect getting a multi-line string like:
224
225 moveto 368,5
226 curveto 348,5 327,1
227 curveto 307,-3 284,-15
228 etc. etc.
229
230 $shape->end()
231 Stops drawing on this shape and make the shape complete. Further
232 method calls won't produce any lines, circles etc. By using this
233 demo code later no circle is painted:
234
235 $shape->drawLineTo(300,300);
236 $shape->end();
237 $shape->drawCircle(200);
238
239 $shape->drawGlyph($font, $cnumber [, $size])
240 Draws character of $cnumber of $font. Also Unicode fonts are
241 possible, if the font does provide that, just like next example:
242
243 $font=new SWF::Font("Thai-Bold.fdb");
244 $sh->drawGlyph($font, 0x0E44, 44);
245
246 $shape->drawCharacterBounds($character)
247 Draws an outer rectangle fitting for $character, an object of
248 SWF::Character.
249
250 $shape->setRenderHintingFlags(flags)
251 Set render hinting flags. Possible values are
252 SWF::Constants::SWF_SHAPE_USESCALINGSTROKES and
253 SWF::Constants::SWF_SHAPE_USENONSCALINGSTROKES
254
255 This method also will set version of this SWF::Shape object to 4.
256
258 Soheil Seyfaie (soheil at users.sourceforge.net), Albrecht Kleine
259
261 SWF, SWF::Bitmap, SWF::Button, SWF::Constants, SWF::DisplayItem,
262 SWF::Fill, SWF::Font, SWF::Gradient, SWF::Morph, SWF::Movie,
263 SWF::MovieClip, SWF::TextField, SWF::Text, SWF::Character
264
265
266
267perl v5.30.0 2019-10-02 .::SWF::Shape(3)