but in generating shapes with fillstyles that refer to bitmaps
Eric Bloch <[email protected]> Fri, 6 Jun 2003 10:14:13 -0700 (PDT)
| Newsgroups | gmane.comp.java.jgenerator.devel |
|---|---|
| Message-ID | <[email protected]> |
It looks like the generator's collectDeps() mechanism leaves out
bitmaps refered to by Shape fill styles. Here's a simple test case.
Here's the swfdump of a swf file I have. I believe the that id 0003
refers to id 0002 in a fill style.
[HEADER] File version: 3
[HEADER] File size: 1389
[HEADER] Frame rate: 12.000000
[HEADER] Frame count: 1
[HEADER] Movie width: 111.000
[HEADER] Movie height: 40.000
[009] 3 SETBACKGROUNDCOLOR
-=> ff ff ff
[020] 40 DEFINESHAPE3 defines id 0001
-=> 01 00 68 00 11 58 00 01 90 00 01 41 02 00 d9 40 00
-=> 05 00 00 02 00 00 10 12 0a c0 03 20 e5 9c 1d 88
-=> ac e5 64 1d 97 54 00
[024] 1253 DEFINEBITSLOSSLESS2 defines id 0002
-=> 02 00 05 6f 00 28 00 78 da ed 9b 69 6b 55 57 14 86
-=> 73 e6 e9 0e 31 37 9a 18 4d 8c 9a 58 8d b3 d5 52
....<snipped>
-=> 71 75 7e 0b
[020] 33 DEFINESHAPE3 defines id 0003
-=> 03 00 60 00 31 c0 00 05 c0 01 00 22 97 30 ff 00 10
-=> 12 0b 18 e0 2e 3a 27 23 76 91 d0 c7 1b ab 80 00
[01a] 11 PLACEOBJECT2 places id 0001 at depth 0001 CXForm: a
c0 0 100
0 100 0 100 0
[01a] 9 PLACEOBJECT2 places id 0003 at depth 0002
[001] 0 SHOWFRAME 0
[000] 0 END
That file I called simple_ai.swf. Then I run the following code
import com.iv.flash.api.* ;
import java.io.*;
public class testit {
public static void main(String args[]) {
try {
FlashFile in = FlashFile.parse("simple_ai.swf");
Script script = in.getMainScript();
FlashFile file = FlashFile.newFlashFile();
// Script script = new Script(1);
script.setMain();
file.setMainScript(script);
Frame frame = script.newFrame();
InputStream s = file.generate().getInputStream();
OutputStream o = new FileOutputStream("out.swf");
send(s, o, 1024);
} catch (Exception e) {
e.printStackTrace();
}
}
public static int send(InputStream input, OutputStream output, int
size)
throws IOException {
int c = 0;
byte[] buffer = new byte[size];
int b = 0;
while((b = input.read(buffer)) > 0) {
c += b;
output.write(buffer, 0, b);
}
return c;
}
}
to generate out.swf. Here's a swfdump of out.swf
[HEADER] File version: 4
[HEADER] File size: 133
[HEADER] Frame rate: 12.000000
[HEADER] Frame count: 2
[HEADER] Movie width: 540.000
[HEADER] Movie height: 400.000
[009] 3 SETBACKGROUNDCOLOR
-=> ff ff ff
[020] 40 DEFINESHAPE3 defines id 0001
-=> 01 00 68 00 11 58 00 01 90 00 01 41 ff ff d9 40 00
-=> 05 00 00 02 00 00 10 12 0a c0 03 20 e5 9c 1d 88
-=> ac e5 64 1d 97 54 00
[01a] 11 PLACEOBJECT2 places id 0001 at depth 0001 CXForm: a
c0 0 100
0 100 0 100 0
[020] 33 DEFINESHAPE3 defines id 0002
-=> 02 00 60 00 31 c0 00 05 c0 01 00 22 97 30 ff 00 10
-=> 12 0b 18 e0 2e 3a 27 23 76 91 d0 c7 1b ab 80 00
[01a] 9 PLACEOBJECT2 places id 0002 at depth 0002
[001] 0 SHOWFRAME 0-1
[000] 0 END
Note that the bitmap is missing from the output file.
=====
Eric Bloch
1437 10th Avenue, San Francisco, CA, USA 94122
Email: [email protected]
Web page: http://www.10th-avenue.com
Phone: 415-731-0589
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.