swfmill 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. data/.document +5 -0
  2. data/.gitignore +23 -0
  3. data/.swfmill +240 -0
  4. data/LICENSE +340 -0
  5. data/README.rdoc +37 -0
  6. data/Rakefile +59 -0
  7. data/VERSION +1 -0
  8. data/ext/.gitignore +5 -0
  9. data/ext/extconf.rb +86 -0
  10. data/ext/swfmill/.gitignore +27 -0
  11. data/ext/swfmill/AUTHORS +9 -0
  12. data/ext/swfmill/COPYING +340 -0
  13. data/ext/swfmill/Makefile.am +14 -0
  14. data/ext/swfmill/Makefile.in +635 -0
  15. data/ext/swfmill/NEWS +189 -0
  16. data/ext/swfmill/README +170 -0
  17. data/ext/swfmill/TODO +33 -0
  18. data/ext/swfmill/aclocal.m4 +7712 -0
  19. data/ext/swfmill/autogen.sh +7 -0
  20. data/ext/swfmill/compile +142 -0
  21. data/ext/swfmill/config.guess +1516 -0
  22. data/ext/swfmill/config.sub +1626 -0
  23. data/ext/swfmill/configure +21868 -0
  24. data/ext/swfmill/configure.ac +55 -0
  25. data/ext/swfmill/depcomp +589 -0
  26. data/ext/swfmill/install-sh +519 -0
  27. data/ext/swfmill/ltmain.sh +6964 -0
  28. data/ext/swfmill/missing +367 -0
  29. data/ext/swfmill/src/Geom.cpp +107 -0
  30. data/ext/swfmill/src/Geom.h +100 -0
  31. data/ext/swfmill/src/Makefile.am +86 -0
  32. data/ext/swfmill/src/Makefile.in +1025 -0
  33. data/ext/swfmill/src/SWF.h +11941 -0
  34. data/ext/swfmill/src/SWFAction.cpp +41 -0
  35. data/ext/swfmill/src/SWFAction.h +19 -0
  36. data/ext/swfmill/src/SWFBasic.h +7 -0
  37. data/ext/swfmill/src/SWFFile.cpp +406 -0
  38. data/ext/swfmill/src/SWFFile.h +34 -0
  39. data/ext/swfmill/src/SWFFilter.cpp +25 -0
  40. data/ext/swfmill/src/SWFFilter.h +15 -0
  41. data/ext/swfmill/src/SWFGlyphList.cpp +262 -0
  42. data/ext/swfmill/src/SWFGlyphList.h +34 -0
  43. data/ext/swfmill/src/SWFIdItem.h +85 -0
  44. data/ext/swfmill/src/SWFIdItems.h +16 -0
  45. data/ext/swfmill/src/SWFItem.cpp +235 -0
  46. data/ext/swfmill/src/SWFItem.h +60 -0
  47. data/ext/swfmill/src/SWFList.h +179 -0
  48. data/ext/swfmill/src/SWFReader.cpp +352 -0
  49. data/ext/swfmill/src/SWFReader.h +73 -0
  50. data/ext/swfmill/src/SWFShapeItem.cpp +220 -0
  51. data/ext/swfmill/src/SWFShapeItem.h +45 -0
  52. data/ext/swfmill/src/SWFShapeMaker.cpp +401 -0
  53. data/ext/swfmill/src/SWFShapeMaker.h +128 -0
  54. data/ext/swfmill/src/SWFTag.cpp +49 -0
  55. data/ext/swfmill/src/SWFTag.h +20 -0
  56. data/ext/swfmill/src/SWFTrait.cpp +35 -0
  57. data/ext/swfmill/src/SWFTrait.h +22 -0
  58. data/ext/swfmill/src/SWFWriter.cpp +312 -0
  59. data/ext/swfmill/src/SWFWriter.h +84 -0
  60. data/ext/swfmill/src/base64.c +110 -0
  61. data/ext/swfmill/src/base64.h +15 -0
  62. data/ext/swfmill/src/codegen/Makefile.am +15 -0
  63. data/ext/swfmill/src/codegen/Makefile.in +346 -0
  64. data/ext/swfmill/src/codegen/basic.xsl +45 -0
  65. data/ext/swfmill/src/codegen/basics.xsl +235 -0
  66. data/ext/swfmill/src/codegen/dumper.xsl +109 -0
  67. data/ext/swfmill/src/codegen/header.xsl +131 -0
  68. data/ext/swfmill/src/codegen/mk.xsl +26 -0
  69. data/ext/swfmill/src/codegen/parser.xsl +196 -0
  70. data/ext/swfmill/src/codegen/parsexml.xsl +312 -0
  71. data/ext/swfmill/src/codegen/size.xsl +189 -0
  72. data/ext/swfmill/src/codegen/source.xml +2197 -0
  73. data/ext/swfmill/src/codegen/writer.xsl +190 -0
  74. data/ext/swfmill/src/codegen/writexml.xsl +138 -0
  75. data/ext/swfmill/src/swfmill.cpp +482 -0
  76. data/ext/swfmill/src/swft/Makefile.am +55 -0
  77. data/ext/swfmill/src/swft/Makefile.in +717 -0
  78. data/ext/swfmill/src/swft/Parser.cpp +76 -0
  79. data/ext/swfmill/src/swft/Parser.h +37 -0
  80. data/ext/swfmill/src/swft/SVGAttributeParser.cpp +78 -0
  81. data/ext/swfmill/src/swft/SVGAttributeParser.h +35 -0
  82. data/ext/swfmill/src/swft/SVGColor.cpp +116 -0
  83. data/ext/swfmill/src/swft/SVGColor.h +37 -0
  84. data/ext/swfmill/src/swft/SVGColors.h +167 -0
  85. data/ext/swfmill/src/swft/SVGGradient.cpp +258 -0
  86. data/ext/swfmill/src/swft/SVGGradient.h +81 -0
  87. data/ext/swfmill/src/swft/SVGPathParser.cpp +155 -0
  88. data/ext/swfmill/src/swft/SVGPathParser.h +126 -0
  89. data/ext/swfmill/src/swft/SVGPointsParser.cpp +51 -0
  90. data/ext/swfmill/src/swft/SVGPointsParser.h +25 -0
  91. data/ext/swfmill/src/swft/SVGStyle.cpp +181 -0
  92. data/ext/swfmill/src/swft/SVGStyle.h +80 -0
  93. data/ext/swfmill/src/swft/SVGTransformParser.cpp +72 -0
  94. data/ext/swfmill/src/swft/SVGTransformParser.h +32 -0
  95. data/ext/swfmill/src/swft/readpng.c +305 -0
  96. data/ext/swfmill/src/swft/readpng.h +92 -0
  97. data/ext/swfmill/src/swft/swft.cpp +251 -0
  98. data/ext/swfmill/src/swft/swft.h +64 -0
  99. data/ext/swfmill/src/swft/swft_document.cpp +57 -0
  100. data/ext/swfmill/src/swft/swft_import.cpp +38 -0
  101. data/ext/swfmill/src/swft/swft_import_binary.cpp +82 -0
  102. data/ext/swfmill/src/swft/swft_import_jpeg.cpp +255 -0
  103. data/ext/swfmill/src/swft/swft_import_mp3.cpp +268 -0
  104. data/ext/swfmill/src/swft/swft_import_png.cpp +231 -0
  105. data/ext/swfmill/src/swft/swft_import_ttf.cpp +519 -0
  106. data/ext/swfmill/src/swft/swft_import_wav.cpp +255 -0
  107. data/ext/swfmill/src/swft/swft_path.cpp +178 -0
  108. data/ext/swfmill/src/xslt/Makefile.am +51 -0
  109. data/ext/swfmill/src/xslt/Makefile.in +536 -0
  110. data/ext/swfmill/src/xslt/README +19 -0
  111. data/ext/swfmill/src/xslt/assemble.xsl +38 -0
  112. data/ext/swfmill/src/xslt/simple-deprecated.xslt +62 -0
  113. data/ext/swfmill/src/xslt/simple-elements.xslt +627 -0
  114. data/ext/swfmill/src/xslt/simple-import.xslt +565 -0
  115. data/ext/swfmill/src/xslt/simple-svg.xslt +383 -0
  116. data/ext/swfmill/src/xslt/simple-tools.xslt +255 -0
  117. data/ext/swfmill/src/xslt/simple.cpp +1686 -0
  118. data/ext/swfmill/src/xslt/simple.xml +7 -0
  119. data/ext/swfmill/src/xslt/xslt.h +7 -0
  120. data/ext/swfmill/test/Makefile.am +1 -0
  121. data/ext/swfmill/test/Makefile.in +490 -0
  122. data/ext/swfmill/test/xml/Makefile.am +20 -0
  123. data/ext/swfmill/test/xml/Makefile.in +353 -0
  124. data/ext/swfmill/test/xml/test-xml +21 -0
  125. data/ext/swfmill_ext.cc +375 -0
  126. data/lib/swfmill.rb +30 -0
  127. data/spec/data/swfmill-banner1.swf +0 -0
  128. data/spec/spec.opts +1 -0
  129. data/spec/spec_helper.rb +14 -0
  130. data/spec/swfmill_spec.rb +125 -0
  131. metadata +206 -0
