Source code: com/anotherbigidea/flash/interfaces/SWFTagTypes.java
1 /****************************************************************
2 * Copyright (c) 2001, David N. Main, All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or
5 * without modification, are permitted provided that the
6 * following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following
10 * disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials
15 * provided with the distribution.
16 *
17 * 3. The name of the author may not be used to endorse or
18 * promote products derived from this software without specific
19 * prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
22 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 ****************************************************************/
34 package com.anotherbigidea.flash.interfaces;
35
36 import java.io.*;
37 import java.util.*;
38 import com.anotherbigidea.flash.structs.*;
39
40 /**
41 * Interface for passing SWF tag types.
42 */
43 public interface SWFTagTypes extends SWFSpriteTagTypes
44 {
45
46 /**
47 * @param format one of the SWFConstants.SOUND_FORMAT_* constants
48 * @param frequency one of the SWFConstants.SOUND_FREQ_* constants
49 * @param soundData format-dependent sound data
50 */
51 public void tagDefineSound( int id, int format, int frequency,
52 boolean bits16, boolean stereo,
53 int sampleCount, byte[] soundData ) throws IOException;
54
55 /**
56 * Define the sound for a button
57 */
58 public void tagDefineButtonSound( int buttonId,
59 int rollOverSoundId, SoundInfo rollOverSoundInfo,
60 int rollOutSoundId, SoundInfo rollOutSoundInfo,
61 int pressSoundId, SoundInfo pressSoundInfo,
62 int releaseSoundId, SoundInfo releaseSoundInfo )
63 throws IOException;
64
65 /**
66 * @return SWFShape to receive shape info - or null to skip the data
67 */
68 public SWFShape tagDefineShape( int id, Rect outline ) throws IOException;
69
70 /**
71 * @return SWFShape to receive shape info - or null to skip the data
72 */
73 public SWFShape tagDefineShape2( int id, Rect outline ) throws IOException;
74
75 /**
76 * @return SWFShape to receive shape info - or null to skip the data
77 */
78 public SWFShape tagDefineShape3( int id, Rect outline ) throws IOException;
79
80 /**
81 * @param buttonRecords contains ButtonRecord objects
82 * @return SWFActions object (may be null) to receive button actions - there is
83 * only one action array (with no conditions).
84 * @see com.anotherbigidea.flash.structs.ButtonRecord
85 */
86 public SWFActions tagDefineButton( int id, Vector buttonRecords )
87 throws IOException;
88
89 public void tagButtonCXForm( int buttonId, ColorTransform transform ) throws IOException;
90
91 /**
92 * @param buttonRecord2s contains ButtonRecord2 objects
93 * @return SWFActions object (may be null) to receive button actions - there may
94 * be multiple action arrays - each one is conditional, using the
95 * BUTTON2_* condition flags defined in SWFConstants.java
96 * @see com.anotherbigidea.flash.structs.ButtonRecord2
97 */
98 public SWFActions tagDefineButton2( int id,
99 boolean trackAsMenu,
100 Vector buttonRecord2s )
101 throws IOException;
102
103 public void tagSetBackgroundColor( Color color ) throws IOException;
104
105 /**
106 * The SWFVectors object returned will be called numGlyphs times to
107 * pass the vector information for each glyph (each glyph is terminated
108 * by calling SWFVectors.done() )
109 */
110 public SWFVectors tagDefineFont( int id, int numGlyphs ) throws IOException;
111
112 /**
113 * @return SWFText object to receive the text style and glyph information -
114 * this may be null if the info is not required
115 */
116 public SWFText tagDefineText( int id, Rect bounds, Matrix matrix ) throws IOException;
117
118 /**
119 * Allows alpha colors
120 * @return SWFText object to receive the text style and glyph information -
121 * this may be null if the info is not required
122 */
123 public SWFText tagDefineText2( int id, Rect bounds, Matrix matrix ) throws IOException;
124
125 /**
126 * @param flags see FONT_* constants in SWFConstants.java
127 */
128 public void tagDefineFontInfo( int fontId, String fontName,
129 int flags, int[] codes ) throws IOException;
130
131 /**
132 * @param flags see FONT_* constants in SWFConstants.java
133 * @param languageCode @see com.anotherbigidea.flash.SWFConstants#LANGUAGE_CODE_NONE etc.
134 */
135 public void tagDefineFontInfo2( int fontId, String fontName,
136 int flags, int[] codes, int languageCode ) throws IOException;
137
138
139 /**
140 * @param data must contain the header data - use the InputStream version
141 * when using an external JPEG
142 */
143 public void tagDefineBitsJPEG2( int id, byte[] data ) throws IOException;
144
145 /**
146 * @param jpegImage must be a baseline JPEG (not a progressive JPEG)
147 */
148 public void tagDefineBitsJPEG2( int id, InputStream jpegImage ) throws IOException;
149
150 /**
151 * JPEG image data only - header/encoding data is in tagJPEGTables tag
152 */
153 public void tagDefineBits( int id, byte[] imageData ) throws IOException;
154
155 /**
156 * Only one tag per SWF - holds common JPEG encoding data
157 */
158 public void tagJPEGTables( byte[] jpegEncodingData ) throws IOException;
159
160 /**
161 * JPEG image and encoding data with alpha channel bitmap
162 * @param alphaData is zlib compressed
163 */
164 public void tagDefineBitsJPEG3( int id, byte[] imageData, byte[] alphaData ) throws IOException;
165
166 /**
167 * @param format one of the SWFConstants.BITMAP_FORMAT_n_BIT constants
168 */
169 public void tagDefineBitsLossless( int id, int format, int width, int height,
170 Color[] colors, byte[] imageData )
171 throws IOException;
172
173 /**
174 * @param format one of the SWFConstants.BITMAP_FORMAT_n_BIT constants
175 */
176 public void tagDefineBitsLossless2( int id, int format, int width, int height,
177 Color[] colors, byte[] imageData )
178 throws IOException;
179
180 /**
181 * @param password may be null
182 */
183 public void tagProtect( byte[] password ) throws IOException;
184
185 /**
186 * @param flags see TEXTFIELD_* constants in SWFConstants.java
187 */
188 public void tagDefineTextField( int fieldId, String fieldName,
189 String initialText, Rect boundary, int flags,
190 AlphaColor textColor, int alignment, int fontId, int fontSize,
191 int charLimit, int leftMargin, int rightMargin, int indentation,
192 int lineSpacing )
193 throws IOException;
194
195 public void tagDefineQuickTimeMovie( int id, String filename ) throws IOException;
196
197 public SWFTagTypes tagDefineSprite( int id ) throws IOException;
198
199 public SWFShape tagDefineMorphShape( int id, Rect startBounds, Rect endBounds )
200 throws IOException;
201
202 public SWFVectors tagDefineFont2( int id, int flags, String name, int numGlyphs,
203 int ascent, int descent, int leading,
204 int[] codes, int[] advances, Rect[] bounds,
205 int[] kernCodes1, int[] kernCodes2,
206 int[] kernAdjustments ) throws IOException;
207
208 public void tagExport( String[] names, int[] ids ) throws IOException;
209
210 public void tagImport( String movieName, String[] names, int[] ids ) throws IOException;
211
212 public void tagEnableDebug( byte[] password ) throws IOException;
213
214 public void tagEnableDebug2( byte[] password ) throws IOException;
215
216 /**
217 * In files produced by Generator...
218 */
219 public void tagSerialNumber( String serialNumber ) throws IOException;
220
221 /**
222 * In Generator templates. Data is not parsed.
223 */
224 public void tagGenerator( byte[] data ) throws IOException;
225
226 /**
227 * In Generator templates. Data is not parsed.
228 */
229 public void tagGeneratorText( byte[] data ) throws IOException;
230
231 /**
232 * In Generator templates. Data is not parsed.
233 */
234 public void tagGeneratorCommand( byte[] data ) throws IOException;
235
236 /**
237 * In Generator templates. Data is not parsed.
238 */
239 public void tagNameCharacter( byte[] data ) throws IOException;
240
241 /**
242 * In Generator templates. Data is not parsed.
243 */
244 public void tagGeneratorFont( byte[] data ) throws IOException;
245 }