File: SWF%3A%3AShape.html

package info (click to toggle)
ming 1%3A0.4.3-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 27,236 kB
  • ctags: 11,055
  • sloc: ansic: 55,058; sh: 9,111; cpp: 3,752; yacc: 2,808; makefile: 2,155; python: 1,864; perl: 1,472; php: 678; tcl: 13
file content (419 lines) | stat: -rw-r--r-- 14,123 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SWF::Shape - Shape class</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:feedback@suse.de" />
</head>

<body style="background-color: white">


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#methods">METHODS</a></li>
	<li><a href="#author">AUTHOR</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
</ul>

<hr name="index" />
</div>
<!-- INDEX END -->

<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>SWF::Shape - Shape class</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
        use SWF::Shape;
        $shape = new SWF::Shape();
        $dispitem = $movie-&gt;add($shape);</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>SWF::Shape is the fundamental object of a flash movie.</p>
<p>
</p>
<hr />
<h1><a name="methods">METHODS</a></h1>
<dl>
<dt><strong><a name="shape" class="item">new SWF::Shape()</a></strong>

<dd>
<p>Creates a new Shape object.</p>
</dd>
</li>
<dt><strong><a name="movepento" class="item">$shape-&gt;movePenTo($x, $y)</a></strong>

<dd>
<p>Move the Shape's (imaginary) pen location to ($x, $y) in the Shape's coordinate space.</p>
</dd>
</li>
<dt><strong><a name="movepen" class="item">$shape-&gt;movePen($dx, $dy)</a></strong>

<dd>
<p>Add ($dx, $dy) to the Shape's pen current location.</p>
</dd>
</li>
<dt><strong><a name="getpenx" class="item">$x = $shape-&gt;<code>getPenX()</code></a></strong>

<dd>
<p>Returns Pen's x-coordinates</p>
</dd>
</li>
<dt><strong><a name="getpeny" class="item">$y = $shape-&gt;<code>getPenY()</code></a></strong>

<dd>
<p>Returns Pen's y-coordinates</p>
</dd>
</li>
<dt><strong><a name="getpen" class="item">($x, $y) = $shape-&gt;<code>getPen()</code></a></strong>

<dd>
<p>Returns Pen's (x,y) coordinates</p>
</dd>
</li>
<dt><strong><a name="drawlineto" class="item">$shape-&gt;drawLineTo($x, $y)</a></strong>

<dd>
<p>Draw a line (using current line style, set by one of the setLine...() methods) from the current position to ($x, $y).</p>
</dd>
</li>
<dt><strong><a name="drawline" class="item">$shape-&gt;drawLine($dx, $dy)</a></strong>

<dd>
<p>Draw a line (using current line style set by one of the setLine...() methods) from the current position to displacement ($dx, $dy).</p>
</dd>
</li>
<dt><strong><a name="drawcurveto" class="item">$shape-&gt;drawCurveTo($controlx, $controly, $anchorx, $anchory)</a></strong>

<dd>
<p>Draw a quadratic curve (using current line style, set by one of the setLine...() methods)
from current pen position to ($anchorx, $anchory) using control point ($controlx, $controly).</p>
</dd>
</li>
<dt><strong><a name="drawcurve" class="item">$shape-&gt;drawCurve($controldx, $controly, $anchorx, $anchory)</a></strong>

<dd>
<p>Draw a quadratic curve (using current line style, set by one of the setLine...() methods)
from current pen position to displacement ($anchordx, $anchordy) using displacement control point ($controldx, $controldy).</p>
</dd>
</li>
<dt><strong><a name="drawcubicto" class="item">$shape-&gt;<code>drawCubicTo($bx,$by,$cx,$cx,$dx,$dy)</code></a></strong>

<dt><strong><a name="drawcubic" class="item">$shape-&gt;<code>drawCubic($bx,$by,$cx,$cx,$dx,$dy)</code></a></strong>

<dd>
<p>Draw a cubic curve (using current line style).
[ToDo: Add some more details and demo code]</p>
</dd>
</li>
<dt><strong><a name="setline" class="item">$shape-&gt;setLine($width, $r, $g, $b [,$a])</a></strong>

