mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-26 02:26:18 +00:00
Fixed some tags,
Flash part viewer stub
This commit is contained in:
@@ -387,10 +387,12 @@ public class SWFInputStream extends InputStream {
|
||||
* @return Fixed-point value
|
||||
* @throws IOException
|
||||
*/
|
||||
public double readFB(int nBits) throws IOException {
|
||||
|
||||
double val = readSB(nBits);
|
||||
double ret = val / (1 << 16);
|
||||
public float readFB(int nBits) throws IOException {
|
||||
if(nBits==0){
|
||||
return 0;
|
||||
}
|
||||
float val = readSB(nBits);
|
||||
float ret = val / 0x10000;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -493,6 +495,9 @@ public class SWFInputStream extends InputStream {
|
||||
byte data[] = readBytes((int) tagLength);
|
||||
Tag ret;
|
||||
switch (tagID) {
|
||||
case 0:
|
||||
ret =new EndTag(data, version, pos);
|
||||
break;
|
||||
case 1:
|
||||
ret = new ShowFrameTag(pos);
|
||||
break;
|
||||
@@ -516,7 +521,7 @@ public class SWFInputStream extends InputStream {
|
||||
ret = new JPEGTablesTag(data, pos);
|
||||
break;
|
||||
case 9:
|
||||
ret = new SetBackgroundColorTag(data, pos);
|
||||
ret = new SetBackgroundColorTag(data, version,pos);
|
||||
break;
|
||||
case 10:
|
||||
ret = new DefineFontTag(data, version, pos);
|
||||
@@ -556,7 +561,7 @@ public class SWFInputStream extends InputStream {
|
||||
ret = new DefineShape2Tag(data, version, pos);
|
||||
break;
|
||||
case 23:
|
||||
ret = new DefineButtonCxform(data, version, pos);
|
||||
ret = new DefineButtonCxformTag(data, version, pos);
|
||||
break;
|
||||
case 24:
|
||||
ret = new ProtectTag(data, version, pos);
|
||||
@@ -988,20 +993,16 @@ public class SWFInputStream extends InputStream {
|
||||
ret.hasScale = readUB(1) == 1;
|
||||
if (ret.hasScale) {
|
||||
int NScaleBits = (int) readUB(5);
|
||||
ret.scaleNBits = NScaleBits;
|
||||
|
||||
ret.scaleX = readFB(NScaleBits);
|
||||
ret.scaleY = readFB(NScaleBits);
|
||||
ret.scaleX = (int)readSB(NScaleBits);
|
||||
ret.scaleY = (int)readSB(NScaleBits);
|
||||
}
|
||||
ret.hasRotate = readUB(1) == 1;
|
||||
if (ret.hasRotate) {
|
||||
int NRotateBits = (int) readUB(5);
|
||||
ret.rotateNBits = NRotateBits;
|
||||
ret.rotateSkew0 = readFB(NRotateBits);
|
||||
ret.rotateSkew1 = readFB(NRotateBits);
|
||||
ret.rotateSkew0 = (int)readSB(NRotateBits);
|
||||
ret.rotateSkew1 = (int)readSB(NRotateBits);
|
||||
}
|
||||
int NTranslateBits = (int) readUB(5);
|
||||
ret.translateNBits = NTranslateBits;
|
||||
ret.translateX = (int) readSB(NTranslateBits);
|
||||
ret.translateY = (int) readSB(NTranslateBits);
|
||||
alignByte();
|
||||
|
||||
@@ -305,6 +305,11 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeSB(int nBits, long value) throws IOException {
|
||||
long tmp = value & 0x7FFFFFFF;
|
||||
|
||||
if (value < 0) {
|
||||
tmp = tmp | (1L << (nBits - 1));
|
||||
}
|
||||
writeUB(nBits, value);
|
||||
}
|
||||
|
||||
@@ -316,23 +321,13 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeFB(int nBits, double value) throws IOException {
|
||||
if(nBits==0){
|
||||
return;
|
||||
}
|
||||
long longVal = (long) (value * (1 << 16));
|
||||
writeSB(nBits, longVal);
|
||||
}
|
||||
|
||||
private static int bitCount(int value) {
|
||||
value = Math.abs(value);
|
||||
int nBits = 0;
|
||||
while ((value & ~0xF) != 0) {
|
||||
value >>= 4;
|
||||
nBits += 4;
|
||||
}
|
||||
while (value != 0) {
|
||||
value >>= 1;
|
||||
nBits++;
|
||||
}
|
||||
return nBits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes RECT value to the stream
|
||||
@@ -379,9 +374,9 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeTag(Tag tag) throws IOException {
|
||||
byte data[] = tag.getData(version);
|
||||
byte data[] = tag.getData(version);
|
||||
int tagLength = data.length;
|
||||
int tagID = tag.getId();
|
||||
int tagID = tag.getId();
|
||||
int tagIDLength = (tagID << 6);
|
||||
if ((tagLength < 0x3f) && (!tag.forceWriteAsLong)) {
|
||||
tagIDLength += tagLength;
|
||||
@@ -393,27 +388,24 @@ public class SWFOutputStream extends OutputStream {
|
||||
}
|
||||
write(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get needed bits
|
||||
*
|
||||
* @param number
|
||||
* @param bits 1 for signed,0 if unsigned
|
||||
* @return
|
||||
*/
|
||||
public static int getNeededBits(int number, int bits) {
|
||||
return bitCount(number) + bits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates number of bits needed for representing unsigned value
|
||||
*
|
||||
* @param v Unsigned value
|
||||
* @return Number of bits
|
||||
*/
|
||||
public static int getNeededBitsU(int v) {
|
||||
public static int getNeededBitsU(int value) {
|
||||
value = Math.abs(value);
|
||||
long x = 1;
|
||||
int nBits;
|
||||
|
||||
return getNeededBits(v, 0);
|
||||
for (nBits = 1; nBits <= 64; nBits++) {
|
||||
x <<= 1;
|
||||
if (x > value) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return nBits;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -423,7 +415,14 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @return Number of bits
|
||||
*/
|
||||
public static int getNeededBitsS(int v) {
|
||||
return getNeededBits(v, 1);
|
||||
int counter = 32;
|
||||
int mask = 0x80000000;
|
||||
final int val = (v < 0) ? -v : v;
|
||||
while (((val & mask) == 0) && (counter > 0)) {
|
||||
mask >>>= 1;
|
||||
counter -= 1;
|
||||
}
|
||||
return counter + 1;
|
||||
}
|
||||
|
||||
private static long getIntPart(double value) {
|
||||
@@ -440,18 +439,34 @@ public class SWFOutputStream extends OutputStream {
|
||||
return value + getIntPart(value);
|
||||
}
|
||||
|
||||
|
||||
public static int unsignedSize(final int value) {
|
||||
|
||||
final int val = (value < 0) ? -value - 1 : value;
|
||||
int counter = 32;
|
||||
int mask = 0x80000000;
|
||||
|
||||
while (((val & mask) == 0) && (counter > 0)) {
|
||||
mask >>>= 1;
|
||||
counter -= 1;
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Calculates number of bits needed for representing fixed-point value
|
||||
*
|
||||
* @param value Fixed-point value
|
||||
* @return Number of bits
|
||||
*/
|
||||
public static int getNeededBitsF(double value) {
|
||||
if (value == -1) {
|
||||
return 18;
|
||||
}
|
||||
int val = (int) (value * (1 << 16));
|
||||
return getNeededBitsS(val);
|
||||
public static int getNeededBitsF(float value) {
|
||||
//0.26213074 16bits
|
||||
//0.5 17bits
|
||||
//1.3476715 18bits
|
||||
int k=(int)value;
|
||||
return getNeededBitsS(k)+16;
|
||||
}
|
||||
|
||||
private int enlargeBitCountU(int currentBitCount, int value) {
|
||||
@@ -470,7 +485,7 @@ public class SWFOutputStream extends OutputStream {
|
||||
return currentBitCount;
|
||||
}
|
||||
|
||||
private int enlargeBitCountF(int currentBitCount, double value) {
|
||||
private int enlargeBitCountF(int currentBitCount, float value) {
|
||||
int neededNew = getNeededBitsF(value);
|
||||
if (neededNew > currentBitCount) {
|
||||
return neededNew;
|
||||
@@ -487,28 +502,26 @@ public class SWFOutputStream extends OutputStream {
|
||||
public void writeMatrix(MATRIX value) throws IOException {
|
||||
writeUB(1, value.hasScale ? 1 : 0);
|
||||
if (value.hasScale) {
|
||||
int nBits;
|
||||
//nBits = enlargeBitCountF(nBits, value.scaleX);
|
||||
//nBits = enlargeBitCountF(nBits, value.scaleY);
|
||||
nBits = value.scaleNBits; //FFFUUU
|
||||
int nBits=0;
|
||||
nBits = enlargeBitCountS(nBits, value.scaleX);
|
||||
nBits = enlargeBitCountS(nBits, value.scaleY);
|
||||
writeUB(5, nBits);
|
||||
writeFB(nBits, value.scaleX);
|
||||
writeFB(nBits, value.scaleY);
|
||||
writeSB(nBits, value.scaleX);
|
||||
writeSB(nBits, value.scaleY);
|
||||
}
|
||||
writeUB(1, value.hasRotate ? 1 : 0);
|
||||
if (value.hasRotate) {
|
||||
int nBits;// = 0;
|
||||
//nBits = enlargeBitCountF(nBits, value.rotateSkew0);
|
||||
//nBits = enlargeBitCountF(nBits, value.rotateSkew1);
|
||||
nBits = value.rotateNBits; //FFFUUU
|
||||
int nBits = 0;
|
||||
nBits = enlargeBitCountS(nBits, value.rotateSkew0);
|
||||
nBits = enlargeBitCountS(nBits, value.rotateSkew1);
|
||||
writeUB(5, nBits);
|
||||
writeFB(nBits, value.rotateSkew0);
|
||||
writeFB(nBits, value.rotateSkew1);
|
||||
writeSB(nBits, value.rotateSkew0);
|
||||
writeSB(nBits, value.rotateSkew1);
|
||||
}
|
||||
int NTranslateBits;
|
||||
//NTranslateBits = enlargeBitCountS(NTranslateBits, value.translateX);
|
||||
///NTranslateBits = enlargeBitCountS(NTranslateBits, value.translateY);
|
||||
NTranslateBits = value.translateNBits; //FFFUUU
|
||||
int NTranslateBits=0;
|
||||
NTranslateBits = enlargeBitCountS(NTranslateBits, value.translateX);
|
||||
NTranslateBits = enlargeBitCountS(NTranslateBits, value.translateY);
|
||||
|
||||
writeUB(5, NTranslateBits);
|
||||
|
||||
|
||||
|
||||
134
trunk/src/com/jpexs/asdec/gui/FlashPanel.java
Normal file
134
trunk/src/com/jpexs/asdec/gui/FlashPanel.java
Normal file
@@ -0,0 +1,134 @@
|
||||
package com.jpexs.asdec.gui;
|
||||
|
||||
import java.awt.Canvas;
|
||||
import java.awt.Dimension;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.awt.SWT_AWT;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.ole.win32.OleAutomation;
|
||||
import org.eclipse.swt.ole.win32.OleClientSite;
|
||||
import org.eclipse.swt.ole.win32.OleFrame;
|
||||
import org.eclipse.swt.ole.win32.Variant;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
public class FlashPanel extends Canvas {
|
||||
|
||||
private Thread swtThread;
|
||||
private OleFrame oleFrame;
|
||||
private OleClientSite clientSite;
|
||||
private Shell shell;
|
||||
private int width;
|
||||
private int height;
|
||||
|
||||
public FlashPanel(int width, int height) {
|
||||
setPreferredSize(new Dimension(width, height));
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
private void disposeClient() {
|
||||
if (clientSite != null) {
|
||||
clientSite.dispose();
|
||||
}
|
||||
clientSite = null;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
||||
oleFrame.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
shell.dispose();
|
||||
}
|
||||
});
|
||||
disconnect();
|
||||
}
|
||||
|
||||
private void startDisplay() {
|
||||
if (this.swtThread == null) {
|
||||
final Canvas canvas = this;
|
||||
this.swtThread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Display display = new Display();
|
||||
shell = SWT_AWT.new_Shell(display, canvas);
|
||||
shell.setLayout(new FillLayout());
|
||||
|
||||
synchronized (this) {
|
||||
oleFrame = new OleFrame(shell, SWT.NONE);
|
||||
clientSite = new OleClientSite(oleFrame, SWT.NONE, "Shell.Explorer");
|
||||
|
||||
this.notifyAll();
|
||||
}
|
||||
|
||||
shell.open();
|
||||
while (!isInterrupted() && !shell.isDisposed()) {
|
||||
if (!display.readAndDispatch()) {
|
||||
display.sleep();
|
||||
}
|
||||
}
|
||||
shell.dispose();
|
||||
display.dispose();
|
||||
} catch (Exception e) {
|
||||
interrupt();
|
||||
}
|
||||
}
|
||||
};
|
||||
this.swtThread.start();
|
||||
}
|
||||
|
||||
synchronized (this.swtThread) {
|
||||
while (this.oleFrame == null) {
|
||||
try {
|
||||
this.swtThread.wait(100);
|
||||
} catch (InterruptedException e) {
|
||||
this.oleFrame = null;
|
||||
this.swtThread = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
setSize(getWidth() - 1, getHeight() - 1);
|
||||
setSize(getWidth() + 1, getHeight() + 1);
|
||||
}
|
||||
|
||||
|
||||
public void displaySWF(String swf) {
|
||||
startDisplay();
|
||||
final String loadSWF = swf;
|
||||
oleFrame.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
OleAutomation explorer = new OleAutomation(clientSite);
|
||||
int[] navigate = explorer.getIDsOfNames(new String[]{"Navigate"});
|
||||
if (navigate != null) {
|
||||
Variant result = explorer.invoke(navigate[0], new Variant[]{new Variant(loadSWF)});
|
||||
if (result == null) {
|
||||
disposeClient();
|
||||
} else {
|
||||
result.dispose();
|
||||
}
|
||||
} else {
|
||||
disposeClient();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the swt background thread.
|
||||
*/
|
||||
private void disconnect() {
|
||||
if (swtThread != null) {
|
||||
oleFrame = null;
|
||||
swtThread.interrupt();
|
||||
swtThread = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
239
trunk/src/com/jpexs/asdec/gui/TagBrowserFrame.java
Normal file
239
trunk/src/com/jpexs/asdec/gui/TagBrowserFrame.java
Normal file
@@ -0,0 +1,239 @@
|
||||
package com.jpexs.asdec.gui;
|
||||
|
||||
import com.jpexs.asdec.Main;
|
||||
import com.jpexs.asdec.SWF;
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.tags.DefineFont2Tag;
|
||||
import com.jpexs.asdec.tags.DefineFont3Tag;
|
||||
import com.jpexs.asdec.tags.DefineFontTag;
|
||||
import com.jpexs.asdec.tags.DefineMorphShape2Tag;
|
||||
import com.jpexs.asdec.tags.DefineMorphShapeTag;
|
||||
import com.jpexs.asdec.tags.DefineShapeTag;
|
||||
import com.jpexs.asdec.tags.DefineSpriteTag;
|
||||
import com.jpexs.asdec.tags.DefineTextTag;
|
||||
import com.jpexs.asdec.tags.DoActionTag;
|
||||
import com.jpexs.asdec.tags.EndTag;
|
||||
import com.jpexs.asdec.tags.PlaceObject2Tag;
|
||||
import com.jpexs.asdec.tags.PlaceObject3Tag;
|
||||
import com.jpexs.asdec.tags.PlaceObjectTag;
|
||||
import com.jpexs.asdec.tags.RemoveObject2Tag;
|
||||
import com.jpexs.asdec.tags.RemoveObjectTag;
|
||||
import com.jpexs.asdec.tags.SetBackgroundColorTag;
|
||||
import com.jpexs.asdec.tags.ShowFrameTag;
|
||||
import com.jpexs.asdec.tags.Tag;
|
||||
import com.jpexs.asdec.tags.base.BoundedTag;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.tags.base.Container;
|
||||
import com.jpexs.asdec.tags.base.FontTag;
|
||||
import com.jpexs.asdec.types.GLYPHENTRY;
|
||||
import com.jpexs.asdec.types.MATRIX;
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
import com.jpexs.asdec.types.RGB;
|
||||
import com.jpexs.asdec.types.TEXTRECORD;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSplitPane;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.event.TreeSelectionEvent;
|
||||
import javax.swing.event.TreeSelectionListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jindra
|
||||
*/
|
||||
public class TagBrowserFrame extends JFrame implements TreeSelectionListener {
|
||||
|
||||
JTree tagTree;
|
||||
FlashPanel fPanel;
|
||||
private SWF swf;
|
||||
|
||||
public TagBrowserFrame(SWF swf) {
|
||||
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||
setSize(800, 600);
|
||||
List<Object> objs = new ArrayList<Object>();
|
||||
objs.addAll(swf.tags);
|
||||
this.swf=swf;
|
||||
tagTree = new JTree(new TagTreeModel(swf.tags));
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
fPanel = new FlashPanel(400, 400);
|
||||
getContentPane().add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(tagTree), new JScrollPane(fPanel)), BorderLayout.CENTER);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
fPanel.dispose();
|
||||
}
|
||||
});
|
||||
tagTree.addTreeSelectionListener(this);
|
||||
}
|
||||
|
||||
private File tempFile;
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
if(args.length<1){
|
||||
return;
|
||||
}
|
||||
View.setWinLookAndFeel();
|
||||
SWF swf = new SWF(new FileInputStream(args[0]));
|
||||
TagBrowserFrame tbf = new TagBrowserFrame(swf);
|
||||
tbf.setVisible(true);
|
||||
tbf.fPanel.displaySWF(args[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void valueChanged(TreeSelectionEvent e) {
|
||||
Object obj = tagTree.getLastSelectedPathComponent();
|
||||
if (obj instanceof TagNode) {
|
||||
Object tagObj = ((TagNode) obj).tag;
|
||||
if (((tagObj instanceof CharacterTag)||(tagObj instanceof FontTag)) && (tagObj instanceof Tag)) {
|
||||
try {
|
||||
|
||||
if(tempFile!=null){
|
||||
tempFile.delete();
|
||||
}
|
||||
tempFile=new File("D:\\temp.swf");//File.createTempFile("temp", ".swf");
|
||||
tempFile.deleteOnExit();
|
||||
|
||||
FileOutputStream fos = new FileOutputStream(tempFile);
|
||||
SWFOutputStream sos = new SWFOutputStream(fos, 10);
|
||||
sos.write("FWS".getBytes());
|
||||
sos.write(13);
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
SWFOutputStream sos2 = new SWFOutputStream(baos, 10);
|
||||
int width = 8000;
|
||||
int height = 6000;
|
||||
RECT rct = new RECT();
|
||||
rct.Ymax = height;
|
||||
rct.Xmax = width;
|
||||
sos2.writeRECT(rct);
|
||||
sos2.writeUI8(0);
|
||||
sos2.writeUI8(30);
|
||||
sos2.writeUI16(1); //framecnt
|
||||
sos2.writeTag(new SetBackgroundColorTag(new RGB(255, 0, 255)));
|
||||
for(Tag tag:swf.tags){
|
||||
if((!(tag instanceof PlaceObjectTag))
|
||||
&&(!(tag instanceof PlaceObject2Tag))
|
||||
&&(!(tag instanceof PlaceObject3Tag))
|
||||
&&(!(tag instanceof RemoveObjectTag))
|
||||
&&(!(tag instanceof RemoveObject2Tag))
|
||||
&&(!(tag instanceof DoActionTag))
|
||||
&&(!(tag instanceof ShowFrameTag))
|
||||
){
|
||||
sos2.writeTag(tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int chtId=0;
|
||||
if(tagObj instanceof CharacterTag){
|
||||
chtId=((CharacterTag) tagObj).getCharacterID();
|
||||
}
|
||||
|
||||
//sos2.writeTag((Tag) tagObj);
|
||||
MATRIX mat = new MATRIX();
|
||||
mat.hasRotate = false;
|
||||
mat.hasScale = false;
|
||||
mat.translateX = 0;
|
||||
mat.translateY = 0;
|
||||
if (tagObj instanceof BoundedTag) {
|
||||
RECT r = ((BoundedTag) tagObj).getRect();
|
||||
mat.translateX = -r.Xmin;
|
||||
mat.translateY = -r.Ymin;
|
||||
mat.translateX = mat.translateX + width / 2 - r.getWidth() / 2;
|
||||
mat.translateY = mat.translateY + height / 2 - r.getHeight() / 2;
|
||||
}else{
|
||||
mat.translateX=width/2;
|
||||
mat.translateY=height/2;
|
||||
}
|
||||
if(tagObj instanceof FontTag){
|
||||
|
||||
int countGlyphs=0;
|
||||
int fontId=0;
|
||||
if(tagObj instanceof DefineFontTag){
|
||||
countGlyphs=((DefineFontTag)tagObj).glyphShapeTable.length;
|
||||
fontId=((DefineFontTag)tagObj).fontId;
|
||||
}
|
||||
if(tagObj instanceof DefineFont2Tag){
|
||||
countGlyphs=((DefineFont2Tag)tagObj).glyphShapeTable.length;
|
||||
fontId=((DefineFont2Tag)tagObj).fontId;
|
||||
}
|
||||
if(tagObj instanceof DefineFont3Tag){
|
||||
countGlyphs=((DefineFont3Tag)tagObj).glyphShapeTable.length;
|
||||
fontId=((DefineFont3Tag)tagObj).fontId;
|
||||
}
|
||||
|
||||
List<TEXTRECORD> rec=new ArrayList<TEXTRECORD>();
|
||||
TEXTRECORD tr=new TEXTRECORD();
|
||||
tr.fontId=fontId;
|
||||
tr.styleFlagsHasFont=true;
|
||||
tr.textHeight=460;
|
||||
tr.glyphEntries=new GLYPHENTRY[countGlyphs];
|
||||
tr.styleFlagsHasColor=true;
|
||||
tr.textColor=new RGB(0,0,0);
|
||||
int adv=300;
|
||||
int maxadv=0;
|
||||
for(int f=0;f<countGlyphs;f++){
|
||||
tr.glyphEntries[f]=new GLYPHENTRY();
|
||||
tr.glyphEntries[f].glyphAdvance=adv;
|
||||
adv+=300;
|
||||
if(adv>maxadv){
|
||||
maxadv=adv;
|
||||
}
|
||||
tr.glyphEntries[f].glyphIndex=f;
|
||||
}
|
||||
rec.add(tr);
|
||||
System.out.println("countGlyphs="+countGlyphs);
|
||||
sos2.writeTag(new DefineTextTag(999, new RECT(0,width,0,height), new MATRIX(), SWFOutputStream.getNeededBitsU(countGlyphs-1), SWFOutputStream.getNeededBitsU(maxadv), rec));
|
||||
sos2.writeTag(new PlaceObject2Tag(false, false, false, true, false, true, true, false, 1, 999, mat, null, 0, null, 0, null));
|
||||
sos2.writeTag(new ShowFrameTag());
|
||||
}else
|
||||
if ((tagObj instanceof DefineMorphShapeTag) || (tagObj instanceof DefineMorphShape2Tag)) {
|
||||
sos2.writeTag(new PlaceObject2Tag(false, false, false, true, false, true, true, false, 1, chtId, mat, null, 0, null, 0, null));
|
||||
sos2.writeTag(new ShowFrameTag());
|
||||
int numFrames = 100;
|
||||
for (int ratio = 0; ratio < 65536; ratio += 65536 / numFrames) {
|
||||
sos2.writeTag(new PlaceObject2Tag(false, false, false, true, false, true, false, true, 1, chtId, mat, null, ratio, null, 0, null));
|
||||
sos2.writeTag(new ShowFrameTag());
|
||||
}
|
||||
} else {
|
||||
sos2.writeTag(new PlaceObjectTag(chtId, 1, mat, null));
|
||||
sos2.writeTag(new ShowFrameTag());
|
||||
}
|
||||
|
||||
sos2.writeTag(new EndTag());
|
||||
byte data[] = baos.toByteArray();
|
||||
|
||||
sos.writeUI32(sos.getPos() + data.length + 4);
|
||||
sos.write(data);
|
||||
fos.close();
|
||||
fPanel.displaySWF(tempFile.getAbsolutePath());
|
||||
(new Thread(){
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while(!tagTree.requestFocusInWindow())
|
||||
;
|
||||
}
|
||||
}).start();
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
210
trunk/src/com/jpexs/asdec/gui/TagNode.java
Normal file
210
trunk/src/com/jpexs/asdec/gui/TagNode.java
Normal file
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2012 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.asdec.gui;
|
||||
|
||||
import com.jpexs.asdec.action.*;
|
||||
import com.jpexs.asdec.tags.DefineBitsJPEG2Tag;
|
||||
import com.jpexs.asdec.tags.DefineBitsJPEG3Tag;
|
||||
import com.jpexs.asdec.tags.DefineBitsJPEG4Tag;
|
||||
import com.jpexs.asdec.tags.DefineBitsLossless2Tag;
|
||||
import com.jpexs.asdec.tags.DefineBitsLosslessTag;
|
||||
import com.jpexs.asdec.tags.DefineBitsTag;
|
||||
import com.jpexs.asdec.tags.DefineButton2Tag;
|
||||
import com.jpexs.asdec.tags.DefineButtonTag;
|
||||
import com.jpexs.asdec.tags.DefineEditTextTag;
|
||||
import com.jpexs.asdec.tags.DefineFont2Tag;
|
||||
import com.jpexs.asdec.tags.DefineFont3Tag;
|
||||
import com.jpexs.asdec.tags.DefineFont4Tag;
|
||||
import com.jpexs.asdec.tags.DefineFontTag;
|
||||
import com.jpexs.asdec.tags.DefineMorphShape2Tag;
|
||||
import com.jpexs.asdec.tags.DefineMorphShapeTag;
|
||||
import com.jpexs.asdec.tags.DefineShape2Tag;
|
||||
import com.jpexs.asdec.tags.DefineShape3Tag;
|
||||
import com.jpexs.asdec.tags.DefineShape4Tag;
|
||||
import com.jpexs.asdec.tags.DefineShapeTag;
|
||||
import com.jpexs.asdec.tags.DefineSpriteTag;
|
||||
import com.jpexs.asdec.tags.DefineText2Tag;
|
||||
import com.jpexs.asdec.tags.DefineTextTag;
|
||||
import com.jpexs.asdec.tags.DoInitActionTag;
|
||||
import com.jpexs.asdec.tags.ExportAssetsTag;
|
||||
import com.jpexs.asdec.tags.ShowFrameTag;
|
||||
import com.jpexs.asdec.tags.base.ASMSource;
|
||||
import com.jpexs.asdec.tags.base.Container;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TagNode {
|
||||
|
||||
public List<TagNode> subItems;
|
||||
public Object tag;
|
||||
|
||||
public TagNode(Object tag) {
|
||||
this.tag = tag;
|
||||
this.subItems = new ArrayList<TagNode>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return tag.toString();
|
||||
}
|
||||
|
||||
public static List<TagNode> createTagList(List<Object> list) {
|
||||
List<TagNode> ret = new ArrayList<TagNode>();
|
||||
int frame = 1;
|
||||
List<TagNode> frames = new ArrayList<TagNode>();
|
||||
List<TagNode> shapes = new ArrayList<TagNode>();
|
||||
List<TagNode> morphShapes = new ArrayList<TagNode>();
|
||||
List<TagNode> sprites = new ArrayList<TagNode>();
|
||||
List<TagNode> buttons = new ArrayList<TagNode>();
|
||||
List<TagNode> images = new ArrayList<TagNode>();
|
||||
List<TagNode> fonts = new ArrayList<TagNode>();
|
||||
List<TagNode> texts = new ArrayList<TagNode>();
|
||||
|
||||
|
||||
List<ExportAssetsTag> exportAssetsTags = new ArrayList<ExportAssetsTag>();
|
||||
for (Object t : list) {
|
||||
if (t instanceof ExportAssetsTag) {
|
||||
exportAssetsTags.add((ExportAssetsTag) t);
|
||||
}
|
||||
if((t instanceof DefineFontTag)||
|
||||
(t instanceof DefineFont2Tag)||
|
||||
(t instanceof DefineFont3Tag)||
|
||||
(t instanceof DefineFont4Tag)){
|
||||
fonts.add(new TagNode(t));
|
||||
}
|
||||
if((t instanceof DefineTextTag)||
|
||||
(t instanceof DefineText2Tag)
|
||||
||(t instanceof DefineEditTextTag)){
|
||||
texts.add(new TagNode(t));
|
||||
}
|
||||
|
||||
if((t instanceof DefineBitsTag)||
|
||||
(t instanceof DefineBitsJPEG2Tag)||
|
||||
(t instanceof DefineBitsJPEG3Tag)||
|
||||
(t instanceof DefineBitsJPEG4Tag)||
|
||||
(t instanceof DefineBitsLosslessTag)||
|
||||
(t instanceof DefineBitsLossless2Tag)){
|
||||
images.add(new TagNode(t));
|
||||
}
|
||||
if((t instanceof DefineShapeTag)||
|
||||
(t instanceof DefineShape2Tag)||
|
||||
(t instanceof DefineShape3Tag)||
|
||||
(t instanceof DefineShape4Tag))
|
||||
{
|
||||
shapes.add(new TagNode(t));
|
||||
}
|
||||
|
||||
if((t instanceof DefineMorphShapeTag)||(t instanceof DefineMorphShape2Tag)){
|
||||
morphShapes.add(new TagNode(t));
|
||||
}
|
||||
|
||||
if(t instanceof DefineSpriteTag){
|
||||
sprites.add(new TagNode(t));
|
||||
}
|
||||
if((t instanceof DefineButtonTag)||(
|
||||
t instanceof DefineButton2Tag)){
|
||||
buttons.add(new TagNode(t));
|
||||
}
|
||||
if (t instanceof ShowFrameTag) {
|
||||
TagNode tti = new TagNode("frame" + frame);
|
||||
|
||||
/* for (int r = ret.size() - 1; r >= 0; r--) {
|
||||
if (!(ret.get(r).tag instanceof DefineSpriteTag)) {
|
||||
if (!(ret.get(r).tag instanceof DefineButtonTag)) {
|
||||
if (!(ret.get(r).tag instanceof DefineButton2Tag)) {
|
||||
if (!(ret.get(r).tag instanceof DoInitActionTag)) {
|
||||
tti.subItems.add(ret.get(r));
|
||||
ret.remove(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
frame++;
|
||||
frames.add(tti);
|
||||
} /*if (t instanceof ASMSource) {
|
||||
TagNode tti = new TagNode(t);
|
||||
ret.add(tti);
|
||||
} else */
|
||||
if (t instanceof Container) {
|
||||
TagNode tti = new TagNode(t);
|
||||
if (((Container) t).getItemCount() > 0) {
|
||||
List<Object> subItems = ((Container) t).getSubItems();
|
||||
tti.subItems = createTagList(subItems);
|
||||
}
|
||||
//ret.add(tti);
|
||||
}
|
||||
}
|
||||
|
||||
TagNode textsNode=new TagNode("texts");
|
||||
textsNode.subItems.addAll(texts);
|
||||
|
||||
TagNode imagesNode=new TagNode("images");
|
||||
imagesNode.subItems.addAll(images);
|
||||
|
||||
TagNode fontsNode=new TagNode("fonts");
|
||||
fontsNode.subItems.addAll(fonts);
|
||||
|
||||
|
||||
TagNode spritesNode=new TagNode("sprites");
|
||||
spritesNode.subItems.addAll(sprites);
|
||||
|
||||
TagNode shapesNode=new TagNode("shapes");
|
||||
shapesNode.subItems.addAll(shapes);
|
||||
|
||||
TagNode morphShapesNode=new TagNode("morphshapes");
|
||||
morphShapesNode.subItems.addAll(morphShapes);
|
||||
|
||||
TagNode buttonsNode=new TagNode("buttons");
|
||||
buttonsNode.subItems.addAll(buttons);
|
||||
|
||||
TagNode framesNode=new TagNode("frames");
|
||||
framesNode.subItems.addAll(frames);
|
||||
ret.add(shapesNode);
|
||||
ret.add(morphShapesNode);;
|
||||
ret.add(spritesNode);
|
||||
ret.add(textsNode);
|
||||
ret.add(imagesNode);
|
||||
ret.add(buttonsNode);
|
||||
ret.add(fontsNode);
|
||||
ret.add(framesNode);
|
||||
for (int i = ret.size() - 1; i >= 0; i--) {
|
||||
if (ret.get(i).tag instanceof DefineSpriteTag) {
|
||||
((DefineSpriteTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags;
|
||||
}
|
||||
if (ret.get(i).tag instanceof DefineButtonTag) {
|
||||
((DefineButtonTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags;
|
||||
}
|
||||
if (ret.get(i).tag instanceof DefineButton2Tag) {
|
||||
((DefineButton2Tag) ret.get(i).tag).exportAssetsTags = exportAssetsTags;
|
||||
}
|
||||
if (ret.get(i).tag instanceof DoInitActionTag) {
|
||||
((DoInitActionTag) ret.get(i).tag).exportAssetsTags = exportAssetsTags;
|
||||
}
|
||||
if (ret.get(i).tag instanceof ASMSource) {
|
||||
ASMSource ass = (ASMSource) ret.get(i).tag;
|
||||
if (ass.containsSource()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (ret.get(i).subItems.isEmpty()) {
|
||||
//ret.remove(i);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
88
trunk/src/com/jpexs/asdec/gui/TagTreeModel.java
Normal file
88
trunk/src/com/jpexs/asdec/gui/TagTreeModel.java
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2011 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.asdec.gui;
|
||||
|
||||
import com.jpexs.asdec.tags.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.event.TreeModelListener;
|
||||
import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
public class TagTreeModel implements TreeModel {
|
||||
|
||||
private String root = "";
|
||||
private List<TagNode> list = new ArrayList<TagNode>();
|
||||
|
||||
public TagTreeModel(List<Tag> list) {
|
||||
List<Object> list2 = new ArrayList<Object>();
|
||||
list2.addAll(list);
|
||||
this.list = TagNode.createTagList(list2);
|
||||
}
|
||||
|
||||
public Object getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
||||
public Object getChild(Object parent, int index) {
|
||||
if (parent == root) {
|
||||
return list.get(index);
|
||||
} else {
|
||||
return ((TagNode) parent).subItems.get(index);
|
||||
}
|
||||
}
|
||||
|
||||
public int getChildCount(Object parent) {
|
||||
if (parent == root) {
|
||||
return list.size();
|
||||
} else {
|
||||
return ((TagNode) parent).subItems.size();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLeaf(Object node) {
|
||||
return (getChildCount(node) == 0);
|
||||
}
|
||||
|
||||
public void valueForPathChanged(TreePath path, Object newValue) {
|
||||
}
|
||||
|
||||
public int getIndexOfChild(Object parent, Object child) {
|
||||
if (parent == root) {
|
||||
for (int t = 0; t < list.size(); t++) {
|
||||
if (list.get(t) == child) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
} else {
|
||||
List<TagNode> subTags = ((TagNode) parent).subItems;
|
||||
for (int t = 0; t < subTags.size(); t++) {
|
||||
if (subTags.get(t) == child) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void addTreeModelListener(TreeModelListener l) {
|
||||
}
|
||||
|
||||
public void removeTreeModelListener(TreeModelListener l) {
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.asdec.Main;
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.abc.CopyOutputStream;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.tags.base.Container;
|
||||
import com.jpexs.asdec.tags.base.TagName;
|
||||
import com.jpexs.asdec.types.BUTTONCONDACTION;
|
||||
@@ -39,7 +40,7 @@ import java.util.logging.Logger;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineButton2Tag extends Tag implements Container, TagName {
|
||||
public class DefineButton2Tag extends Tag implements Container, TagName,CharacterTag {
|
||||
|
||||
/**
|
||||
* ID for this character
|
||||
@@ -62,6 +63,11 @@ public class DefineButton2Tag extends Tag implements Container, TagName {
|
||||
*/
|
||||
public List<ExportAssetsTag> exportAssetsTags = new ArrayList<ExportAssetsTag>();
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return buttonId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.io.OutputStream;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineButtonCxform extends Tag {
|
||||
public class DefineButtonCxformTag extends Tag {
|
||||
|
||||
public int buttonId;
|
||||
public CXFORM buttonColorTransform;
|
||||
@@ -60,7 +60,7 @@ public class DefineButtonCxform extends Tag {
|
||||
* @param version SWF version
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineButtonCxform(byte data[], int version, long pos) throws IOException {
|
||||
public DefineButtonCxformTag(byte data[], int version, long pos) throws IOException {
|
||||
super(23, data, pos);
|
||||
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
|
||||
buttonId = sis.readUI16();
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.types.SOUNDINFO;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -29,7 +30,7 @@ import java.io.OutputStream;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineButtonSoundTag extends Tag {
|
||||
public class DefineButtonSoundTag extends Tag implements CharacterTag{
|
||||
|
||||
public int buttonId;
|
||||
public int buttonSoundChar0;
|
||||
@@ -41,6 +42,12 @@ public class DefineButtonSoundTag extends Tag {
|
||||
public int buttonSoundChar3;
|
||||
public SOUNDINFO buttonSoundInfo3;
|
||||
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return buttonId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets data bytes
|
||||
*
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.abc.CopyOutputStream;
|
||||
import com.jpexs.asdec.action.Action;
|
||||
import com.jpexs.asdec.tags.base.ASMSource;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.tags.base.TagName;
|
||||
import com.jpexs.asdec.types.BUTTONRECORD;
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -38,7 +39,7 @@ import java.util.logging.Logger;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineButtonTag extends Tag implements ASMSource, TagName {
|
||||
public class DefineButtonTag extends Tag implements ASMSource, TagName, CharacterTag {
|
||||
|
||||
/**
|
||||
* ID for this character
|
||||
@@ -58,6 +59,12 @@ public class DefineButtonTag extends Tag implements ASMSource, TagName {
|
||||
*/
|
||||
public List<ExportAssetsTag> exportAssetsTags = new ArrayList<ExportAssetsTag>();
|
||||
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return buttonId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
import com.jpexs.asdec.types.RGBA;
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -30,9 +31,9 @@ import java.io.OutputStream;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineEditTextTag extends Tag {
|
||||
public class DefineEditTextTag extends Tag implements CharacterTag {
|
||||
|
||||
public int characterId;
|
||||
public int characterID;
|
||||
public RECT bounds;
|
||||
public boolean hasText;
|
||||
public boolean wordWrap;
|
||||
@@ -62,6 +63,11 @@ public class DefineEditTextTag extends Tag {
|
||||
public int leading;
|
||||
public String variableName;
|
||||
public String initialText;
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return characterID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets data bytes
|
||||
@@ -75,7 +81,7 @@ public class DefineEditTextTag extends Tag {
|
||||
OutputStream os = baos;
|
||||
SWFOutputStream sos = new SWFOutputStream(os, version);
|
||||
try {
|
||||
sos.writeUI16(characterId);
|
||||
sos.writeUI16(characterID);
|
||||
sos.writeRECT(bounds);
|
||||
sos.writeUB(1, hasText ? 1 : 0);
|
||||
sos.writeUB(1, wordWrap ? 1 : 0);
|
||||
@@ -133,9 +139,9 @@ public class DefineEditTextTag extends Tag {
|
||||
* @throws IOException
|
||||
*/
|
||||
public DefineEditTextTag(byte data[], int version, long pos) throws IOException {
|
||||
super(0, data, pos);
|
||||
super(37, data, pos);
|
||||
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
|
||||
characterId = sis.readUI16();
|
||||
characterID = sis.readUI16();
|
||||
bounds = sis.readRECT();
|
||||
hasText = sis.readUB(1) == 1;
|
||||
wordWrap = sis.readUB(1) == 1;
|
||||
|
||||
@@ -19,6 +19,8 @@ package com.jpexs.asdec.tags;
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.abc.CopyOutputStream;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.tags.base.FontTag;
|
||||
import com.jpexs.asdec.types.KERNINGRECORD;
|
||||
import com.jpexs.asdec.types.LANGCODE;
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
@@ -33,7 +35,7 @@ import java.io.OutputStream;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineFont2Tag extends Tag {
|
||||
public class DefineFont2Tag extends Tag implements FontTag {
|
||||
|
||||
public int fontId;
|
||||
public boolean fontFlagsHasLayout;
|
||||
|
||||
@@ -18,6 +18,9 @@ package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.abc.CopyOutputStream;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.tags.base.FontTag;
|
||||
import com.jpexs.asdec.types.KERNINGRECORD;
|
||||
import com.jpexs.asdec.types.LANGCODE;
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
@@ -27,7 +30,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class DefineFont3Tag extends Tag {
|
||||
public class DefineFont3Tag extends Tag implements FontTag {
|
||||
|
||||
public int fontId;
|
||||
public boolean fontFlagsHasLayout;
|
||||
@@ -124,6 +127,7 @@ public class DefineFont3Tag extends Tag {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
OutputStream os = baos;
|
||||
SWFOutputStream sos = new SWFOutputStream(os, version);
|
||||
sos=new SWFOutputStream(new CopyOutputStream(sos, new ByteArrayInputStream(data)), 10);
|
||||
try {
|
||||
sos.writeUI16(fontId);
|
||||
sos.writeUB(1, fontFlagsHasLayout ? 1 : 0);
|
||||
|
||||
@@ -18,12 +18,13 @@ package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class DefineFont4Tag extends Tag {
|
||||
public class DefineFont4Tag extends Tag implements CharacterTag{
|
||||
|
||||
public int fontID;
|
||||
public boolean fontFlagsHasFontData;
|
||||
@@ -31,6 +32,11 @@ public class DefineFont4Tag extends Tag {
|
||||
public boolean fontFlagsBold;
|
||||
public String fontName;
|
||||
public byte fontData[];
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return fontID;
|
||||
}
|
||||
|
||||
public DefineFont4Tag(byte[] data, int version, long pos) throws IOException {
|
||||
super(91, data, pos);
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.tags.base.FontTag;
|
||||
import com.jpexs.asdec.types.SHAPE;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -29,7 +31,7 @@ import java.io.OutputStream;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineFontTag extends Tag {
|
||||
public class DefineFontTag extends Tag implements FontTag{
|
||||
|
||||
public int fontId;
|
||||
public int offsetTable[];
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.tags.base.BoundedTag;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.types.MORPHFILLSTYLEARRAY;
|
||||
import com.jpexs.asdec.types.MORPHLINESTYLEARRAY;
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
@@ -32,7 +34,7 @@ import java.io.OutputStream;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineMorphShape2Tag extends Tag {
|
||||
public class DefineMorphShape2Tag extends Tag implements CharacterTag, BoundedTag {
|
||||
|
||||
public int characterId;
|
||||
public RECT startBounds;
|
||||
@@ -46,6 +48,21 @@ public class DefineMorphShape2Tag extends Tag {
|
||||
public SHAPE startEdges;
|
||||
public SHAPE endEdges;
|
||||
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
RECT rect=new RECT();
|
||||
rect.Xmin=Math.min(startBounds.Xmin,endBounds.Xmin);
|
||||
rect.Ymin=Math.min(startBounds.Ymin,endBounds.Ymin);
|
||||
rect.Xmax=Math.max(startBounds.Xmax,endBounds.Xmax);
|
||||
rect.Ymax=Math.max(startBounds.Ymax,endBounds.Ymax);
|
||||
return rect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return characterId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets data bytes
|
||||
*
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.tags.base.BoundedTag;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.types.MORPHFILLSTYLEARRAY;
|
||||
import com.jpexs.asdec.types.MORPHLINESTYLEARRAY;
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
@@ -32,7 +34,7 @@ import java.io.OutputStream;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineMorphShapeTag extends Tag {
|
||||
public class DefineMorphShapeTag extends Tag implements CharacterTag, BoundedTag{
|
||||
|
||||
public int characterId;
|
||||
public RECT startBounds;
|
||||
@@ -42,6 +44,12 @@ public class DefineMorphShapeTag extends Tag {
|
||||
public SHAPE startEdges;
|
||||
public SHAPE endEdges;
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return characterId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets data bytes
|
||||
*
|
||||
@@ -101,4 +109,14 @@ public class DefineMorphShapeTag extends Tag {
|
||||
public String toString() {
|
||||
return "DefineMorphShape";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
RECT rect=new RECT();
|
||||
rect.Xmin=Math.min(startBounds.Xmin,endBounds.Xmin);
|
||||
rect.Ymin=Math.min(startBounds.Ymin,endBounds.Ymin);
|
||||
rect.Xmax=Math.max(startBounds.Xmax,endBounds.Xmax);
|
||||
rect.Ymax=Math.max(startBounds.Ymax,endBounds.Ymax);
|
||||
return rect;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,17 +17,32 @@
|
||||
package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.tags.base.BoundedTag;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
import com.jpexs.asdec.types.SHAPEWITHSTYLE;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DefineShape2Tag extends Tag {
|
||||
public class DefineShape2Tag extends Tag implements CharacterTag, BoundedTag{
|
||||
|
||||
public int shapeId;
|
||||
public RECT shapeBounds;
|
||||
public SHAPEWITHSTYLE shapes;
|
||||
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return shapeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
return shapeBounds;
|
||||
}
|
||||
|
||||
public DefineShape2Tag(byte[] data, int version, long pos) throws IOException {
|
||||
super(22, data, pos);
|
||||
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
|
||||
@@ -36,8 +51,17 @@ public class DefineShape2Tag extends Tag {
|
||||
shapes = sis.readSHAPEWITHSTYLE(2);
|
||||
}
|
||||
|
||||
public List<ExportAssetsTag> exportAssetsTags = new ArrayList<ExportAssetsTag>();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DefineShape2";
|
||||
String name = "";
|
||||
for (ExportAssetsTag eat : exportAssetsTags) {
|
||||
int pos = eat.tags.indexOf(shapeId);
|
||||
if (pos > -1) {
|
||||
name = ": " + eat.names.get(pos);
|
||||
}
|
||||
}
|
||||
return "DefineShape2 (" + shapeId + name + ")";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,17 +17,30 @@
|
||||
package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.tags.base.BoundedTag;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
import com.jpexs.asdec.types.SHAPEWITHSTYLE;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DefineShape3Tag extends Tag {
|
||||
public class DefineShape3Tag extends Tag implements CharacterTag,BoundedTag{
|
||||
|
||||
public int shapeId;
|
||||
public RECT shapeBounds;
|
||||
public SHAPEWITHSTYLE shapes;
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
return shapeBounds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return shapeId;
|
||||
}
|
||||
|
||||
public DefineShape3Tag(byte[] data, int version, long pos) throws IOException {
|
||||
super(32, data, pos);
|
||||
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
|
||||
@@ -36,8 +49,17 @@ public class DefineShape3Tag extends Tag {
|
||||
shapes = sis.readSHAPEWITHSTYLE(3);
|
||||
}
|
||||
|
||||
public List<ExportAssetsTag> exportAssetsTags = new ArrayList<ExportAssetsTag>();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DefineShape3";
|
||||
String name = "";
|
||||
for (ExportAssetsTag eat : exportAssetsTags) {
|
||||
int pos = eat.tags.indexOf(shapeId);
|
||||
if (pos > -1) {
|
||||
name = ": " + eat.names.get(pos);
|
||||
}
|
||||
}
|
||||
return "DefineShape3 (" + shapeId + name + ")";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,16 @@
|
||||
package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.tags.base.BoundedTag;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
import com.jpexs.asdec.types.SHAPEWITHSTYLE;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DefineShape4Tag extends Tag {
|
||||
public class DefineShape4Tag extends Tag implements CharacterTag,BoundedTag{
|
||||
|
||||
public int shapeId;
|
||||
public RECT shapeBounds;
|
||||
@@ -32,6 +36,16 @@ public class DefineShape4Tag extends Tag {
|
||||
public boolean usesScalingStrokes;
|
||||
public SHAPEWITHSTYLE shapes;
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return shapeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
return shapeBounds;
|
||||
}
|
||||
|
||||
public DefineShape4Tag(byte[] data, int version, long pos) throws IOException {
|
||||
super(83, data, pos);
|
||||
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
|
||||
@@ -45,8 +59,17 @@ public class DefineShape4Tag extends Tag {
|
||||
shapes = sis.readSHAPEWITHSTYLE(4);
|
||||
}
|
||||
|
||||
public List<ExportAssetsTag> exportAssetsTags = new ArrayList<ExportAssetsTag>();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DefineShape4";
|
||||
String name = "";
|
||||
for (ExportAssetsTag eat : exportAssetsTags) {
|
||||
int pos = eat.tags.indexOf(shapeId);
|
||||
if (pos > -1) {
|
||||
name = ": " + eat.names.get(pos);
|
||||
}
|
||||
}
|
||||
return "DefineShape4 (" + shapeId + name + ")";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,17 +17,28 @@
|
||||
package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.tags.base.BoundedTag;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
import com.jpexs.asdec.types.SHAPEWITHSTYLE;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DefineShapeTag extends Tag {
|
||||
public class DefineShapeTag extends Tag implements CharacterTag, BoundedTag {
|
||||
|
||||
public int shapeId;
|
||||
public RECT shapeBounds;
|
||||
public SHAPEWITHSTYLE shapes;
|
||||
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
return shapeBounds;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DefineShapeTag(byte[] data, int version, long pos) throws IOException {
|
||||
super(2, data, pos);
|
||||
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
|
||||
@@ -36,8 +47,24 @@ public class DefineShapeTag extends Tag {
|
||||
shapes = sis.readSHAPEWITHSTYLE(1);
|
||||
}
|
||||
|
||||
|
||||
public List<ExportAssetsTag> exportAssetsTags = new ArrayList<ExportAssetsTag>();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DefineShape";
|
||||
String name = "";
|
||||
for (ExportAssetsTag eat : exportAssetsTags) {
|
||||
int pos = eat.tags.indexOf(shapeId);
|
||||
if (pos > -1) {
|
||||
name = ": " + eat.names.get(pos);
|
||||
}
|
||||
}
|
||||
return "DefineShape (" + shapeId + name + ")";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return shapeId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -28,7 +29,7 @@ import java.io.OutputStream;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineSoundTag extends Tag {
|
||||
public class DefineSoundTag extends Tag implements CharacterTag {
|
||||
|
||||
public int soundId;
|
||||
public int soundFormat;
|
||||
@@ -45,6 +46,11 @@ public class DefineSoundTag extends Tag {
|
||||
public long soundSampleCount;
|
||||
public byte soundData[];
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return soundId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets data bytes
|
||||
*
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.asdec.Main;
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.abc.CopyOutputStream;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.tags.base.Container;
|
||||
import com.jpexs.asdec.tags.base.TagName;
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -32,7 +33,7 @@ import java.util.List;
|
||||
/**
|
||||
* Defines a sprite character
|
||||
*/
|
||||
public class DefineSpriteTag extends Tag implements Container, TagName {
|
||||
public class DefineSpriteTag extends Tag implements Container, TagName, CharacterTag {
|
||||
|
||||
/**
|
||||
* Character ID of sprite
|
||||
@@ -52,6 +53,14 @@ public class DefineSpriteTag extends Tag implements Container, TagName {
|
||||
public List<ExportAssetsTag> exportAssetsTags = new ArrayList<ExportAssetsTag>();
|
||||
private int level;
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return spriteId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.types.MATRIX;
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
import com.jpexs.asdec.types.TEXTRECORD;
|
||||
@@ -33,7 +34,7 @@ import java.util.List;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineText2Tag extends Tag {
|
||||
public class DefineText2Tag extends Tag implements CharacterTag {
|
||||
|
||||
public int characterID;
|
||||
public RECT textBounds;
|
||||
@@ -42,6 +43,11 @@ public class DefineText2Tag extends Tag {
|
||||
public int advanceBits;
|
||||
public List<TEXTRECORD> textRecords;
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return characterID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets data bytes
|
||||
*
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import com.jpexs.asdec.types.MATRIX;
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
import com.jpexs.asdec.types.TEXTRECORD;
|
||||
@@ -33,7 +34,7 @@ import java.util.List;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineTextTag extends Tag {
|
||||
public class DefineTextTag extends Tag implements CharacterTag{
|
||||
|
||||
public int characterID;
|
||||
public RECT textBounds;
|
||||
@@ -42,6 +43,23 @@ public class DefineTextTag extends Tag {
|
||||
public int advanceBits;
|
||||
public List<TEXTRECORD> textRecords;
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return characterID;
|
||||
}
|
||||
|
||||
public DefineTextTag(int characterID, RECT textBounds, MATRIX textMatrix, int glyphBits, int advanceBits, List<TEXTRECORD> textRecords) {
|
||||
super(11, new byte[0], 0);
|
||||
this.characterID = characterID;
|
||||
this.textBounds = textBounds;
|
||||
this.textMatrix = textMatrix;
|
||||
this.glyphBits = glyphBits;
|
||||
this.advanceBits = advanceBits;
|
||||
this.textRecords = textRecords;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets data bytes
|
||||
*
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.tags.base.CharacterTag;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -28,9 +29,9 @@ import java.io.OutputStream;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineVideoStreamTag extends Tag {
|
||||
public class DefineVideoStreamTag extends Tag implements CharacterTag {
|
||||
|
||||
public int characterId;
|
||||
public int characterID;
|
||||
public int numFrames;
|
||||
public int width;
|
||||
public int height;
|
||||
@@ -38,6 +39,11 @@ public class DefineVideoStreamTag extends Tag {
|
||||
public boolean videoFlagsSmoothing;
|
||||
public int codecID;
|
||||
|
||||
@Override
|
||||
public int getCharacterID() {
|
||||
return characterID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets data bytes
|
||||
*
|
||||
@@ -50,7 +56,7 @@ public class DefineVideoStreamTag extends Tag {
|
||||
OutputStream os = baos;
|
||||
SWFOutputStream sos = new SWFOutputStream(os, version);
|
||||
try {
|
||||
sos.writeUI16(characterId);
|
||||
sos.writeUI16(characterID);
|
||||
sos.writeUI16(numFrames);
|
||||
sos.writeUI16(width);
|
||||
sos.writeUI16(height);
|
||||
@@ -73,7 +79,7 @@ public class DefineVideoStreamTag extends Tag {
|
||||
public DefineVideoStreamTag(byte data[], int version, long pos) throws IOException {
|
||||
super(60, data, pos);
|
||||
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
|
||||
characterId = sis.readUI16();
|
||||
characterID = sis.readUI16();
|
||||
numFrames = sis.readUI16();
|
||||
width = sis.readUI16();
|
||||
height = sis.readUI16();
|
||||
|
||||
@@ -48,6 +48,12 @@ public class EndTag extends Tag {
|
||||
|
||||
}
|
||||
|
||||
public EndTag() {
|
||||
super(0, new byte[0], 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns string representation of the object
|
||||
*
|
||||
|
||||
@@ -157,6 +157,28 @@ public class PlaceObject2Tag extends Tag implements Container {
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
public PlaceObject2Tag(boolean placeFlagHasClipActions, boolean placeFlagHasClipDepth, boolean placeFlagHasName, boolean placeFlagHasRatio, boolean placeFlagHasColorTransform, boolean placeFlagHasMatrix, boolean placeFlagHasCharacter, boolean placeFlagMove, int depth, int characterId, MATRIX matrix, CXFORMWITHALPHA colorTransform, int ratio, String name, int clipDepth, CLIPACTIONS clipActions) {
|
||||
super(26, new byte[0], 0);
|
||||
this.placeFlagHasClipActions = placeFlagHasClipActions;
|
||||
this.placeFlagHasClipDepth = placeFlagHasClipDepth;
|
||||
this.placeFlagHasName = placeFlagHasName;
|
||||
this.placeFlagHasRatio = placeFlagHasRatio;
|
||||
this.placeFlagHasColorTransform = placeFlagHasColorTransform;
|
||||
this.placeFlagHasMatrix = placeFlagHasMatrix;
|
||||
this.placeFlagHasCharacter = placeFlagHasCharacter;
|
||||
this.placeFlagMove = placeFlagMove;
|
||||
this.depth = depth;
|
||||
this.characterId = characterId;
|
||||
this.matrix = matrix;
|
||||
this.colorTransform = colorTransform;
|
||||
this.ratio = ratio;
|
||||
this.name = name;
|
||||
this.clipDepth = clipDepth;
|
||||
this.clipActions = clipActions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@@ -90,6 +90,16 @@ public class PlaceObjectTag extends Tag {
|
||||
}
|
||||
}
|
||||
|
||||
public PlaceObjectTag(int characterId, int depth, MATRIX matrix, CXFORM colorTransform) {
|
||||
super(4, new byte[0], 0);
|
||||
this.characterId = characterId;
|
||||
this.depth = depth;
|
||||
this.matrix = matrix;
|
||||
this.colorTransform = colorTransform;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns string representation of the object
|
||||
*
|
||||
|
||||
@@ -16,20 +16,42 @@
|
||||
*/
|
||||
package com.jpexs.asdec.tags;
|
||||
|
||||
import com.jpexs.asdec.SWFInputStream;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.types.RGB;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class SetBackgroundColorTag extends Tag {
|
||||
|
||||
public RGB backgroundColor;
|
||||
|
||||
public SetBackgroundColorTag(byte[] data, long pos) {
|
||||
public SetBackgroundColorTag(byte[] data, int version, long pos) throws IOException {
|
||||
super(9, data, pos);
|
||||
backgroundColor = new RGB();
|
||||
backgroundColor.red = data[0] & 0xff;
|
||||
backgroundColor.green = data[1] & 0xff;
|
||||
backgroundColor.blue = data[2] & 0xff;
|
||||
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
|
||||
backgroundColor = sis.readRGB();
|
||||
}
|
||||
|
||||
public SetBackgroundColorTag(RGB backgroundColor) {
|
||||
super(9, new byte[0], 0);
|
||||
this.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getData(int version) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
SWFOutputStream sos = new SWFOutputStream(baos, version);
|
||||
try {
|
||||
sos.writeRGB(backgroundColor);
|
||||
} catch (IOException e) {
|
||||
}
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SetBackgroundColor";
|
||||
|
||||
@@ -30,6 +30,10 @@ public class ShowFrameTag extends Tag {
|
||||
super(1, new byte[0], pos);
|
||||
}
|
||||
|
||||
public ShowFrameTag(){
|
||||
super(1, new byte[0], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets data bytes
|
||||
*
|
||||
|
||||
11
trunk/src/com/jpexs/asdec/tags/base/BoundedTag.java
Normal file
11
trunk/src/com/jpexs/asdec/tags/base/BoundedTag.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.jpexs.asdec.tags.base;
|
||||
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface BoundedTag {
|
||||
public RECT getRect();
|
||||
}
|
||||
9
trunk/src/com/jpexs/asdec/tags/base/CharacterTag.java
Normal file
9
trunk/src/com/jpexs/asdec/tags/base/CharacterTag.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.jpexs.asdec.tags.base;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface CharacterTag {
|
||||
public int getCharacterID();
|
||||
}
|
||||
9
trunk/src/com/jpexs/asdec/tags/base/FontTag.java
Normal file
9
trunk/src/com/jpexs/asdec/tags/base/FontTag.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.jpexs.asdec.tags.base;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface FontTag {
|
||||
|
||||
}
|
||||
@@ -31,11 +31,11 @@ public class MATRIX {
|
||||
/**
|
||||
* X scale value
|
||||
*/
|
||||
public double scaleX;
|
||||
public int scaleX;
|
||||
/**
|
||||
* Y scale value
|
||||
*/
|
||||
public double scaleY;
|
||||
public int scaleY;
|
||||
/**
|
||||
* Has rotate and skew values
|
||||
*/
|
||||
@@ -43,11 +43,11 @@ public class MATRIX {
|
||||
/**
|
||||
* First rotate and skew value
|
||||
*/
|
||||
public double rotateSkew0;
|
||||
public int rotateSkew0;
|
||||
/**
|
||||
* Second rotate and skew value
|
||||
*/
|
||||
public double rotateSkew1;
|
||||
public int rotateSkew1;
|
||||
/**
|
||||
* X translate value in twips
|
||||
*/
|
||||
@@ -55,17 +55,12 @@ public class MATRIX {
|
||||
/**
|
||||
* Y translate value in twips
|
||||
*/
|
||||
public int translateY;
|
||||
/**
|
||||
* Nbits used for store translate values
|
||||
*/
|
||||
public int translateNBits;
|
||||
/**
|
||||
* Nbits used for store scale values
|
||||
*/
|
||||
public int scaleNBits;
|
||||
/**
|
||||
* Nbits used for store rotate values
|
||||
*/
|
||||
public int rotateNBits;
|
||||
public int translateY;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[MATRIX scale:"+scaleX+","+scaleY+", rotate:"+rotateSkew0+","+rotateSkew1+", translate:"+translateX+","+translateY+"]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -39,9 +39,30 @@ public class RECT {
|
||||
* Y maximum position for rectangle in twips
|
||||
*/
|
||||
public int Ymax;
|
||||
|
||||
|
||||
public RECT(int Xmin, int Xmax, int Ymin, int Ymax) {
|
||||
this.Xmin = Xmin;
|
||||
this.Xmax = Xmax;
|
||||
this.Ymin = Ymin;
|
||||
this.Ymax = Ymax;
|
||||
}
|
||||
|
||||
public RECT()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[RECT x=" + Xmin + "-" + Xmax + ", y=" + Ymin + "-" + Ymax + "]";
|
||||
}
|
||||
|
||||
public int getWidth(){
|
||||
return Xmax-Xmin;
|
||||
}
|
||||
|
||||
public int getHeight(){
|
||||
return Ymax-Ymin;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,4 +35,14 @@ public class RGB {
|
||||
* Blue color value
|
||||
*/
|
||||
public int blue;
|
||||
|
||||
public RGB(int red, int green, int blue) {
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
}
|
||||
|
||||
public RGB(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user