swfmill 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +23 -0
- data/.swfmill +240 -0
- data/LICENSE +340 -0
- data/README.rdoc +37 -0
- data/Rakefile +59 -0
- data/VERSION +1 -0
- data/ext/.gitignore +5 -0
- data/ext/extconf.rb +86 -0
- data/ext/swfmill/.gitignore +27 -0
- data/ext/swfmill/AUTHORS +9 -0
- data/ext/swfmill/COPYING +340 -0
- data/ext/swfmill/Makefile.am +14 -0
- data/ext/swfmill/Makefile.in +635 -0
- data/ext/swfmill/NEWS +189 -0
- data/ext/swfmill/README +170 -0
- data/ext/swfmill/TODO +33 -0
- data/ext/swfmill/aclocal.m4 +7712 -0
- data/ext/swfmill/autogen.sh +7 -0
- data/ext/swfmill/compile +142 -0
- data/ext/swfmill/config.guess +1516 -0
- data/ext/swfmill/config.sub +1626 -0
- data/ext/swfmill/configure +21868 -0
- data/ext/swfmill/configure.ac +55 -0
- data/ext/swfmill/depcomp +589 -0
- data/ext/swfmill/install-sh +519 -0
- data/ext/swfmill/ltmain.sh +6964 -0
- data/ext/swfmill/missing +367 -0
- data/ext/swfmill/src/Geom.cpp +107 -0
- data/ext/swfmill/src/Geom.h +100 -0
- data/ext/swfmill/src/Makefile.am +86 -0
- data/ext/swfmill/src/Makefile.in +1025 -0
- data/ext/swfmill/src/SWF.h +11941 -0
- data/ext/swfmill/src/SWFAction.cpp +41 -0
- data/ext/swfmill/src/SWFAction.h +19 -0
- data/ext/swfmill/src/SWFBasic.h +7 -0
- data/ext/swfmill/src/SWFFile.cpp +406 -0
- data/ext/swfmill/src/SWFFile.h +34 -0
- data/ext/swfmill/src/SWFFilter.cpp +25 -0
- data/ext/swfmill/src/SWFFilter.h +15 -0
- data/ext/swfmill/src/SWFGlyphList.cpp +262 -0
- data/ext/swfmill/src/SWFGlyphList.h +34 -0
- data/ext/swfmill/src/SWFIdItem.h +85 -0
- data/ext/swfmill/src/SWFIdItems.h +16 -0
- data/ext/swfmill/src/SWFItem.cpp +235 -0
- data/ext/swfmill/src/SWFItem.h +60 -0
- data/ext/swfmill/src/SWFList.h +179 -0
- data/ext/swfmill/src/SWFReader.cpp +352 -0
- data/ext/swfmill/src/SWFReader.h +73 -0
- data/ext/swfmill/src/SWFShapeItem.cpp +220 -0
- data/ext/swfmill/src/SWFShapeItem.h +45 -0
- data/ext/swfmill/src/SWFShapeMaker.cpp +401 -0
- data/ext/swfmill/src/SWFShapeMaker.h +128 -0
- data/ext/swfmill/src/SWFTag.cpp +49 -0
- data/ext/swfmill/src/SWFTag.h +20 -0
- data/ext/swfmill/src/SWFTrait.cpp +35 -0
- data/ext/swfmill/src/SWFTrait.h +22 -0
- data/ext/swfmill/src/SWFWriter.cpp +312 -0
- data/ext/swfmill/src/SWFWriter.h +84 -0
- data/ext/swfmill/src/base64.c +110 -0
- data/ext/swfmill/src/base64.h +15 -0
- data/ext/swfmill/src/codegen/Makefile.am +15 -0
- data/ext/swfmill/src/codegen/Makefile.in +346 -0
- data/ext/swfmill/src/codegen/basic.xsl +45 -0
- data/ext/swfmill/src/codegen/basics.xsl +235 -0
- data/ext/swfmill/src/codegen/dumper.xsl +109 -0
- data/ext/swfmill/src/codegen/header.xsl +131 -0
- data/ext/swfmill/src/codegen/mk.xsl +26 -0
- data/ext/swfmill/src/codegen/parser.xsl +196 -0
- data/ext/swfmill/src/codegen/parsexml.xsl +312 -0
- data/ext/swfmill/src/codegen/size.xsl +189 -0
- data/ext/swfmill/src/codegen/source.xml +2197 -0
- data/ext/swfmill/src/codegen/writer.xsl +190 -0
- data/ext/swfmill/src/codegen/writexml.xsl +138 -0
- data/ext/swfmill/src/swfmill.cpp +482 -0
- data/ext/swfmill/src/swft/Makefile.am +55 -0
- data/ext/swfmill/src/swft/Makefile.in +717 -0
- data/ext/swfmill/src/swft/Parser.cpp +76 -0
- data/ext/swfmill/src/swft/Parser.h +37 -0
- data/ext/swfmill/src/swft/SVGAttributeParser.cpp +78 -0
- data/ext/swfmill/src/swft/SVGAttributeParser.h +35 -0
- data/ext/swfmill/src/swft/SVGColor.cpp +116 -0
- data/ext/swfmill/src/swft/SVGColor.h +37 -0
- data/ext/swfmill/src/swft/SVGColors.h +167 -0
- data/ext/swfmill/src/swft/SVGGradient.cpp +258 -0
- data/ext/swfmill/src/swft/SVGGradient.h +81 -0
- data/ext/swfmill/src/swft/SVGPathParser.cpp +155 -0
- data/ext/swfmill/src/swft/SVGPathParser.h +126 -0
- data/ext/swfmill/src/swft/SVGPointsParser.cpp +51 -0
- data/ext/swfmill/src/swft/SVGPointsParser.h +25 -0
- data/ext/swfmill/src/swft/SVGStyle.cpp +181 -0
- data/ext/swfmill/src/swft/SVGStyle.h +80 -0
- data/ext/swfmill/src/swft/SVGTransformParser.cpp +72 -0
- data/ext/swfmill/src/swft/SVGTransformParser.h +32 -0
- data/ext/swfmill/src/swft/readpng.c +305 -0
- data/ext/swfmill/src/swft/readpng.h +92 -0
- data/ext/swfmill/src/swft/swft.cpp +251 -0
- data/ext/swfmill/src/swft/swft.h +64 -0
- data/ext/swfmill/src/swft/swft_document.cpp +57 -0
- data/ext/swfmill/src/swft/swft_import.cpp +38 -0
- data/ext/swfmill/src/swft/swft_import_binary.cpp +82 -0
- data/ext/swfmill/src/swft/swft_import_jpeg.cpp +255 -0
- data/ext/swfmill/src/swft/swft_import_mp3.cpp +268 -0
- data/ext/swfmill/src/swft/swft_import_png.cpp +231 -0
- data/ext/swfmill/src/swft/swft_import_ttf.cpp +519 -0
- data/ext/swfmill/src/swft/swft_import_wav.cpp +255 -0
- data/ext/swfmill/src/swft/swft_path.cpp +178 -0
- data/ext/swfmill/src/xslt/Makefile.am +51 -0
- data/ext/swfmill/src/xslt/Makefile.in +536 -0
- data/ext/swfmill/src/xslt/README +19 -0
- data/ext/swfmill/src/xslt/assemble.xsl +38 -0
- data/ext/swfmill/src/xslt/simple-deprecated.xslt +62 -0
- data/ext/swfmill/src/xslt/simple-elements.xslt +627 -0
- data/ext/swfmill/src/xslt/simple-import.xslt +565 -0
- data/ext/swfmill/src/xslt/simple-svg.xslt +383 -0
- data/ext/swfmill/src/xslt/simple-tools.xslt +255 -0
- data/ext/swfmill/src/xslt/simple.cpp +1686 -0
- data/ext/swfmill/src/xslt/simple.xml +7 -0
- data/ext/swfmill/src/xslt/xslt.h +7 -0
- data/ext/swfmill/test/Makefile.am +1 -0
- data/ext/swfmill/test/Makefile.in +490 -0
- data/ext/swfmill/test/xml/Makefile.am +20 -0
- data/ext/swfmill/test/xml/Makefile.in +353 -0
- data/ext/swfmill/test/xml/test-xml +21 -0
- data/ext/swfmill_ext.cc +375 -0
- data/lib/swfmill.rb +30 -0
- data/spec/data/swfmill-banner1.swf +0 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/swfmill_spec.rb +125 -0
- metadata +206 -0
@@ -0,0 +1,565 @@
|
|
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
|
+
|
10
|
+
<xsl:template match="clip[@import]|sound[@import]">
|
11
|
+
<xsl:variable name="id">
|
12
|
+
<xsl:choose>
|
13
|
+
<xsl:when test="@id">
|
14
|
+
<xsl:value-of select="swft:map-id(@id)"/>
|
15
|
+
</xsl:when>
|
16
|
+
<xsl:otherwise>
|
17
|
+
<xsl:value-of select="swft:next-id()"/>
|
18
|
+
</xsl:otherwise>
|
19
|
+
</xsl:choose>
|
20
|
+
</xsl:variable>
|
21
|
+
<xsl:variable name="file">
|
22
|
+
<xsl:value-of select="@import"/>
|
23
|
+
</xsl:variable>
|
24
|
+
<xsl:variable name="mask">
|
25
|
+
<xsl:value-of select="@mask"/>
|
26
|
+
</xsl:variable>
|
27
|
+
<xsl:variable name="ext">
|
28
|
+
<xsl:value-of select="translate(substring(@import,string-length(@import)-2),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
|
29
|
+
</xsl:variable>
|
30
|
+
<xsl:choose>
|
31
|
+
<xsl:when test="@mask">
|
32
|
+
<xsl:apply-templates select="swft:import-jpega($file,$mask)" mode="makeswf">
|
33
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
34
|
+
</xsl:apply-templates>
|
35
|
+
</xsl:when>
|
36
|
+
<xsl:when test="$ext = 'jpg' or $ext = 'peg'">
|
37
|
+
<xsl:apply-templates select="swft:import-jpeg($file)" mode="makeswf">
|
38
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
39
|
+
</xsl:apply-templates>
|
40
|
+
</xsl:when>
|
41
|
+
<xsl:when test="$ext = 'png'">
|
42
|
+
<xsl:apply-templates select="swft:import-png($file)" mode="makeswf">
|
43
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
44
|
+
</xsl:apply-templates>
|
45
|
+
</xsl:when>
|
46
|
+
<xsl:when test="$ext = 'swf'">
|
47
|
+
<xsl:apply-templates select="swft:document($file)" mode="makeswf">
|
48
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
49
|
+
</xsl:apply-templates>
|
50
|
+
</xsl:when>
|
51
|
+
<!-- this is stupid, shouldnt be used.
|
52
|
+
<xsl:when test="$ext = 'ttf'">
|
53
|
+
<xsl:apply-templates select="swft:import-ttf($file,@glyphs,'hello')" mode="makeswf">
|
54
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
55
|
+
</xsl:apply-templates>
|
56
|
+
</xsl:when>
|
57
|
+
-->
|
58
|
+
<xsl:when test="$ext = 'svg'">
|
59
|
+
<swft:push-map/>
|
60
|
+
<xsl:apply-templates select="document($file)" mode="svg">
|
61
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
62
|
+
<xsl:with-param name="export">
|
63
|
+
<xsl:choose>
|
64
|
+
<xsl:when test="@export"><xsl:value-of select="@export"/></xsl:when>
|
65
|
+
<xsl:otherwise>all</xsl:otherwise>
|
66
|
+
</xsl:choose>
|
67
|
+
</xsl:with-param>
|
68
|
+
</xsl:apply-templates>
|
69
|
+
<swft:pop-map/>
|
70
|
+
</xsl:when>
|
71
|
+
<xsl:when test="$ext = 'mp3'">
|
72
|
+
<xsl:apply-templates select="swft:import-mp3($file)" mode="makeswf">
|
73
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
74
|
+
</xsl:apply-templates>
|
75
|
+
</xsl:when>
|
76
|
+
<xsl:when test="$ext = 'wav'">
|
77
|
+
<xsl:apply-templates select="swft:import-wav($file)" mode="makeswf">
|
78
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
79
|
+
</xsl:apply-templates>
|
80
|
+
</xsl:when>
|
81
|
+
<xsl:otherwise>
|
82
|
+
<xsl:message>WARNING: Cannot import <xsl:value-of select="$file"/> (unknown extension), skipping.</xsl:message>
|
83
|
+
</xsl:otherwise>
|
84
|
+
</xsl:choose>
|
85
|
+
<xsl:if test="ancestor::library">
|
86
|
+
<xsl:apply-templates select="*|@*" mode="export">
|
87
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
88
|
+
</xsl:apply-templates>
|
89
|
+
</xsl:if>
|
90
|
+
<xsl:if test="@class">
|
91
|
+
<xsl:call-template name="register-class">
|
92
|
+
<xsl:with-param name="class" select="@class"/>
|
93
|
+
<xsl:with-param name="linkage-id" select="@id"/>
|
94
|
+
</xsl:call-template>
|
95
|
+
</xsl:if>
|
96
|
+
</xsl:template>
|
97
|
+
|
98
|
+
<xsl:template match="bitmap[@import]">
|
99
|
+
<xsl:variable name="id">
|
100
|
+
<xsl:choose>
|
101
|
+
<xsl:when test="@id">
|
102
|
+
<xsl:value-of select="swft:map-id(@id)"/>
|
103
|
+
</xsl:when>
|
104
|
+
<xsl:otherwise>
|
105
|
+
<xsl:value-of select="swft:next-id()"/>
|
106
|
+
</xsl:otherwise>
|
107
|
+
</xsl:choose>
|
108
|
+
</xsl:variable>
|
109
|
+
<xsl:variable name="file">
|
110
|
+
<xsl:value-of select="@import"/>
|
111
|
+
</xsl:variable>
|
112
|
+
<xsl:variable name="mask">
|
113
|
+
<xsl:value-of select="@mask"/>
|
114
|
+
</xsl:variable>
|
115
|
+
<xsl:variable name="ext">
|
116
|
+
<xsl:value-of select="translate(substring(@import,string-length(@import)-2),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
|
117
|
+
</xsl:variable>
|
118
|
+
<xsl:choose>
|
119
|
+
<xsl:when test="@mask">
|
120
|
+
<xsl:apply-templates select="swft:import-jpega($file,$mask)" mode="bitmap">
|
121
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
122
|
+
</xsl:apply-templates>
|
123
|
+
</xsl:when>
|
124
|
+
<xsl:when test="$ext = 'jpg' or $ext = 'peg'">
|
125
|
+
<xsl:apply-templates select="swft:import-jpeg($file)" mode="bitmap">
|
126
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
127
|
+
</xsl:apply-templates>
|
128
|
+
</xsl:when>
|
129
|
+
<xsl:when test="$ext = 'png'">
|
130
|
+
<xsl:apply-templates select="swft:import-png($file)" mode="bitmap">
|
131
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
132
|
+
</xsl:apply-templates>
|
133
|
+
</xsl:when>
|
134
|
+
<xsl:otherwise>
|
135
|
+
<xsl:message>WARNING: Cannot import <xsl:value-of select="$file"/> (unknown extension), skipping.</xsl:message>
|
136
|
+
</xsl:otherwise>
|
137
|
+
</xsl:choose>
|
138
|
+
<xsl:if test="ancestor::library">
|
139
|
+
<xsl:apply-templates select="*|@*" mode="export">
|
140
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
141
|
+
</xsl:apply-templates>
|
142
|
+
</xsl:if>
|
143
|
+
</xsl:template>
|
144
|
+
|
145
|
+
<xsl:template match="font[@import]">
|
146
|
+
<xsl:variable name="id">
|
147
|
+
<xsl:choose>
|
148
|
+
<xsl:when test="@id">
|
149
|
+
<xsl:value-of select="swft:map-id(@id)"/>
|
150
|
+
</xsl:when>
|
151
|
+
<xsl:otherwise>
|
152
|
+
<xsl:value-of select="swft:next-id()"/>
|
153
|
+
</xsl:otherwise>
|
154
|
+
</xsl:choose>
|
155
|
+
</xsl:variable>
|
156
|
+
<xsl:variable name="file">
|
157
|
+
<xsl:value-of select="@import"/>
|
158
|
+
</xsl:variable>
|
159
|
+
<xsl:variable name="offset">
|
160
|
+
<xsl:choose>
|
161
|
+
<xsl:when test="@symbol='true'">
|
162
|
+
<xsl:value-of select="-61440"/>
|
163
|
+
</xsl:when>
|
164
|
+
<xsl:otherwise>
|
165
|
+
<xsl:value-of select="0"/>
|
166
|
+
</xsl:otherwise>
|
167
|
+
</xsl:choose>
|
168
|
+
</xsl:variable>
|
169
|
+
|
170
|
+
<xsl:apply-templates select="swft:import-ttf($file,$movie-version,@glyphs,@name,$offset)" mode="makeswf">
|
171
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
172
|
+
</xsl:apply-templates>
|
173
|
+
|
174
|
+
<xsl:if test="ancestor::library">
|
175
|
+
<xsl:apply-templates select="*|@*" mode="export">
|
176
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
177
|
+
</xsl:apply-templates>
|
178
|
+
</xsl:if>
|
179
|
+
</xsl:template>
|
180
|
+
|
181
|
+
<xsl:template match="binary[@import]">
|
182
|
+
<xsl:variable name="id">
|
183
|
+
<xsl:choose>
|
184
|
+
<xsl:when test="@id">
|
185
|
+
<xsl:value-of select="swft:map-id(@id)"/>
|
186
|
+
</xsl:when>
|
187
|
+
<xsl:otherwise>
|
188
|
+
<xsl:value-of select="swft:next-id()"/>
|
189
|
+
</xsl:otherwise>
|
190
|
+
</xsl:choose>
|
191
|
+
</xsl:variable>
|
192
|
+
<xsl:variable name="file">
|
193
|
+
<xsl:value-of select="@import"/>
|
194
|
+
</xsl:variable>
|
195
|
+
|
196
|
+
<xsl:apply-templates select="swft:import-binary($file)" mode="makeswf">
|
197
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
198
|
+
</xsl:apply-templates>
|
199
|
+
|
200
|
+
<xsl:if test="ancestor::library">
|
201
|
+
<xsl:apply-templates select="*|@*" mode="export">
|
202
|
+
<xsl:with-param name="id"><xsl:value-of select="$id"/></xsl:with-param>
|
203
|
+
</xsl:apply-templates>
|
204
|
+
</xsl:if>
|
205
|
+
</xsl:template>
|
206
|
+
|
207
|
+
<!-- device fonts -->
|
208
|
+
<xsl:template match="font" priority="-1">
|
209
|
+
<xsl:variable name="id">
|
210
|
+
<xsl:choose>
|
211
|
+
<xsl:when test="@id">
|
212
|
+
<xsl:value-of select="swft:map-id(@id)"/>
|
213
|
+
</xsl:when>
|
214
|
+
<xsl:otherwise>
|
215
|
+
<xsl:value-of select="swft:next-id()"/>
|
216
|
+
</xsl:otherwise>
|
217
|
+
</xsl:choose>
|
218
|
+
</xsl:variable>
|
219
|
+
<DefineFont2 objectID="{$id}" isShiftJIS="0" isUnicode="0" isANSII="0" wideGlyphOffsets="0" italic="0" bold="0" language="1" name="{@name}">
|
220
|
+
</DefineFont2>
|
221
|
+
</xsl:template>
|
222
|
+
|
223
|
+
<!-- JPEG import -->
|
224
|
+
<xsl:template match="jpeg" mode="makeswf">
|
225
|
+
<xsl:param name="id"/>
|
226
|
+
<xsl:variable name="bitmapID"><xsl:value-of select="swft:next-id()"/></xsl:variable>
|
227
|
+
<xsl:variable name="shapeID"><xsl:value-of select="swft:next-id()"/></xsl:variable>
|
228
|
+
<DefineBitsJPEG2 objectID="{$bitmapID}">
|
229
|
+
<data>
|
230
|
+
<xsl:copy-of select="data"/>
|
231
|
+
</data>
|
232
|
+
</DefineBitsJPEG2>
|
233
|
+
<DefineShape objectID="{$shapeID}">
|
234
|
+
<bounds>
|
235
|
+
<Rectangle left="0" right="{@width}" top="0" bottom="{@height}"/>
|
236
|
+
</bounds>
|
237
|
+
<styles>
|
238
|
+
<StyleList>
|
239
|
+
<fillStyles>
|
240
|
+
<ClippedBitmap objectID="{$bitmapID}">
|
241
|
+
<matrix>
|
242
|
+
<Transform transX="0" transY="0"/>
|
243
|
+
</matrix>
|
244
|
+
</ClippedBitmap>
|
245
|
+
</fillStyles>
|
246
|
+
<lineStyles/>
|
247
|
+
</StyleList>
|
248
|
+
</styles>
|
249
|
+
<shapes>
|
250
|
+
<Shape>
|
251
|
+
<edges>
|
252
|
+
<ShapeSetup x="{@width}" y="{@height}" fillStyle1="1"/>
|
253
|
+
<LineTo x="-{@width}" y="0"/>
|
254
|
+
<LineTo x="0" y="-{@height}"/>
|
255
|
+
<LineTo x="{@width}" y="0"/>
|
256
|
+
<LineTo x="0" y="{@height}"/>
|
257
|
+
<ShapeSetup/>
|
258
|
+
</edges>
|
259
|
+
</Shape>
|
260
|
+
</shapes>
|
261
|
+
</DefineShape>
|
262
|
+
<DefineSprite objectID="{$id}" frames="1">
|
263
|
+
<tags>
|
264
|
+
<PlaceObject2 replace="0" depth="1" objectID="{$shapeID}">
|
265
|
+
<transform>
|
266
|
+
<Transform transX="0" transY="0" scaleX="20" scaleY="20"/>
|
267
|
+
</transform>
|
268
|
+
</PlaceObject2>
|
269
|
+
<ShowFrame/>
|
270
|
+
<End/>
|
271
|
+
</tags>
|
272
|
+
</DefineSprite>
|
273
|
+
</xsl:template>
|
274
|
+
|
275
|
+
<!-- JPEG-A import -->
|
276
|
+
<xsl:template match="jpega" mode="makeswf">
|
277
|
+
<xsl:param name="id"/>
|
278
|
+
<xsl:variable name="bitmapID"><xsl:value-of select="swft:next-id()"/></xsl:variable>
|
279
|
+
<xsl:variable name="shapeID"><xsl:value-of select="swft:next-id()"/></xsl:variable>
|
280
|
+
<DefineBitsJPEG3 objectID="{$bitmapID}" offset_to_alpha="{@offset_to_alpha}">
|
281
|
+
<data>
|
282
|
+
<xsl:copy-of select="data"/>
|
283
|
+
</data>
|
284
|
+
</DefineBitsJPEG3>
|
285
|
+
<DefineShape objectID="{$shapeID}">
|
286
|
+
<bounds>
|
287
|
+
<Rectangle left="0" right="{@width}" top="0" bottom="{@height}"/>
|
288
|
+
</bounds>
|
289
|
+
<styles>
|
290
|
+
<StyleList>
|
291
|
+
<fillStyles>
|
292
|
+
<ClippedBitmap objectID="{$bitmapID}">
|
293
|
+
<matrix>
|
294
|
+
<Transform transX="0" transY="0"/>
|
295
|
+
</matrix>
|
296
|
+
</ClippedBitmap>
|
297
|
+
</fillStyles>
|
298
|
+
<lineStyles/>
|
299
|
+
</StyleList>
|
300
|
+
</styles>
|
301
|
+
<shapes>
|
302
|
+
<Shape>
|
303
|
+
<edges>
|
304
|
+
<ShapeSetup x="{@width}" y="{@height}" fillStyle1="1"/>
|
305
|
+
<LineTo x="-{@width}" y="0"/>
|
306
|
+
<LineTo x="0" y="-{@height}"/>
|
307
|
+
<LineTo x="{@width}" y="0"/>
|
308
|
+
<LineTo x="0" y="{@height}"/>
|
309
|
+
<ShapeSetup/>
|
310
|
+
</edges>
|
311
|
+
</Shape>
|
312
|
+
</shapes>
|
313
|
+
</DefineShape>
|
314
|
+
<DefineSprite objectID="{$id}" frames="1">
|
315
|
+
<tags>
|
316
|
+
<PlaceObject2 replace="0" depth="1" objectID="{$shapeID}">
|
317
|
+
<transform>
|
318
|
+
<Transform transX="0" transY="0" scaleX="20" scaleY="20"/>
|
319
|
+
</transform>
|
320
|
+
</PlaceObject2>
|
321
|
+
<ShowFrame/>
|
322
|
+
<End/>
|
323
|
+
</tags>
|
324
|
+
</DefineSprite>
|
325
|
+
</xsl:template>
|
326
|
+
|
327
|
+
<!-- PNG import -->
|
328
|
+
<xsl:template match="png" mode="makeswf">
|
329
|
+
<xsl:param name="id"/>
|
330
|
+
<xsl:variable name="bitmapID"><xsl:value-of select="swft:next-id()"/></xsl:variable>
|
331
|
+
<xsl:variable name="shapeID"><xsl:value-of select="swft:next-id()"/></xsl:variable>
|
332
|
+
<DefineBitsLossless2 format="{@format}" width="{@width}" height="{@height}" n_colormap="{@n_colormap}" objectID="{$bitmapID}">
|
333
|
+
<data>
|
334
|
+
<xsl:copy-of select="data"/>
|
335
|
+
</data>
|
336
|
+
</DefineBitsLossless2>
|
337
|
+
<DefineShape objectID="{$shapeID}">
|
338
|
+
<bounds>
|
339
|
+
<Rectangle left="0" right="{@width}" top="0" bottom="{@height}"/>
|
340
|
+
</bounds>
|
341
|
+
<styles>
|
342
|
+
<StyleList>
|
343
|
+
<fillStyles>
|
344
|
+
<ClippedBitmap objectID="{$bitmapID}">
|
345
|
+
<matrix>
|
346
|
+
<Transform transX="0" transY="0"/>
|
347
|
+
</matrix>
|
348
|
+
</ClippedBitmap>
|
349
|
+
</fillStyles>
|
350
|
+
<lineStyles/>
|
351
|
+
</StyleList>
|
352
|
+
</styles>
|
353
|
+
<shapes>
|
354
|
+
<Shape>
|
355
|
+
<edges>
|
356
|
+
<ShapeSetup x="{@width}" y="{@height}" fillStyle1="1"/>
|
357
|
+
<LineTo x="-{@width}" y="0"/>
|
358
|
+
<LineTo x="0" y="-{@height}"/>
|
359
|
+
<LineTo x="{@width}" y="0"/>
|
360
|
+
<LineTo x="0" y="{@height}"/>
|
361
|
+
<ShapeSetup/>
|
362
|
+
</edges>
|
363
|
+
</Shape>
|
364
|
+
</shapes>
|
365
|
+
</DefineShape>
|
366
|
+
<DefineSprite objectID="{$id}" frames="1">
|
367
|
+
<tags>
|
368
|
+
<PlaceObject2 replace="0" depth="1" objectID="{$shapeID}">
|
369
|
+
<transform>
|
370
|
+
<Transform transX="0" transY="0" scaleX="20" scaleY="20"/>
|
371
|
+
</transform>
|
372
|
+
</PlaceObject2>
|
373
|
+
<ShowFrame/>
|
374
|
+
<End/>
|
375
|
+
</tags>
|
376
|
+
</DefineSprite>
|
377
|
+
</xsl:template>
|
378
|
+
|
379
|
+
|
380
|
+
<!-- direct bitmap import (not placing them in a clip) -->
|
381
|
+
<xsl:template match="jpeg" mode="bitmap">
|
382
|
+
<xsl:param name="id"/>
|
383
|
+
<DefineBitsJPEG2 objectID="{$id}">
|
384
|
+
<data>
|
385
|
+
<xsl:copy-of select="data"/>
|
386
|
+
</data>
|
387
|
+
</DefineBitsJPEG2>
|
388
|
+
</xsl:template>
|
389
|
+
|
390
|
+
<xsl:template match="jpega" mode="bitmap">
|
391
|
+
<xsl:param name="id"/>
|
392
|
+
<DefineBitsJPEG3 objectID="{$id}" offset_to_alpha="{@offset_to_alpha}">
|
393
|
+
<data>
|
394
|
+
<xsl:copy-of select="data"/>
|
395
|
+
</data>
|
396
|
+
</DefineBitsJPEG3>
|
397
|
+
</xsl:template>
|
398
|
+
|
399
|
+
<xsl:template match="png" mode="bitmap">
|
400
|
+
<xsl:param name="id"/>
|
401
|
+
<DefineBitsLossless2 format="{@format}" width="{@width}" height="{@height}" n_colormap="{@n_colormap}" objectID="{$id}">
|
402
|
+
<data>
|
403
|
+
<xsl:copy-of select="data"/>
|
404
|
+
</data>
|
405
|
+
</DefineBitsLossless2>
|
406
|
+
</xsl:template>
|
407
|
+
|
408
|
+
|
409
|
+
<!-- SWF import -->
|
410
|
+
<xsl:template match="swf" mode="makeswf">
|
411
|
+
<xsl:param name="id"/>
|
412
|
+
<swft:push-map/>
|
413
|
+
|
414
|
+
<xsl:apply-templates select="Header/tags/*" mode="sprite-global"/>
|
415
|
+
|
416
|
+
<DefineSprite objectID="{$id}" frames="{count(Header/tags/ShowFrame)}">
|
417
|
+
<tags>
|
418
|
+
<xsl:apply-templates select="Header/tags/*" mode="sprite-local"/>
|
419
|
+
</tags>
|
420
|
+
</DefineSprite>
|
421
|
+
<swft:pop-map/>
|
422
|
+
</xsl:template>
|
423
|
+
|
424
|
+
<!-- binary import -->
|
425
|
+
<xsl:template match="binary" mode="makeswf">
|
426
|
+
<xsl:param name="id"/>
|
427
|
+
<DefineBinaryData objectID="{$id}">
|
428
|
+
<data>
|
429
|
+
<xsl:copy-of select="data"/>
|
430
|
+
</data>
|
431
|
+
</DefineBinaryData>
|
432
|
+
</xsl:template>
|
433
|
+
|
434
|
+
<!-- global id remapping -->
|
435
|
+
<xsl:template match="@objectID|@fontRef|@sprite" mode="idmap">
|
436
|
+
<xsl:attribute name="{name()}"><xsl:value-of select="swft:map-id(.)"/></xsl:attribute>
|
437
|
+
</xsl:template>
|
438
|
+
<xsl:template match="text()" mode="idmap" priority="-1">
|
439
|
+
<xsl:copy select="."/>
|
440
|
+
</xsl:template>
|
441
|
+
<xsl:template match="@*" mode="idmap" priority="-1">
|
442
|
+
<xsl:copy select="."/>
|
443
|
+
</xsl:template>
|
444
|
+
<xsl:template match="*" mode="idmap" priority="-1">
|
445
|
+
<xsl:copy select=".">
|
446
|
+
<xsl:apply-templates select="@*" mode="idmap"/>
|
447
|
+
<xsl:apply-templates mode="idmap"/>
|
448
|
+
</xsl:copy>
|
449
|
+
</xsl:template>
|
450
|
+
|
451
|
+
<!-- for tags that are "globalized" -->
|
452
|
+
<xsl:template match="SetBackgroundColor|FileAttributes" mode="sprite-global"/>
|
453
|
+
<xsl:template match="DoAction|End|FrameLabel|PlaceObject|PlaceObject2|RemoveObject|RemoveObject2|ShowFrame|SoundStreamBlock|SoundStreamHead|StartSound" mode="sprite-global"/>
|
454
|
+
<xsl:template match="*|@*|text()" mode="sprite-global" priority="-1">
|
455
|
+
<xsl:apply-templates select="." mode="idmap"/>
|
456
|
+
</xsl:template>
|
457
|
+
|
458
|
+
<!-- for tags that move into the DefineSprite -->
|
459
|
+
<xsl:template match="DoAction|End|FrameLabel|PlaceObject|PlaceObject2|RemoveObject|RemoveObject2|ShowFrame|SoundStreamBlock|SoundStreamHead|StartSound" mode="sprite-local">
|
460
|
+
<xsl:apply-templates select="." mode="idmap"/>
|
461
|
+
</xsl:template>
|
462
|
+
<xsl:template match="*|@*|text()" mode="sprite-local" priority="-1"/>
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
<!-- component import (experimental) -->
|
467
|
+
<xsl:template match="component">
|
468
|
+
|
469
|
+
<xsl:variable name="name" select="@id"/>
|
470
|
+
<xsl:variable name="component" select="swft:document(@file)"/>
|
471
|
+
|
472
|
+
<swft:push-map/>
|
473
|
+
<xsl:apply-templates select="$component/swf/Header/tags/*" mode="component"/>
|
474
|
+
<xsl:variable name="id" select="swft:map-id($component/swf/Header/tags/Export/symbols/Symbol[@name = $name]/@objectID)"/>
|
475
|
+
<swft:pop-map/>
|
476
|
+
|
477
|
+
<xsl:value-of select="swft:set-map($name,$id)"/>
|
478
|
+
<xsl:message>New ID of "<xsl:value-of select="$name"/>" component is: <xsl:value-of select="$id"/></xsl:message>
|
479
|
+
|
480
|
+
</xsl:template>
|
481
|
+
|
482
|
+
<xsl:template match="PlaceObject2|ShowFrame|End" mode="component"/>
|
483
|
+
<xsl:template match="*" mode="component" priority="-1">
|
484
|
+
<xsl:apply-templates select="." mode="idmap"/>
|
485
|
+
</xsl:template>
|
486
|
+
|
487
|
+
|
488
|
+
<!-- shared library import -->
|
489
|
+
<xsl:template match="import">
|
490
|
+
<xsl:choose>
|
491
|
+
<xsl:when test="number(/movie/@version) >= 8">
|
492
|
+
<ImportAssets2 url="{@url}" reserved1="1" reserved2="0">
|
493
|
+
<symbols>
|
494
|
+
<xsl:if test="@symbol">
|
495
|
+
<Symbol objectID="{swft:map-id(@symbol)}" name="{@symbol}"/>
|
496
|
+
</xsl:if>
|
497
|
+
<xsl:if test="@file">
|
498
|
+
<xsl:apply-templates select="swft:document(@file)/swf/Header/tags/Export/symbols/*" mode="import"/>
|
499
|
+
</xsl:if>
|
500
|
+
</symbols>
|
501
|
+
</ImportAssets2>
|
502
|
+
</xsl:when>
|
503
|
+
<xsl:otherwise>
|
504
|
+
<Import url="{@url}">
|
505
|
+
<symbols>
|
506
|
+
<xsl:if test="@symbol">
|
507
|
+
<Symbol objectID="{swft:map-id(@symbol)}" name="{@symbol}"/>
|
508
|
+
</xsl:if>
|
509
|
+
<xsl:if test="@file">
|
510
|
+
<xsl:apply-templates select="swft:document(@file)/swf/Header/tags/Export/symbols/*" mode="import"/>
|
511
|
+
</xsl:if>
|
512
|
+
</symbols>
|
513
|
+
</Import>
|
514
|
+
</xsl:otherwise>
|
515
|
+
</xsl:choose>
|
516
|
+
</xsl:template>
|
517
|
+
|
518
|
+
<xsl:template match="Symbol" mode="import">
|
519
|
+
<Symbol objectID="{swft:map-id(@name)}" name="{@name}"/>
|
520
|
+
</xsl:template>
|
521
|
+
|
522
|
+
|
523
|
+
|
524
|
+
<!-- TTF import -->
|
525
|
+
<xsl:template match="ttf" mode="makeswf">
|
526
|
+
<xsl:param name="id"/>
|
527
|
+
<xsl:choose>
|
528
|
+
<xsl:when test="$movie-version >= 8">
|
529
|
+
<DefineFont3 objectID="{$id}">
|
530
|
+
<xsl:copy-of select="DefineFont3/*|DefineFont3/@*[name() != 'objectID']"/>
|
531
|
+
</DefineFont3>
|
532
|
+
</xsl:when>
|
533
|
+
<xsl:otherwise>
|
534
|
+
<DefineFont2 objectID="{$id}">
|
535
|
+
<xsl:copy-of select="DefineFont2/*|DefineFont2/@*[name() != 'objectID']"/>
|
536
|
+
</DefineFont2>
|
537
|
+
</xsl:otherwise>
|
538
|
+
</xsl:choose>
|
539
|
+
</xsl:template>
|
540
|
+
|
541
|
+
<!-- MP3 import -->
|
542
|
+
<xsl:template match="mp3" mode="makeswf">
|
543
|
+
<xsl:param name="id"/>
|
544
|
+
<DefineSound objectID="{$id}" format="{@format}" rate="{@rate}" is16bit="{@is16bit}" stereo="{@stereo}" samples="{@samples}">
|
545
|
+
<data>
|
546
|
+
<xsl:copy-of select="data"/>
|
547
|
+
</data>
|
548
|
+
</DefineSound>
|
549
|
+
</xsl:template>
|
550
|
+
|
551
|
+
<!-- wav import -->
|
552
|
+
<xsl:template match="wav" mode="makeswf">
|
553
|
+
<xsl:param name="id"/>
|
554
|
+
<DefineSound objectID="{$id}" format="{@format}" rate="{@rate}" is16bit="{@is16bit}" stereo="{@stereo}" samples="{@samples}">
|
555
|
+
<data>
|
556
|
+
<xsl:copy-of select="data"/>
|
557
|
+
</data>
|
558
|
+
</DefineSound>
|
559
|
+
</xsl:template>
|
560
|
+
|
561
|
+
<xsl:template match="include[@file]">
|
562
|
+
<xsl:apply-templates select="document(@file)/movie/*"/>
|
563
|
+
</xsl:template>
|
564
|
+
|
565
|
+
</xsl:stylesheet>
|