<dd>
<p>Sets Shape's line width and color (RGB). To remove the Shape's line style call $shape-&gt;<a href="#hideline"><code>hideLine()</code></a>.
The used line width for drawing is a product of $width argument and scale value set, see SWF::setScale($scale).
Arguments $r, $g, $b stand for red, green and blue color parts, optional $a for alpha value.</p>
</dd>
</li>
<dt><strong><a name="setlinestyle" class="item">$shape-&gt;setLineStyle($width, $r, $g, $b [,$a])</a></strong>

<dd>
<p>This OLD deprecated method is documented here only for compatibility reason.
The line width -in TWIPS units- is independent of Ming scale value (more bug than feature).</p>
</dd>
</li>
<dt><strong><a name="setline2" class="item">$shape-&gt;setLine2($width, $r, $g, $b ,$a, $flags, $miterLimit)</a></strong>

<dd>
<p>A new method available for SWF version &gt;=8 setting shape's line width and color (RGBA) with additional
control flags (see below) and miter limit. To remove the Shape's line style call $shape-&gt;<a href="#hideline"><code>hideLine()</code></a>.
The used line width for drawing is a product of $width argument and scale value set, see SWF::setScale($scale).
Arguments $r, $g, $b, $a stand for red, green, blue and alpha color parts. $a is not optional here.</p>
</dd>
<dd>
<p>Available flags are:
Line cap style: select one of the following flags (default is round cap style)</p>
</dd>
<dd>
<pre>
        SWF_LINESTYLE_CAP_ROUND 
        SWF_LINESTYLE_CAP_NONE
        SWF_LINESTYLE_CAP_SQUARE</pre>
</dd>
<dd>
<p>Line join style: select one of the following flags (default is round join style)</p>
</dd>
<dd>
<pre>
        SWF_LINESTYLE_JOIN_ROUND
        SWF_LINESTYLE_JOIN_BEVEL 
        SWF_LINESTYLE_JOIN_MITER</pre>
</dd>
<dd>
<p>Scaling flags: disable horizontal / vertical scaling</p>
</dd>
<dd>
<pre>
        SWF_LINESTYLE_FLAG_NOHSCALE
        SWF_LINESTYLE_FLAG_NOVSCALE</pre>
</dd>
<dd>
<p>Enable pixel hinting to correct blurry vertical / horizontal lines:  all anchors will be aligned to full pixels</p>
</dd>
<dd>
<pre>
        SWF_LINESTYLE_FLAG_HINTING</pre>
</dd>
<dd>
<p>Disable stroke closure: if no-close flag is set caps will be applied instead of joins.</p>
</dd>
<dd>
<pre>
        SWF_LINESTYLE_FLAG_NOCLOSE</pre>
</dd>
<dd>
<p>End-cap style: default round</p>
</dd>
<dd>
<pre>
        SWF_LINESTYLE_FLAG_ENDCAP_ROUND
        SWF_LINESTYLE_FLAG_ENDCAP_NONE
        SWF_LINESTYLE_FLAG_ENDCAP_SQUARE</pre>
</dd>
<dd>
<p>If join style is SWF_LINESTYLE_JOIN_MITER a miter limit factor must be set. Miter max length is then calculated as:
max miter len = miter limit * width. If join style is not miter, this value will be ignored.</p>
</dd>
</li>
<dt><strong><a name="setlinestyle2" class="item">$shape-&gt;setLineStyle2($width, $r, $g, $b ,$a, $flags, $miterLimit)</a></strong>

<dd>
<p>This OLD deprecated method is mentioned here only for compatibility reason, you'd better use setLine2().</p>
</dd>
</li>
<dt><strong><a name="setline2filled" class="item">$shape-&gt;setLine2Filled($width, $fill, $flags, $miterLimit)</a></strong>

<dd>
<p>A new method available for SWF version &gt;=8 setting shape's line width and fill style, $fill is an object
of SWF::Fill class. For other argument details see item $shape-&gt;setLine2().</p>
</dd>
</li>
<dt><strong><a name="setline2stylefilled" class="item">$shape-&gt;setLine2StyleFilled($width, $fill, $flags, $miterLimit)</a></strong>