@@ -0,0 +1,383 @@
1
+ <?xml version="1.0"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
4
+ xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
5
+ xmlns:svg="http://www.w3.org/2000/svg"
6
+ xmlns:swft="http://subsignal.org/swfml/swft"
7
+ xmlns:str="http://exslt.org/strings"
8
+ xmlns:xlink="http://www.w3.org/1999/xlink"
9
+ extension-element-prefixes="swft"
10
+ version='1.0'>
11
+
12
+ <!-- named template for redundant transforms -->
13
+ <xsl:template name="transform">
14
+ <transform>
15
+ <xsl:choose>
16
+ <!-- catch empty transform attributes. -->
17
+ <xsl:when test="not(@transform) or @transform=''">
18
+ <Transform transX="0" transY="0"/>
19
+ </xsl:when>
20
+ <xsl:otherwise>
21
+ <xsl:copy-of select="swft:transform(@transform)"/>
22
+ </xsl:otherwise>
23
+ </xsl:choose>
24
+ </transform>
25
+ </xsl:template>
26
+
27
+ <!-- named template for redundant placing -->
28
+ <xsl:template name="placeObject">
29
+ <!-- place the element, or the referenced element (if it's a reference).
30
+ -->
31
+ <xsl:variable name="id">
32
+ <xsl:choose>
33
+ <xsl:when test="name()='use'">
34
+ <xsl:value-of select="swft:map-id(substring(@xlink:href,2))"/>
35
+ </xsl:when>
36
+ <xsl:when test="@id">
37
+ <xsl:value-of select="swft:map-id(@id)"/>
38
+ </xsl:when>
39
+ <xsl:otherwise>
40
+ <xsl:value-of select="swft:map-id(generate-id(.))"/>
41
+ </xsl:otherwise>
42
+ </xsl:choose>
43
+ </xsl:variable>
44
+ <!-- use inkscape label as an instance name instead of id, allowing
45
+ multiple instances with the same name. -->
46
+ <xsl:variable name="name">
47
+ <xsl:choose>
48
+ <xsl:when test="@inkscape:label">
49
+ <xsl:choose>
50
+ <xsl:when test="substring(@inkscape:label,1,1)='#'">
51
+ <xsl:value-of select="substring(@inkscape:label,2)"/>
52
+ </xsl:when>
53
+ <xsl:otherwise>
54
+ <xsl:value-of select="@inkscape:label"/>
55
+ </xsl:otherwise>
56
+ </xsl:choose>
57
+ </xsl:when>
58
+ <xsl:when test="@id">
59
+ <xsl:value-of select="@id"/>
60
+ </xsl:when>
61
+ <xsl:otherwise>
62
+ <xsl:value-of select="generate-id(.)"/>
63
+ </xsl:otherwise>
64
+ </xsl:choose>
65
+ </xsl:variable>
66
+ <!-- place the object. -->
67
+ <PlaceObject2 replace="0" depth="{swft:next-depth()}" name="{$name}"
68
+ objectID="{$id}">
69
+ <!-- svg:use elements add an instance transform, all others have it
70
+ included in their definition. -->
71
+ <xsl:choose>
72
+ <xsl:when test="name()='use'">
73
+ <xsl:call-template name="transform" />
74
+ </xsl:when>
75
+ <xsl:otherwise>
76
+ <transform>
77
+ <Transform transX="0" transY="0"/>
78
+ </transform>
79
+ </xsl:otherwise>
80
+ </xsl:choose>
81
+ </PlaceObject2>
82
+ </xsl:template>
83
+
84
+ <!-- named template for redundant wrappers -->
85
+ <xsl:template name="wrapElement">
86
+ <xsl:param name="innerid" />
87
+ <xsl:variable name="id">
88
+ <xsl:choose>
89
+ <xsl:when test="@id">
90
+ <xsl:value-of select="swft:map-id(@id)"/>
91
+ </xsl:when>
92
+ <xsl:otherwise>
93
+ <xsl:value-of select="swft:map-id(generate-id(.))"/>
94
+ </xsl:otherwise>
95
+ </xsl:choose>
96
+ </xsl:variable>
97
+ <DefineSprite objectID="{$id}" frames="1">
98
+ <tags>
99
+ <PlaceObject2 replace="0" depth="{swft:next-depth()}"
100
+ objectID="{$innerid}">
101
+ <xsl:call-template name="transform" />
102
+ </PlaceObject2>
103
+ <ShowFrame/>
104
+ <End/>
105
+ </tags>
106
+ </DefineSprite>
107
+ </xsl:template>
108
+
109
+ <!-- named template for redundant exports -->
110
+ <xsl:template name="exportElement">
111
+ <!-- export the element. -->
112
+ <xsl:if test="@id">
113
+ <xsl:variable name="id" select="swft:map-id(@id)"/>
114
+ <xsl:variable name="name" select="@id" />
115
+
116
+ <Export>
117
+ <symbols>
118
+ <Symbol objectID="{$id}" name="{$name}"/>
119
+ </symbols>
120
+ </Export>
121
+ </xsl:if>
122
+
123
+ <!-- define a class, if applicable. -->
124
+ <xsl:variable name="swfClass" select="@swfClass"/>
125
+ <xsl:if test="string-length($swfClass) > 0">
126
+ <xsl:call-template name="register-class">
127
+ <xsl:with-param name="class" select="$swfClass"/>
128
+ <xsl:with-param name="linkage-id" select="@id"/>
129
+ </xsl:call-template>
130
+ </xsl:if>
131
+ </xsl:template>
132
+
133
+
134
+ <!-- entry point: starts 2 passes, one for queuing up the definitions, one
135
+ for placing the elements. -->
136
+ <xsl:template match="svg:svg" mode="svg">
137
+ <xsl:param name="id"/>
138
+ <xsl:param name="export"/>
139
+ <!-- initiate the gradient pass. -->
140
+ <xsl:apply-templates mode="gradient1" />
141
+ <xsl:apply-templates mode="gradient2" />
142
+ <!-- initiate the definition pass. -->
143
+ <xsl:apply-templates mode="queue">
144
+ <xsl:with-param name="export" select="$export"/>
145
+ </xsl:apply-templates>
146
+ <!-- define svg root as sprite. -->
147
+ <DefineSprite objectID="{$id}" frames="1">
148
+ <tags>
149
+ <!-- initiate the placement pass. -->
150
+ <xsl:apply-templates mode="placement" />
151
+ <ShowFrame/>
152
+ <End/>
153
+ </tags>
154
+ </DefineSprite>
155
+ </xsl:template>
156
+
157
+ <xsl:template match="svg:linearGradient[not(@xlink:href)]|svg:radialGradient[not(@xlink:href)]" mode="gradient1">
158
+ <swft:push-gradient />
159
+ </xsl:template>
160
+
161
+ <xsl:template match="svg:linearGradient[@xlink:href]|svg:radialGradient[@xlink:href]" mode="gradient2">
162
+ <swft:push-gradient />
163
+ </xsl:template>
164
+
165
+ <xsl:template match="svg:g|svg:path|svg:rect|svg:circle|svg:ellipse|svg:line|svg:polyline|svg:polygon|svg:use|svg:text|svg:flowRoot"
166
+ mode="queue">
167
+ <xsl:param name="export"/>
168
+
169
+ <xsl:if test="name()='g'">
170
+ <swft:push-style />
171
+ </xsl:if>
172
+
173
+ <xsl:variable name="id">
174
+ <xsl:choose>
175
+ <xsl:when test="@id">
176
+ <xsl:value-of select="swft:map-id(@id)"/>
177
+ </xsl:when>
178
+ <xsl:otherwise>
179
+ <xsl:value-of select="swft:map-id(generate-id(.))"/>
180
+ </xsl:otherwise>
181
+ </xsl:choose>
182
+ </xsl:variable>
183
+ <xsl:variable name="name">
184
+ <xsl:choose>
185
+ <xsl:when test="@id">
186
+ <xsl:value-of select="@id"/>
187
+ </xsl:when>
188
+ <xsl:otherwise>
189
+ <xsl:value-of select="generate-id(.)"/>
190
+ </xsl:otherwise>
191
+ </xsl:choose>
192
+ </xsl:variable>
193
+
194
+ <!-- first define the subparts, so that we get the innermost ones queued
195
+ first. -->
196
+ <xsl:apply-templates mode="queue">
197
+ <xsl:with-param name="export" select="$export"/>
198
+ </xsl:apply-templates>
199
+
200
+ <!-- now define this element, which is based on the subparts. -->
201
+ <xsl:apply-templates select="." mode="definition">
202
+ <xsl:with-param name="id" select="$id"/>
203
+ <xsl:with-param name="name" select="$name"/>
204
+ <xsl:with-param name="export" select="$export"/>
205
+ </xsl:apply-templates>
206
+
207
+ <xsl:if test="name()='g'">
208
+ <swft:pop-style />
209
+ </xsl:if>
210
+ </xsl:template>
211
+
212
+ <xsl:template match="svg:g|svg:path|svg:rect|svg:circle|svg:ellipse|svg:line|svg:polyline|svg:polygon|svg:use|svg:text|svg:flowRoot"
213
+ mode="placement">
214
+ <xsl:if test="not(ancestor::svg:defs) or parent::svg:g">
215
+ <!-- no definition. just place this element. -->
216
+ <xsl:call-template name="placeObject" />
217
+ </xsl:if>
218
+ </xsl:template>
219
+
220
+ <xsl:template match="svg:g" mode="definition" priority="-1">
221
+ <xsl:param name="id"/>
222
+ <xsl:param name="name"/>
223
+ <xsl:param name="export"/>
224
+
225
+ <!-- test if a wrapper is needed for a group transform -->
226
+ <xsl:choose>
227
+ <xsl:when test="not(@transform) or @transform='' or
228
+ transform='translate(0,0)'">
229
+ <!-- no transform, define the group and place the subparts -->
230
+ <DefineSprite objectID="{$id}" frames="1">
231
+ <tags>
232
+ <xsl:apply-templates mode="placement" />
233
+ <ShowFrame/>
234
+ <End/>
235
+ </tags>
236
+ </DefineSprite>
237
+ </xsl:when>
238
+ <xsl:otherwise>
239
+ <!-- define an inner group and wrap it with the group transform -->
240
+ <xsl:variable name="innerid"><xsl:value-of
241
+ select="swft:next-id()"/></xsl:variable>
242
+ <DefineSprite objectID="{$innerid}" frames="1">
243
+ <tags>
244
+ <xsl:apply-templates mode="placement" />
245
+ <ShowFrame/>
246
+ <End/>
247
+ </tags>
248
+ </DefineSprite>
249
+ <xsl:call-template name="wrapElement">
250
+ <xsl:with-param name="innerid" select="$innerid" />
251
+ </xsl:call-template>
252
+ </xsl:otherwise>
253
+ </xsl:choose>
254
+
255
+
256
+ <!-- export -->
257
+ <xsl:if test="$export = 'all' or $export = 'groups'">
258
+ <xsl:call-template name="exportElement" />
259
+ </xsl:if>
260
+ </xsl:template>
261
+
262
+ <xsl:template match="svg:rect|svg:circle|svg:ellipse|svg:line|svg:polyline|svg:polygon|svg:path" mode="definition">
263
+ <xsl:param name="id"/>
264
+ <xsl:param name="export"/>
265
+ <xsl:variable name="shapeid"><xsl:value-of
266
+ select="swft:next-id()"/></xsl:variable>
267
+
268
+ <!-- define the path -->
269
+ <xsl:copy-of select="swft:path(., $shapeid, $movie-version)"/>
270
+ <!-- wrap in sprite -->
271
+ <xsl:call-template name="wrapElement">
272
+ <xsl:with-param name="innerid" select="$shapeid" />
273
+ </xsl:call-template>
274
+ <!-- export -->
275
+ <xsl:if test="$export = 'all'">
276
+ <xsl:call-template name="exportElement" />
277
+ </xsl:if>
278
+ </xsl:template>
279
+
280
+ <xsl:template match="svg:flowRoot" mode="definition">
281
+ <xsl:param name="id"/>
282
+ <xsl:param name="name"/>
283
+ <xsl:param name="export"/>
284
+ <xsl:variable name="shapeid"><xsl:value-of
285
+ select="swft:next-id()"/></xsl:variable>
286
+
287
+ <!-- define the element -->
288
+ <DefineEditText objectID="{$shapeid}" wordWrap="1" multiLine="1"
289
+ password="0" readOnly="0" autoSize="0" hasLayout="1" notSelectable="0"
290
+ hasBorder="0" isHTML="0" useOutlines="0" fontRef="{swft:map-id('vera')}"
291
+ fontHeight="240" align="0" leftMargin="0" rightMargin="0" indent="0"
292
+ leading="40" variableName="{@name}">
293
+ <xsl:attribute name="initialText">
294
+ <xsl:apply-templates mode="svg-text"/>
295
+ </xsl:attribute>
296
+ <size>
297
+ <Rectangle left="{svg:flowRegion/svg:rect/@x * 20}"
298
+ right="{(svg:flowRegion/svg:rect/@x + svg:flowRegion/svg:rect/@width)* 20}"
299
+ top="{svg:flowRegion/svg:rect/@y * 20}" bottom="{(svg:flowRegion/svg:rect/@y
300
+ + svg:flowRegion/svg:rect/@height)* 20}"/>
301
+ </size>
302
+ <color>
303
+ <Color red="0" green="0" blue="0" alpha="255"/>
304
+ </color>
305
+ </DefineEditText>
306
+ <!-- wrap in sprite -->
307
+ <xsl:call-template name="wrapElement">
308
+ <xsl:with-param name="innerid" select="$shapeid" />
309
+ </xsl:call-template>
310
+ <!-- export -->
311
+ <xsl:if test="$export = 'all'">
312
+ <xsl:call-template name="exportElement" />
313
+ </xsl:if>
314
+ </xsl:template>
315
+
316
+ <xsl:template match="svg:text" mode="definition">
317
+ <xsl:param name="id"/>
318
+ <xsl:param name="name"/>
319
+ <xsl:param name="export"/>
320
+ <xsl:variable name="shapeid"><xsl:value-of
321
+ select="swft:next-id()"/></xsl:variable>
322
+
323
+ <!-- define the element -->
324
+ <DefineEditText objectID="{$shapeid}" wordWrap="0" multiLine="1"
325
+ password="0" readOnly="1" autoSize="1" hasLayout="1" notSelectable="1"
326
+ hasBorder="0" isHTML="0" useOutlines="0" fontRef="{swft:map-id('vera')}"
327
+ fontHeight="240" align="0" leftMargin="0" rightMargin="0" indent="0"
328
+ leading="40" variableName="{@name}">
329
+ <xsl:attribute name="initialText">
330
+ <xsl:apply-templates mode="svg-text"/>
331
+ </xsl:attribute>
332
+ <size>
333
+ <Rectangle left="{@x * 20}" right="{(@x + 200) * 20}" top="{@y * 20 - 240}" bottom="{@y
334
+ * 20}"/>
335
+ </size>
336
+ <color>
337
+ <Color red="0" green="0" blue="0" alpha="255"/>
338
+ </color>
339
+ </DefineEditText>
340
+ <!-- wrap in sprite -->
341
+ <xsl:call-template name="wrapElement">
342
+ <xsl:with-param name="innerid" select="$shapeid" />
343
+ </xsl:call-template>
344
+ <!-- export -->
345
+ <xsl:if test="$export = 'all'">
346
+ <xsl:call-template name="exportElement" />
347
+ </xsl:if>
348
+ </xsl:template>
349
+
350
+ <xsl:template match="svg:flowRegion" mode="svg-text">
351
+ <xsl:apply-templates mode="svg-text"/>
352
+ </xsl:template>
353
+
354
+ <xsl:template match="svg:flowPara" mode="svg-text">
355
+ <xsl:apply-templates mode="svg-text"/>
356
+ </xsl:template>
357
+
358
+ <xsl:template match="svg:tspan[position()=1]" mode="svg-text">
359
+ <xsl:apply-templates mode="svg-text"/>
360
+ </xsl:template>
361
+
362
+ <xsl:template match="svg:tspan" mode="svg-text" priority="-1">
363
+ <xsl:text>
364
+ </xsl:text>
365
+ <xsl:apply-templates mode="svg-text"/>
366
+ </xsl:template>
367
+
368
+ <xsl:template match="text()" mode="svg-text">
369
+ <xsl:copy-of select="."/>
370
+ </xsl:template>
371
+
372
+ <xsl:template match="*|@*|text()" mode="svg" priority="-1"/>
373
+
374
+ <xsl:template match="ShapeSetup" mode="shape">
375
+ <ShapeSetup fillStyle0="1" fillStyle1="2" lineStyle="1">
376
+ <xsl:apply-templates select="*|@*" mode="shape"/>
377
+ </ShapeSetup>
378
+ </xsl:template>
379
+ <xsl:template match="*|@*|text()" mode="shape" priority="-1">
380
+ <xsl:copy-of select="."/>
381
+ </xsl:template>
382
+
383
+ </xsl:stylesheet>
@@ -0,0 +1,255 @@
1
+ <?xml version="1.0"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
+ xmlns:swft="http://subsignal.org/swfml/swft"
4
+ xmlns:str="http://exslt.org/strings"
5
+ xmlns:math="http://exslt.org/math"
6
+ extension-element-prefixes="swft"
7
+ version='1.0'>
8
+
9
+ <!-- Color from @color="#rrggbb" or @red, @green, @blue-->
10
+ <xsl:template name="color">
11
+ <xsl:variable name="red">
12
+ <xsl:choose>
13
+ <xsl:when test="@red"><xsl:value-of select="@red"/></xsl:when>
14
+ <xsl:when test="@color">0x<xsl:value-of select="substring(@color,2,2)"/></xsl:when>
15
+ <xsl:otherwise>200</xsl:otherwise>
16
+ </xsl:choose>
17
+ </xsl:variable>
18
+ <xsl:variable name="green">
19
+ <xsl:choose>
20
+ <xsl:when test="@green"><xsl:value-of select="@green"/></xsl:when>
21
+ <xsl:when test="@color">0x<xsl:value-of select="substring(@color,4,2)"/></xsl:when>
22
+ <xsl:otherwise>200</xsl:otherwise>
23
+ </xsl:choose>
24
+ </xsl:variable>
25
+ <xsl:variable name="blue">
26
+ <xsl:choose>
27
+ <xsl:when test="@blue"><xsl:value-of select="@blue"/></xsl:when>
28
+ <xsl:when test="@color">0x<xsl:value-of select="substring(@color,6)"/></xsl:when>
29
+ <xsl:otherwise>200</xsl:otherwise>
30
+ </xsl:choose>
31
+ </xsl:variable>
32
+ <Color red="{$red}" green="{$green}" blue="{$blue}"/>
33
+ </xsl:template>
34
+
35
+ <!-- ColorRGBA from @color="#rrggbbaa" or @red, @green, @blue, @alpha -->
36
+ <xsl:template name="color-rgba">
37
+ <xsl:variable name="red">
38
+ <xsl:choose>
39
+ <xsl:when test="@red"><xsl:value-of select="@red"/></xsl:when>
40
+ <xsl:when test="@color">0x<xsl:value-of select="substring(@color,2,2)"/></xsl:when>
41
+ <xsl:otherwise>0</xsl:otherwise>
42
+ </xsl:choose>
43
+ </xsl:variable>
44
+ <xsl:variable name="green">
45
+ <xsl:choose>
46
+ <xsl:when test="@green"><xsl:value-of select="@green"/></xsl:when>
47
+ <xsl:when test="@color">0x<xsl:value-of select="substring(@color,4,2)"/></xsl:when>
48
+ <xsl:otherwise>0</xsl:otherwise>
49
+ </xsl:choose>
50
+ </xsl:variable>
51
+ <xsl:variable name="blue">
52
+ <xsl:choose>
53
+ <xsl:when test="@blue"><xsl:value-of select="@blue"/></xsl:when>
54
+ <xsl:when test="@color">0x<xsl:value-of select="substring(@color,6)"/></xsl:when>
55
+ <xsl:otherwise>0</xsl:otherwise>
56
+ </xsl:choose>
57
+ </xsl:variable>
58
+ <xsl:variable name="alpha">
59
+ <xsl:choose>
60
+ <xsl:when test="@alpha"><xsl:value-of select="@alpha"/></xsl:when>
61
+ <xsl:when test="string-length(@color) = 9">0x<xsl:value-of select="substring(@color,8)"/></xsl:when>
62
+ <xsl:otherwise>255</xsl:otherwise>
63
+ </xsl:choose>
64
+ </xsl:variable>
65
+ <Color red="{$red}" green="{$green}" blue="{$blue}" alpha="{$alpha}"/>
66
+ </xsl:template>
67
+
68
+ <!-- ColorRGBA from parameter $color ("#rrggbbaa") -->
69
+ <xsl:template name="color-rgba-param">
70
+ <xsl:param name="color">#00000000</xsl:param>
71
+ <xsl:param name="alpha"/>
72
+ <xsl:variable name="red">
73
+ <xsl:choose>
74
+ <xsl:when test="$color">0x<xsl:value-of select="substring($color,2,2)"/></xsl:when>
75
+ <xsl:otherwise>0</xsl:otherwise>
76
+ </xsl:choose>
77
+ </xsl:variable>
78
+ <xsl:variable name="green">
79
+ <xsl:choose>
80
+ <xsl:when test="$color">0x<xsl:value-of select="substring($color,4,2)"/></xsl:when>
81
+ <xsl:otherwise>0</xsl:otherwise>
82
+ </xsl:choose>
83
+ </xsl:variable>
84
+ <xsl:variable name="blue">
85
+ <xsl:choose>
86
+ <xsl:when test="$color">0x<xsl:value-of select="substring($color,6)"/></xsl:when>
87
+ <xsl:otherwise>0</xsl:otherwise>
88
+ </xsl:choose>
89
+ </xsl:variable>
90
+ <xsl:variable name="a">
91
+ <xsl:choose>
92
+ <xsl:when test="$alpha != ''"><xsl:value-of select="$alpha * 255"/></xsl:when>
93
+ <xsl:when test="string-length($color) = 9">0x<xsl:value-of select="substring($color,8)"/></xsl:when>
94
+ <xsl:otherwise>255</xsl:otherwise>
95
+ </xsl:choose>
96
+ </xsl:variable>
97
+ <Color red="{$red}" green="{$green}" blue="{$blue}" alpha="{$a}"/>
98
+ </xsl:template>
99
+
100
+ <!-- set primitive types with SetVariable, for PlaceObject2 events -->
101
+ <xsl:template match="string" mode="set">
102
+ <PushData>
103
+ <items>
104
+ <StackString value="{@name}"/>
105
+ <StackString value="{@value}"/>
106
+ </items>
107
+ </PushData>
108
+ <SetVariable/>
109
+ </xsl:template>
110
+ <xsl:template match="number" mode="set">
111
+ <PushData>
112
+ <items>
113
+ <StackString value="{@name}"/>
114
+ <StackDouble value="{@value}"/>
115
+ </items>
116
+ </PushData>
117
+ <SetVariable/>
118
+ </xsl:template>
119
+ <xsl:template match="boolean" mode="set">
120
+ <PushData>
121
+ <items>
122
+ <StackString value="{@name}"/>
123
+ <StackBoolean value="{@value}"/>
124
+ </items>
125
+ </PushData>
126
+ <SetVariable/>
127
+ </xsl:template>
128
+
129
+
130
+ <!-- works only if the id is exported! -->
131
+ <xsl:template name="register-class">
132
+ <xsl:param name="class"/>
133
+ <xsl:param name="linkage-id"/>
134
+ <xsl:variable name="packages" select="str:tokenize($class,'.')"/>
135
+ <xsl:variable name="strofs">3</xsl:variable>
136
+ <xsl:variable name="id" select="swft:next-id()"/>
137
+
138
+ <DefineSprite objectID="{$id}" frames="1">
139
+ <tags>
140
+ <End/>
141
+ </tags>
142
+ </DefineSprite>
143
+ <Export>
144
+ <symbols>
145
+ <Symbol objectID="{$id}" name="__Packages.swfmill.registerClass.{$linkage-id}"/>
146
+ </symbols>
147
+ </Export>
148
+ <DoInitAction sprite="{$id}">
149
+ <actions>
150
+ <Dictionary>
151
+ <strings>
152
+ <String value="Object"/>
153
+ <String value="registerClass"/>
154
+ <String value="{$linkage-id}"/>
155
+ <xsl:for-each select="$packages">
156
+ <String value="{.}"/>
157
+ </xsl:for-each>
158
+ </strings>
159
+ </Dictionary>
160
+
161
+ <!-- package root -->
162
+ <PushData>
163
+ <items>
164
+ <StackDictionaryLookup index="{$strofs}"/>
165
+ </items>
166
+ </PushData>
167
+ <GetVariable/>
168
+
169
+ <!-- packages -->
170
+ <xsl:for-each select="$packages[position()>1]">
171
+ <PushData>
172
+ <items>
173
+ <StackDictionaryLookup index="{$strofs + position()}"/>
174
+ </items>
175
+ </PushData>
176
+ <GetMember/>
177
+ </xsl:for-each>
178
+
179
+ <!-- linkage id, 2 (arguments), Object-->
180
+ <PushData>
181
+ <items>
182
+ <StackDictionaryLookup index="2"/>
183
+ <StackInteger value="2"/>
184
+ <StackDictionaryLookup index="0"/>
185
+ </items>
186
+ </PushData>
187
+ <GetVariable/>
188
+ <!-- registerClass -->
189
+ <PushData>
190
+ <items>
191
+ <StackDictionaryLookup index="1"/>
192
+ </items>
193
+ </PushData>
194
+ <CallMethod/>
195
+ <Pop/>
196
+ <EndAction/>
197
+ </actions>
198
+ </DoInitAction>
199
+
200
+ </xsl:template>
201
+
202
+
203
+ <!-- HTML wrapper -->
204
+ <xsl:template match="html-wrapper">
205
+ <xsl:document href="{@name}">
206
+ <html>
207
+ <body>
208
+ <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
209
+ codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
210
+ width="{/movie/@width}" height="{/movie/@width}" id="video" align="middle">
211
+ <param name="allowScriptAccess" value="sameDomain" />
212
+ <param name="movie" value="{@swf}" />
213
+ <param name="quality" value="high" />
214
+ <embed src="{@swf}" quality="high"
215
+ width="{/movie/@width}" height="{/movie/@height}" name="video" align="middle" allowScriptAccess="sameDomain"
216
+ type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
217
+ </object>
218
+ </body>
219
+ </html>
220
+ </xsl:document>
221
+ </xsl:template>
222
+
223
+ <!-- html text (entity-escape xml, for fitting xml/html content in an attribute) -->
224
+ <xsl:template match="*" mode="htmltext">
225
+ <xsl:text>&lt;</xsl:text>
226
+ <xsl:value-of select="name()"/>
227
+ <xsl:apply-templates select="@*" mode="htmltext"/>
228
+ <xsl:text>&gt;</xsl:text>
229
+ <xsl:apply-templates select="*|text()" mode="htmltext"/>
230
+ <xsl:text>&lt;/</xsl:text>
231
+ <xsl:value-of select="name()"/>
232
+ <xsl:text>&gt;</xsl:text>
233
+ </xsl:template>
234
+ <xsl:template match="@*" mode="htmltext">
235
+ <xsl:text> </xsl:text>
236
+ <xsl:value-of select="name()"/>
237
+ <xsl:text>=&quot;</xsl:text>
238
+ <xsl:value-of select="."/>
239
+ <xsl:text>&quot;</xsl:text>
240
+ </xsl:template>
241
+ <xsl:template match="text()" mode="htmltext">
242
+ <xsl:value-of select="."/>
243
+ </xsl:template>
244
+
245
+ <!-- copy anything else, but translate objectIDs -->
246
+ <xsl:template match="@objectID|@sprite|@fontRef">
247
+ <xsl:attribute name="{name()}"><xsl:value-of select="swft:map-id(.)"/></xsl:attribute>
248
+ </xsl:template>
249
+ <xsl:template match="*|@*|text()" priority="-2">
250
+ <xsl:copy select=".">
251
+ <xsl:apply-templates select="*|@*|text()"/>
252
+ </xsl:copy>
253
+ </xsl:template>
254
+
255
+ </xsl:stylesheet>