swfmill 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
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,19 @@
1
+
2
+ 2005-07-19 building the internal stylesheets
3
+
4
+ * swfmill uses internal stylesheets for some commands ("simple").
5
+ * these get big, so they are split into parts (*.xslt)
6
+ * a .xml file (e.g. simple.xml) describes which parts should get assembled
7
+ to form a single internal sheet.
8
+ * the .xml is transformed along assemble.xsl, including the parts,
9
+ producing a .cpp that contains the stylesheet as a static string.
10
+
11
+ a new internal stylesheet (foo) would need:
12
+ * foo.xml <compilation> description
13
+ * ? anything else
14
+ * mentions in Makefile.am
15
+ * mention in xslt.h
16
+ * command in swfmill.cpp
17
+
18
+ (PS, yes i know about xsl:import and :include, but i would have to hack
19
+ libxslt to read from something like memory:// urls, which is not nice either)
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
+ version='1.0'>
4
+
5
+ <xsl:output method="xml" indent="yes"/>
6
+
7
+ <xsl:template match="compilation">
8
+ <xsl:element name="xsl:stylesheet">
9
+ <xsl:attribute name="namespaces">hack</xsl:attribute>
10
+ <xsl:attribute name="extension-element-prefixes">swft</xsl:attribute>
11
+ <xsl:attribute name="version">1.0</xsl:attribute>
12
+ <xsl:text>
13
+ </xsl:text>
14
+
15
+ <xsl:element name="xsl:output">
16
+ <xsl:attribute name="method">xml</xsl:attribute>
17
+ <xsl:attribute name="indent">yes</xsl:attribute>
18
+ </xsl:element>
19
+
20
+ <xsl:element name="xsl:param">
21
+ <xsl:attribute name="name">quiet</xsl:attribute>
22
+ <xsl:attribute name="select">'false'</xsl:attribute>
23
+ </xsl:element>
24
+
25
+ <xsl:apply-templates/>
26
+
27
+ </xsl:element>
28
+ </xsl:template>
29
+
30
+ <xsl:template match="include">
31
+ <xsl:for-each select="document(@src)/xsl:stylesheet/*">
32
+ <xsl:text>
33
+ </xsl:text>
34
+ <xsl:copy-of select="."/>
35
+ </xsl:for-each>
36
+ </xsl:template>
37
+
38
+ </xsl:stylesheet>
@@ -0,0 +1,62 @@
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
+ <!-- set -->
10
+ <xsl:template match="set">
11
+ <xsl:if test="$quiet != 'true'">
12
+ <xsl:message>"set" is deprecated, please use assignments in place</xsl:message>
13
+ </xsl:if>
14
+
15
+ <xsl:variable name="spriteid">
16
+ <xsl:value-of select="swft:next-id()"/>
17
+ </xsl:variable>
18
+ <DefineSprite objectID="{$spriteid}" frames="1">
19
+ <tags>
20
+ <End/>
21
+ </tags>
22
+ </DefineSprite>
23
+ <Export>
24
+ <symbols>
25
+ <Symbol objectID="{$spriteid}" name="__Packages.swfmill.set.{@name}.{@member}"/>
26
+ </symbols>
27
+ </Export>
28
+ <DoInitAction sprite="{$spriteid}">
29
+ <actions>
30
+ <Dictionary>
31
+ <strings>
32
+ <String value="_root"/>
33
+ <String value="{@name}"/>
34
+ <String value="{@member}"/>
35
+ <String value="{@value}"/>
36
+ </strings>
37
+ </Dictionary>
38
+ <PushData>
39
+ <items>
40
+ <StackDictionaryLookup index="0"/>
41
+ </items>
42
+ </PushData>
43
+ <GetVariable/>
44
+ <PushData>
45
+ <items>
46
+ <StackDictionaryLookup index="1"/>
47
+ </items>
48
+ </PushData>
49
+ <GetMember/>
50
+ <PushData>
51
+ <items>
52
+ <StackDictionaryLookup index="2"/>
53
+ <StackDictionaryLookup index="3"/>
54
+ </items>
55
+ </PushData>
56
+ <SetMember/>
57
+ <EndAction/>
58
+ </actions>
59
+ </DoInitAction>
60
+ </xsl:template>
61
+
62
+ </xsl:stylesheet>
@@ -0,0 +1,627 @@
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
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
7
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
+ extension-element-prefixes="swft"
9
+ version='1.0'>
10
+
11
+ <!--
12
+ contains templates for most of the swfml-simple elements
13
+ -->
14
+
15
+ <xsl:variable name="movie-version">
16
+ <xsl:choose>
17
+ <xsl:when test="movie/@version"><xsl:value-of select="movie/@version"/></xsl:when>
18
+ <xsl:otherwise>7</xsl:otherwise>
19
+ </xsl:choose>
20
+ </xsl:variable>
21
+
22
+ <!-- basic SWF setup -->
23
+ <xsl:template match="movie">
24
+ <!-- set defaults for movie -->
25
+ <xsl:variable name="version" select="$movie-version"/>
26
+ <xsl:variable name="compressed">
27
+ <xsl:choose>
28
+ <xsl:when test="@compressed='true'">1</xsl:when>
29
+ <xsl:when test="@compressed='false'">0</xsl:when>
30
+ <xsl:otherwise>1</xsl:otherwise>
31
+ </xsl:choose>
32
+ </xsl:variable>
33
+ <xsl:variable name="framerate">
34
+ <xsl:choose>
35
+ <xsl:when test="@framerate"><xsl:value-of select="@framerate"/></xsl:when>
36
+ <xsl:otherwise>12</xsl:otherwise>
37
+ </xsl:choose>
38
+ </xsl:variable>
39
+ <xsl:variable name="frames">
40
+ <xsl:choose>
41
+ <xsl:when test="@frames"><xsl:value-of select="@frames"/></xsl:when>
42
+ <xsl:otherwise>1</xsl:otherwise>
43
+ </xsl:choose>
44
+ </xsl:variable>
45
+ <xsl:variable name="left">
46
+ <xsl:choose>
47
+ <xsl:when test="@left"><xsl:value-of select="@left * 20"/></xsl:when>
48
+ <xsl:otherwise>0</xsl:otherwise>
49
+ </xsl:choose>
50
+ </xsl:variable>
51
+ <xsl:variable name="top">
52
+ <xsl:choose>
53
+ <xsl:when test="@top"><xsl:value-of select="@top * 20"/></xsl:when>
54
+ <xsl:otherwise>0</xsl:otherwise>
55
+ </xsl:choose>
56
+ </xsl:variable>
57
+ <xsl:variable name="right">
58
+ <xsl:choose>
59
+ <xsl:when test="@width"><xsl:value-of select="$left + (@width * 20)"/></xsl:when>
60
+ <xsl:otherwise>6400</xsl:otherwise>
61
+ </xsl:choose>
62
+ </xsl:variable>
63
+ <xsl:variable name="bottom">
64
+ <xsl:choose>
65
+ <xsl:when test="@height"><xsl:value-of select="$top + (@height * 20)"/></xsl:when>
66
+ <xsl:otherwise>4800</xsl:otherwise>
67
+ </xsl:choose>
68
+ </xsl:variable>
69
+ <xsl:variable name="hasMetaData">
70
+ <xsl:choose>
71
+ <xsl:when test="count(meta) &gt; 0">1</xsl:when>
72
+ <xsl:otherwise>0</xsl:otherwise>
73
+ </xsl:choose>
74
+ </xsl:variable>
75
+ <xsl:variable name="useNetwork">
76
+ <xsl:choose>
77
+ <xsl:when test="@local-access = 'network'">1</xsl:when>
78
+ <xsl:when test="@local-access = 'filesystem'">0</xsl:when>
79
+ <xsl:otherwise>0</xsl:otherwise>
80
+ </xsl:choose>
81
+ </xsl:variable>
82
+ <xsl:variable name="as3">
83
+ <xsl:choose>
84
+ <xsl:when test="@as3">1</xsl:when>
85
+ <xsl:otherwise>0</xsl:otherwise>
86
+ </xsl:choose>
87
+ </xsl:variable>
88
+
89
+ <swf version="{$version}" compressed="{$compressed}">
90
+ <Header framerate="{$framerate}" frames="{$frames}">
91
+ <size>
92
+ <Rectangle left="{$left}" right="{$right}" top="{$top}" bottom="{$bottom}"/>
93
+ </size>
94
+ <tags>
95
+ <xsl:if test="$version >= 8">
96
+ <FileAttributes hasMetaData="{$hasMetaData}" useNetwork="{$useNetwork}" allowABC="{$as3}"/>
97
+ </xsl:if>
98
+ <xsl:apply-templates/>
99
+ <End/>
100
+ </tags>
101
+ </Header>
102
+ </swf>
103
+ </xsl:template>
104
+
105
+ <!-- background color -->
106
+ <xsl:template match="background">
107
+ <SetBackgroundColor>
108
+ <color>
109
+ <xsl:call-template name="color"/>
110
+ </color>
111
+ </SetBackgroundColor>
112
+ </xsl:template>
113
+
114
+ <xsl:template match="meta">
115
+ <Metadata>
116
+ <rdf:RDF>
117
+ <rdf:Description>
118
+ <xsl:apply-templates select="@*" mode="meta"/>
119
+ </rdf:Description>
120
+ <xsl:copy-of select="*"/>
121
+ </rdf:RDF>
122
+ </Metadata>
123
+ </xsl:template>
124
+
125
+ <xsl:template match="@title" mode="meta">
126
+ <dc:title>
127
+ <xsl:apply-templates/>
128
+ </dc:title>
129
+ </xsl:template>
130
+
131
+ <xsl:template match="@description" mode="meta">
132
+ <dc:description>
133
+ <xsl:apply-templates/>
134
+ </dc:description>
135
+ </xsl:template>
136
+
137
+ <xsl:template match="*|text()" mode="meta"/>
138
+
139
+ <!-- library just passes thru, children decide wether to export by themselves -->
140
+ <xsl:template match="library">
141
+ <xsl:apply-templates/>
142
+ </xsl:template>
143
+
144
+ <!-- linkage export -->
145
+ <xsl:template match="@id" mode="export">
146
+ <xsl:param name="id"/>
147
+ <Export count="1">
148
+ <symbols>
149
+ <Symbol objectID="{$id}">
150
+ <xsl:attribute name="name"><xsl:value-of select="."/></xsl:attribute>
151
+ </Symbol>
152
+ </symbols>
153
+ </Export>
154
+ </xsl:template>
155
+ <xsl:template match="@*" mode="export" priority="-1"/>
156
+
157
+ <!-- place -->
158
+ <xsl:template match="place">
159
+ <xsl:variable name="id">
160
+ <xsl:value-of select="swft:map-id(@id)"/>
161
+ </xsl:variable>
162
+ <xsl:variable name="x">
163
+ <xsl:choose>
164
+ <xsl:when test="@x"><xsl:value-of select="@x * 20"/></xsl:when>
165
+ <xsl:otherwise>0</xsl:otherwise>
166
+ </xsl:choose>
167
+ </xsl:variable>
168
+ <xsl:variable name="y">
169
+ <xsl:choose>
170
+ <xsl:when test="@y"><xsl:value-of select="@y * 20"/></xsl:when>
171
+ <xsl:otherwise>0</xsl:otherwise>
172
+ </xsl:choose>
173
+ </xsl:variable>
174
+ <xsl:variable name="scale">
175
+ <xsl:choose>
176
+ <xsl:when test="@scale"><xsl:value-of select="@scale"/></xsl:when>
177
+ <xsl:otherwise>1</xsl:otherwise>
178
+ </xsl:choose>
179
+ </xsl:variable>
180
+ <xsl:variable name="skewx">
181
+ <xsl:choose>
182
+ <xsl:when test="@skewx"><xsl:value-of select="@skewx"/></xsl:when>
183
+ <xsl:otherwise>0</xsl:otherwise>
184
+ </xsl:choose>
185
+ </xsl:variable>
186
+ <xsl:variable name="skewy">
187
+ <xsl:choose>
188
+ <xsl:when test="@skewy"><xsl:value-of select="@skewy"/></xsl:when>
189
+ <xsl:otherwise>0</xsl:otherwise>
190
+ </xsl:choose>
191
+ </xsl:variable>
192
+ <xsl:variable name="scalex">
193
+ <xsl:choose>
194
+ <xsl:when test="@scalex"><xsl:value-of select="@scalex"/></xsl:when>
195
+ <xsl:when test="@scale"><xsl:value-of select="@scale"/></xsl:when>
196
+ <xsl:otherwise>1</xsl:otherwise>
197
+ </xsl:choose>
198
+ </xsl:variable>
199
+ <xsl:variable name="scaley">
200
+ <xsl:choose>
201
+ <xsl:when test="@scaley"><xsl:value-of select="@scaley"/></xsl:when>
202
+ <xsl:when test="@scale"><xsl:value-of select="@scale"/></xsl:when>
203
+ <xsl:otherwise>1</xsl:otherwise>
204
+ </xsl:choose>
205
+ </xsl:variable>
206
+
207
+ <xsl:variable name="depth"><xsl:value-of select="@depth"/></xsl:variable>
208
+
209
+ <!-- Setting replace="1" doesn't work if we are replacing a sprite.
210
+ Instead, we remove the previous sprite with RemoveObject2,
211
+ and increment "morph". This strange requirement isn't
212
+ documented anywhere, but this is what Flash does, and it
213
+ works. See bug #409165 on Launchpad. -->
214
+ <xsl:variable name="replace">
215
+ <xsl:choose>
216
+ <xsl:when test="preceding-sibling::place[@depth=$depth] or ../preceding-sibling::frame/place[@depth=$depth]">1</xsl:when>
217
+ <xsl:otherwise>0</xsl:otherwise>
218
+ </xsl:choose>
219
+ </xsl:variable>
220
+ <xsl:variable name="morph">
221
+ <xsl:value-of select="count(preceding-sibling::place[@depth=$depth] |
222
+ ../preceding-sibling::frame/place[@depth=$depth])"/>
223
+ </xsl:variable>
224
+ <xsl:if test="$replace = '1'">
225
+ <RemoveObject2 depth="{@depth}"/>
226
+ </xsl:if>
227
+ <PlaceObject2 replace="0" morph="{$morph}" depth="{$depth}" objectID="{$id}">
228
+ <xsl:if test="@name">
229
+ <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
230
+ </xsl:if>
231
+ <xsl:if test="*">
232
+ <!-- 0x200: initialize -->
233
+ <xsl:attribute name="allflags1">0x200</xsl:attribute>
234
+ <events>
235
+ <Event flags1="0x200">
236
+ <actions>
237
+ <xsl:apply-templates mode="set"/>
238
+ <EndAction/>
239
+ </actions>
240
+ </Event>
241
+ <Event/>
242
+ </events>
243
+ </xsl:if>
244
+ <transform>
245
+ <Transform transX="{$x}" transY="{$y}" scaleX="{$scalex}" scaleY="{$scaley}" skewX="{$skewx}" skewY="{$skewy}"/>
246
+ </transform>
247
+ </PlaceObject2>
248
+ </xsl:template>
249
+
250
+
251
+ <!-- transform -->
252
+ <xsl:template match="transform">
253
+ <xsl:variable name="id">
254
+ <xsl:value-of select="swft:map-id(@id)"/>
255
+ </xsl:variable>
256
+ <xsl:variable name="myid">
257
+ <xsl:value-of select="@id"/>
258
+ </xsl:variable>
259
+ <xsl:variable name="x">
260
+ <xsl:choose>
261
+ <xsl:when test="@x"><xsl:value-of select="@x * 20"/></xsl:when>
262
+ <xsl:otherwise>0</xsl:otherwise>
263
+ </xsl:choose>
264
+ </xsl:variable>
265
+ <xsl:variable name="y">
266
+ <xsl:choose>
267
+ <xsl:when test="@y"><xsl:value-of select="@y * 20"/></xsl:when>
268
+ <xsl:otherwise>0</xsl:otherwise>
269
+ </xsl:choose>
270
+ </xsl:variable>
271
+ <xsl:variable name="scale">
272
+ <xsl:choose>
273
+ <xsl:when test="@scale"><xsl:value-of select="@scale"/></xsl:when>
274
+ <xsl:otherwise>1</xsl:otherwise>
275
+ </xsl:choose>
276
+ </xsl:variable>
277
+
278
+ <xsl:variable name="scalex">
279
+ <xsl:choose>
280
+ <xsl:when test="@scalex"><xsl:value-of select="@scalex"/></xsl:when>
281
+ <xsl:when test="@scale"><xsl:value-of select="@scale"/></xsl:when>
282
+ <xsl:otherwise>1</xsl:otherwise>
283
+ </xsl:choose>
284
+ </xsl:variable>
285
+ <xsl:variable name="scaley">
286
+ <xsl:choose>
287
+ <xsl:when test="@scaley"><xsl:value-of select="@scaley"/></xsl:when>
288
+ <xsl:when test="@scale"><xsl:value-of select="@scale"/></xsl:when>
289
+ <xsl:otherwise>1</xsl:otherwise>
290
+ </xsl:choose>
291
+ </xsl:variable>
292
+ <xsl:variable name="skewx">
293
+ <xsl:choose>
294
+ <xsl:when test="@skewx"><xsl:value-of select="@skewx"/></xsl:when>
295
+ <xsl:otherwise>0</xsl:otherwise>
296
+ </xsl:choose>
297
+ </xsl:variable>
298
+ <xsl:variable name="skewy">
299
+ <xsl:choose>
300
+ <xsl:when test="@skewy"><xsl:value-of select="@skewy"/></xsl:when>
301
+ <xsl:otherwise>0</xsl:otherwise>
302
+ </xsl:choose>
303
+ </xsl:variable>
304
+
305
+ <xsl:variable name="depth">
306
+ <xsl:value-of select="preceding-sibling::place[@id=$myid]/@depth"/>
307
+ </xsl:variable>
308
+
309
+ <PlaceObject2 replace="1" depth="{$depth}" objectID="{$id}">
310
+ <transform>
311
+ <Transform transX="{$x}" transY="{$y}" scaleX="{$scalex}" scaleY="{$scaley}" skewX="{$skewx}" skewY="{$skewy}"/>
312
+ </transform>
313
+ </PlaceObject2>
314
+ </xsl:template>
315
+
316
+ <!-- textfield -->
317
+ <xsl:template match="textfield">
318
+ <xsl:variable name="id">
319
+ <xsl:value-of select="swft:map-id(@id)"/>
320
+ </xsl:variable>
321
+ <xsl:variable name="x">
322
+ <xsl:choose>
323
+ <xsl:when test="@x"><xsl:value-of select="@x * 20"/></xsl:when>
324
+ <xsl:otherwise>0</xsl:otherwise>
325
+ </xsl:choose>
326
+ </xsl:variable>
327
+ <xsl:variable name="y">
328
+ <xsl:choose>
329
+ <xsl:when test="@y"><xsl:value-of select="@y * 20"/></xsl:when>
330
+ <xsl:otherwise>0</xsl:otherwise>
331
+ </xsl:choose>
332
+ </xsl:variable>
333
+ <xsl:variable name="width">
334
+ <xsl:choose>
335
+ <xsl:when test="@width"><xsl:value-of select="@width * 20"/></xsl:when>
336
+ <xsl:otherwise>100</xsl:otherwise>
337
+ </xsl:choose>
338
+ </xsl:variable>
339
+ <xsl:variable name="height">
340
+ <xsl:choose>
341
+ <xsl:when test="@height"><xsl:value-of select="@height * 20"/></xsl:when>
342
+ <xsl:otherwise>100</xsl:otherwise>
343
+ </xsl:choose>
344
+ </xsl:variable>
345
+ <xsl:variable name="size">
346
+ <xsl:choose>
347
+ <xsl:when test="@size"><xsl:value-of select="@size * 20"/></xsl:when>
348
+ <xsl:otherwise>240</xsl:otherwise>
349
+ </xsl:choose>
350
+ </xsl:variable>
351
+ <xsl:variable name="leading">
352
+ <xsl:choose>
353
+ <xsl:when test="@leading"><xsl:value-of select="@leading * 20"/></xsl:when>
354
+ <xsl:otherwise>20</xsl:otherwise>
355
+ </xsl:choose>
356
+ </xsl:variable>
357
+
358
+ <DefineEditText objectID="{$id}"
359
+ fontRef="{swft:map-id(@font)}" fontHeight="{$size}"
360
+ readOnly="0" autoSize="0" hasLayout="0"
361
+ notSelectable="0" hasBorder="0" isHTML="0" useOutlines="{@useOutlines}"
362
+ align="0" leftMargin="0" rightMargin="0" indent="0" leading="{$leading}"
363
+ wordWrap="1" multiLine="1" password="0"
364
+ variableName="{@name}"
365
+ >
366
+ <xsl:for-each select="@wordWrap|@multiLine|@password|@readOnly|@autoSize|@notSelectable|@hasBorder|@isHTML|@useOutlines|@align|@leftMargin|@rightMargin|@indent">
367
+ <xsl:copy-of select="."/>
368
+ </xsl:for-each>
369
+ <xsl:choose>
370
+ <xsl:when test="*|text()">
371
+ <xsl:attribute name="initialText">
372
+ <xsl:apply-templates select="*|text()" mode="htmltext"/>
373
+ </xsl:attribute>
374
+ </xsl:when>
375
+ <xsl:when test="@text">
376
+ <xsl:attribute name="initialText">
377
+ <xsl:value-of select="@text"/>
378
+ </xsl:attribute>
379
+ </xsl:when>
380
+ </xsl:choose>
381
+ <size>
382
+ <Rectangle left="{$x}" right="{$x + $width}" top="{$y}" bottom="{$y + $height}"/>
383
+ </size>
384
+ <color>
385
+ <xsl:call-template name="color-rgba"/>
386
+ </color>
387
+ </DefineEditText>
388
+
389
+ <xsl:if test="$movie-version &gt; 7">
390
+ <xsl:apply-templates select="text-settings">
391
+ <xsl:with-param name="id" select="$id"/>
392
+ </xsl:apply-templates>
393
+ </xsl:if>
394
+
395
+ </xsl:template>
396
+
397
+ <xsl:template match="text-settings">
398
+ <xsl:param name="id" select="0"/>
399
+
400
+ <CSMTextSettings objectId="{$id}">
401
+ <xsl:attribute name="useFlashType">
402
+ <xsl:choose>
403
+ <xsl:when test="@render = 'advanced'">1</xsl:when>
404
+ <xsl:otherwise>0</xsl:otherwise>
405
+ </xsl:choose>
406
+ </xsl:attribute>
407
+ <xsl:attribute name="gridFit">
408
+ <xsl:choose>
409
+ <xsl:when test="@grid = 'sub-pixel'">2</xsl:when>
410
+ <xsl:when test="@grid = 'pixel'">1</xsl:when>
411
+ <xsl:otherwise>0</xsl:otherwise>
412
+ </xsl:choose>
413
+ </xsl:attribute>
414
+ <xsl:attribute name="thickness">
415
+ <xsl:choose>
416
+ <xsl:when test="@thickness">
417
+ <xsl:choose>
418
+ <xsl:when test="@thickness &lt; -200">
419
+ <xsl:value-of select="-200"/>
420
+ </xsl:when>
421
+ <xsl:when test="@thickness &gt; 200">
422
+ <xsl:value-of select="200"/>
423
+ </xsl:when>
424
+ <xsl:otherwise>
425
+ <xsl:value-of select="@thickness"/>
426
+ </xsl:otherwise>
427
+ </xsl:choose>
428
+ </xsl:when>
429
+ <xsl:otherwise>0</xsl:otherwise>
430
+ </xsl:choose>
431
+ </xsl:attribute>
432
+ <xsl:attribute name="sharpness">
433
+ <xsl:choose>
434
+ <xsl:when test="@sharpness">
435
+ <xsl:choose>
436
+ <xsl:when test="@sharpness &lt; -400">
437
+ <xsl:value-of select="-400"/>
438
+ </xsl:when>
439
+ <xsl:when test="@sharpness &gt; 400">
440
+ <xsl:value-of select="400"/>
441
+ </xsl:when>
442
+ <xsl:otherwise>
443
+ <xsl:value-of select="@sharpness"/>
444
+ </xsl:otherwise>
445
+ </xsl:choose>
446
+ </xsl:when>
447
+ <xsl:otherwise>0</xsl:otherwise>
448
+ </xsl:choose>
449
+ </xsl:attribute>
450
+ </CSMTextSettings>
451
+ </xsl:template>
452
+
453
+
454
+ <!-- video object -->
455
+ <xsl:template match="video">
456
+ <xsl:variable name="id">
457
+ <xsl:choose>
458
+ <xsl:when test="@id">
459
+ <xsl:value-of select="swft:map-id(@id)"/>
460
+ </xsl:when>
461
+ <xsl:otherwise>
462
+ <xsl:value-of select="swft:next-id()"/>
463
+ </xsl:otherwise>
464
+ </xsl:choose>
465
+ </xsl:variable>
466
+ <xsl:variable name="frames">
467
+ <xsl:choose>
468
+ <xsl:when test="@frames"><xsl:value-of select="@frames"/></xsl:when>
469
+ <xsl:otherwise>0</xsl:otherwise>
470
+ </xsl:choose>
471
+ </xsl:variable>
472
+ <xsl:variable name="width">
473
+ <xsl:choose>
474
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
475
+ <xsl:otherwise>160</xsl:otherwise>
476
+ </xsl:choose>
477
+ </xsl:variable>
478
+ <xsl:variable name="height">
479
+ <xsl:choose>
480
+ <xsl:when test="@height"><xsl:value-of select="@height"/></xsl:when>
481
+ <xsl:otherwise>120</xsl:otherwise>
482
+ </xsl:choose>
483
+ </xsl:variable>
484
+ <xsl:variable name="deblocking">
485
+ <xsl:choose>
486
+ <xsl:when test="@deblocking"><xsl:value-of select="@deblocking"/></xsl:when>
487
+ <xsl:otherwise>0</xsl:otherwise>
488
+ </xsl:choose>
489
+ </xsl:variable>
490
+ <xsl:variable name="smoothing">
491
+ <xsl:choose>
492
+ <xsl:when test="@smoothing">1</xsl:when>
493
+ <xsl:otherwise>0</xsl:otherwise>
494
+ </xsl:choose>
495
+ </xsl:variable>
496
+ <xsl:variable name="codec">
497
+ <xsl:choose>
498
+ <xsl:when test="@codec"><xsl:value-of select="@codec"/></xsl:when>
499
+ <xsl:otherwise>0</xsl:otherwise>
500
+ </xsl:choose>
501
+ </xsl:variable>
502
+ <DefineVideoStream objectID="{$id}" frames="{$frames}" width="{$width}" height="{$height}" deblocking="{$deblocking}" smoothing="{$smoothing}" codec="{$codec}"/>
503
+ </xsl:template>
504
+
505
+ <!-- frame -->
506
+ <xsl:template match="frame">
507
+ <xsl:apply-templates/>
508
+ <xsl:if test="@name">
509
+ <FrameLabel label="{@name}"/>
510
+ </xsl:if>
511
+ <ShowFrame/>
512
+ </xsl:template>
513
+
514
+
515
+ <!-- generic clip (w/o @import, these are handled in simple-import.xslt) -->
516
+ <xsl:template match="clip" priority="-1">
517
+ <xsl:variable name="id">
518
+ <xsl:choose>
519
+ <xsl:when test="@id">
520
+ <xsl:value-of select="swft:map-id(@id)"/>
521
+ </xsl:when>
522
+ <xsl:otherwise>
523
+ <xsl:value-of select="swft:next-id()"/>
524
+ </xsl:otherwise>
525
+ </xsl:choose>
526
+ </xsl:variable>
527
+ <xsl:variable name="frames">
528
+ <xsl:choose>
529
+ <xsl:when test="count(frame)">
530
+ <xsl:value-of select="count(frame)"/>
531
+ </xsl:when>
532
+ <xsl:otherwise>1</xsl:otherwise>
533
+ </xsl:choose>
534
+ </xsl:variable>
535
+ <DefineSprite objectID="{$id}" frames="{$frames}">
536
+ <tags>
537
+ <xsl:apply-templates/>
538
+ <End/>
539
+ </tags>
540
+ </DefineSprite>
541
+ <xsl:if test="ancestor::library">
542
+ <xsl:apply-templates select="*|@*" mode="export">
543
+ <xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
544
+ </xsl:apply-templates>
545
+ </xsl:if>
546
+ <xsl:if test="@class">
547
+ <xsl:call-template name="register-class">
548
+ <xsl:with-param name="class" select="@class"/>
549
+ <xsl:with-param name="linkage-id" select="@id"/>
550
+ </xsl:call-template>
551
+ </xsl:if>
552
+ </xsl:template>
553
+
554
+ <!-- scale grid -->
555
+ <xsl:template match="scale-grid">
556
+ <xsl:variable name="id">
557
+ <xsl:value-of select="swft:map-id(@id)"/>
558
+ </xsl:variable>
559
+ <xsl:if test="number(/movie/@version) >= 8">
560
+ <DefineScalingGrid objectID="{$id}"> <!-- FIXME ID not Id? does it matter? -->
561
+ <splitter>
562
+ <Rectangle left="{@left * 20}" right="{@right * 20}" top="{@top * 20}" bottom="{@bottom * 20}"/>
563
+ </splitter>
564
+ </DefineScalingGrid>
565
+ </xsl:if>
566
+ </xsl:template>
567
+
568
+ <!-- stop -->
569
+ <xsl:template match="stop">
570
+ <DoAction>
571
+ <actions>
572
+ <Stop/>
573
+ <EndAction/>
574
+ </actions>
575
+ </DoAction>
576
+ </xsl:template>
577
+
578
+
579
+ <!-- call -->
580
+ <xsl:template match="call">
581
+ <xsl:variable name="object">
582
+ <xsl:choose>
583
+ <xsl:when test="@object"><xsl:value-of select="@object"/></xsl:when>
584
+ <xsl:otherwise>Main</xsl:otherwise>
585
+ </xsl:choose>
586
+ </xsl:variable>
587
+ <xsl:variable name="method">
588
+ <xsl:choose>
589
+ <xsl:when test="@method"><xsl:value-of select="@method"/></xsl:when>
590
+ <xsl:otherwise>main</xsl:otherwise>
591
+ </xsl:choose>
592
+ </xsl:variable>
593
+ <xsl:variable name="spriteid">
594
+ <xsl:value-of select="swft:next-id()"/>
595
+ </xsl:variable>
596
+ <DefineSprite objectID="{$spriteid}" frames="1">
597
+ <tags>
598
+ <End/>
599
+ </tags>
600
+ </DefineSprite>
601
+ <Export>
602
+ <symbols>
603
+ <Symbol objectID="{$spriteid}" name="__Packages.swfmill.call.{$object}.{$method}"/>
604
+ </symbols>
605
+ </Export>
606
+ <DoInitAction sprite="{$spriteid}">
607
+ <actions>
608
+ <PushData>
609
+ <items>
610
+ <StackString value="{@object}"/>
611
+ </items>
612
+ </PushData>
613
+ <GetVariable/>
614
+ <PushData>
615
+ <items>
616
+ <StackString value="{@method}"/>
617
+ </items>
618
+ </PushData>
619
+ <CallMethod/>
620
+ <Pop/>
621
+ <EndAction/>
622
+ </actions>
623
+ </DoInitAction>
624
+ </xsl:template>
625
+
626
+
627
+ </xsl:stylesheet>