<dd>
<p>This OLD deprecated method is mentioned here only for compatibility reason, you'd better use setLine2Filled().</p>
</dd>
</li>
<dt><strong><a name="hideline" class="item">$shape-&gt;<code>hideLine()</code></a></strong>

<dd>
<p>Remove the Shape's line, i.e. make lines painted after this method call invisible.</p>
</dd>
</li>
<dt><strong><a name="addsolidfill" class="item">$fill = $shape-&gt;addSolidFill($r, $g, $b [,$a])</a></strong>

<dt><strong><a name="addfill" class="item">$fill = $shape-&gt;addFill($r, $g, $b [,$a])</a></strong>

<dd>
<p>Adds a solid fill to $shape list of fill styles and returns an SWF::Fill object. This object is used with the &quot;setLine()&quot; method described below. The default value of $a is 0.</p>
</dd>
</li>
<dt><strong><a name="addbitmapfill" class="item">$fill = $shape-&gt;addBitmapFill($bitmap [,FLAG])</a></strong>

<dt><strong>$fill = $shape-&gt;addFill($bitmap [,FLAG])</strong>

<dd>
<p>Adds a bitmap fill to $shape list of fill styles and returns an SWF::Fill object. This object is used with the &quot;setLine()&quot; method described below.</p>
</dd>
<dd>
<p>$bitmap is an SWF::Bitmap object while FLAG argument can be SWFFILL_TILED_BITMAP or SWFFILL_CLIPPED_BITMAP. Make sure to import these constants to your package before useing it, i.e. use the following statement:</p>
</dd>
<dd>
<pre>
     use SWF::Fill &lt;list of constants&gt;;</pre>
</dd>
<dd>
<p>The default value of FLAG is SWFFILL_TILED_BITMAP.</p>
</dd>
</li>
<dt><strong><a name="addgradientfill" class="item">$fill = $shape-&gt;addGradientFill($gradient [,FLAG])</a></strong>

<dt><strong>$fill = $shape-&gt;addFill($gradient [,FLAG])</strong>

<dd>
<p>Adds a gradient fill to $shape list of fill styles and returns an SWF::Fill object. This object is used with the &quot;setLine()&quot; method described below.</p>
</dd>
<dd>
<p>$gradient is an SWF::Gradient object while FLAG argument can be SWFFILL_LINEAR_GRADIENT or SWFFILL_RADIAL_GRADIENT, plus SWFFILL_FOCAL_GRADIENT for V8.
Make sure to import these constants to your package before useing it, i.e. use the following statement:</p>
</dd>
<dd>
<pre>
     use SWF::Fill &lt;list of constants&gt;;</pre>
</dd>
<dd>
<p>The default value of FLAG is SWFFILL_LINEAR_GRADIENT.</p>
</dd>
</li>
<dt><strong><a name="xs_setleftfill" class="item">$shape-&gt;<code>xs_setLeftFill($fill)</code></a></strong>

<dt><strong><a name="setleftfill" class="item">$shape-&gt;<code>setLeftFill($fill)</code></a></strong>

<dd>
<p>Sets the fill on the left side of the edge. $fill is an SWF::Fill object returned from &quot;addFill&quot; method.</p>
</dd>
</li>
<dt><strong>$shape-&gt;setLeftFill($r, $g, $b [,$a])</strong>

<dd>
<p>This is another way of saying:</p>
</dd>
<dd>
<pre>
     my $fill = $shape-&gt;addSolidFill($r, $g, $b [,$a]);
     $shape-&gt;setLeftFill($fill);</pre>
</dd>
</li>
<dt><strong><a name="xs_setrightfill" class="item">$shape-&gt;<code>xs_setRightFill($fill)</code></a></strong>

<dt><strong><a name="setrightfill" class="item">$shape-&gt;<code>setRightFill($fill)</code></a></strong>

<dd>
<p>Sets the fill on the right side of the edge. $fill is an SWF::Fill object returned from &quot;addFill&quot; method.</p>
</dd>
</li>
<dt><strong>$shape-&gt;setRightFill($r, $g, $b [,$a])</strong>

<dd>
<p>This is another way of saying:</p>
</dd>
<dd>
<pre>
     my $fill = $shape-&gt;addSolidFill($r, $g, $b [,$a]);
     $shape-&gt;setRightFill($fill);</pre>
</dd>
</li>
<dt><strong><a name="drawcircle" class="item">$shape-&gt;<code>drawCircle($r)</code></a></strong>

<dd>
<p>Draws a circle with radious $r, also changes current position.</p>
</dd>
</li>
<dt><strong><a name="drawarc" class="item">$shape-&gt;drawArc($r, $startAngle, $endAngle)</a></strong>

<dd>
<p>Draws an arc with radious $r form start to end.</p>
</dd>
</li>
<dt><strong><a name="useversion" class="item">$shape-&gt;useVersion(version)</a></strong>

<dd>
<p>This function allows to set the shapes version information. The version is only
a hint. If necessary the version is upgraded. Valid values: are 3 and 4.
Value of 3 is default, but 4 if linestyle2 is used. 
Some shape features are available only for shape version 4 and 
SWF file version&gt;=8. One example is the usage of focal gradients:</p>
</dd>
<dd>
<pre>
        $g = new SWF::Gradient();
        $g-&gt;setFocalPoint(-0.9);
        $g-&gt;addEntry(0.000000,0xff,0x00,0x00,0xff);
        $g-&gt;addEntry(1.000000,0x00,0xff,0x00,0xff);
        $shape-&gt;useVersion(4);
        $shape-&gt;addGradientFill($g,SWFFILL_FOCAL_GRADIENT);</pre>
</dd>
</li>
<dt><strong><a name="getversion" class="item">$version = $shape-&gt;<code>getVersion()</code></a></strong>

<dd>
<p>Gets the current shape object version.</p>
</dd>
</li>
<dt><strong><a name="dumpoutline" class="item">$shape-&gt;<code>dumpOutline()</code></a></strong>

<dd>
<p>Returns a string describing shape's outline. After drawing in a shape 
expect getting a multi-line string like:</p>
</dd>
<dd>
<pre>
        moveto 368,5
        curveto 348,5 327,1
        curveto 307,-3 284,-15
etc. etc.</pre>
</dd>
</li>
<dt><strong><a name="end" class="item">$shape-&gt;<code>end()</code></a></strong>

<dd>
<p>Stops drawing on this shape and make the shape complete.
Further method calls won't produce any lines, circles etc. 
By using this demo code later no circle is painted:</p>
</dd>
<dd>
<pre>
        $shape-&gt;drawLineTo(300,300);
        $shape-&gt;end();
        $shape-&gt;drawCircle(200);</pre>
</dd>
</li>
<dt><strong><a name="drawglyph" class="item">$shape-&gt;drawGlyph($font, $cnumber [, $size])</a></strong>

<dd>
<p>Draws character of $cnumber of $font. Also Unicode fonts are possible, if the font does provide that, just like next example:</p>
</dd>
<dd>
<pre>
        $font=new SWF::Font(&quot;Thai-Bold.fdb&quot;);
        $sh-&gt;drawGlyph($font, 0x0E44, 44);</pre>
</dd>
</li>
<dt><strong><a name="drawcharacterbounds" class="item">$shape-&gt;<code>drawCharacterBounds($character)</code></a></strong>

<dd>
<p>Draws an outer rectangle fitting for $character, an object of SWF::Character.</p>
</dd>
</li>
<dt><strong><a name="setrenderhintingflags" class="item">$shape-&gt;setRenderHintingFlags(flags)</a></strong>

<dd>
<p><table cellspacing="0" cellpadding="0"><tr><td>Set render hinting flags. Possible values are 
<tr><td><td>SWF::Constants::SWF_SHAPE_USESCALINGSTROKES and
<tr><td><td>SWF::Constants::SWF_SHAPE_USENONSCALINGSTROKES</table></p>
</dd>
<dd>
<p>This method also will set version of this SWF::Shape object to 4.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Soheil Seyfaie (soheil at users.sourceforge.net), Albrecht Kleine</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p>SWF, SWF::Bitmap, SWF::Button, SWF::Constants, SWF::DisplayItem, 
SWF::Fill, SWF::Font, SWF::Gradient, SWF::Morph, SWF::Movie, SWF::MovieClip,
SWF::TextField, SWF::Text, SWF::Character</p>

</body>

</html>