This commit is contained in:
Jindra Pet��k
2013-01-03 22:15:03 +01:00
parent 8c7b52e6af
commit 8095ce1a66
51 changed files with 2477 additions and 108 deletions
+2 -2
View File
@@ -523,7 +523,7 @@ public class Main {
System.err.println("FAIL");
}
} else if (args[pos].equals("-decompress")) {
if (args.length < 3) {
if (args.length < pos+3) {
badArguments();
}
@@ -535,7 +535,7 @@ public class Main {
System.exit(1);
}
} else if (args[pos].equals("-dumpSWF")) {
if (args.length < 2) {
if (args.length < pos+2) {
badArguments();
}
try {
+52
View File
@@ -287,6 +287,58 @@ public class SWF {
}
return true;
}
/**
* Decompress LZMA compressed SWF file
*
* @param fis Input stream
* @param fos Output stream
*/
public static boolean zws2fws(InputStream fis, OutputStream fos) {
try {
byte hdr[] = new byte[3];
fis.read(hdr);
String shdr = new String(hdr);
if (!shdr.equals("ZWS")) {
return false;
}
int version = fis.read();
SWFInputStream sis = new SWFInputStream(fis, version, 4);
long fileSize = sis.readUI32();
if (hdr[0] == 'Z') {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
long outSize = sis.readUI32();
int propertiesSize = 5;
byte lzmaProperties[] = new byte[propertiesSize];
if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) {
throw new IOException("LZMA:input .lzma file is too short");
}
SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder();
if (!decoder.SetDecoderProperties(lzmaProperties)) {
throw new IOException("LZMA:Incorrect stream properties");
}
if (!decoder.Code(sis, baos, fileSize - 8)) {
throw new IOException("LZMA:Error in data stream");
}
SWFOutputStream sos=new SWFOutputStream(fos,version);
sos.write("FWS".getBytes());
sos.write(version);
sos.writeUI32(fileSize);
sos.write(baos.toByteArray());
sos.close();
}else{
return false;
}
} catch (FileNotFoundException ex) {
return false;
} catch (IOException ex) {
return false;
}
return true;
}
public boolean exportActionScript(String outdir, boolean isPcode) throws Exception {
boolean asV3Found = false;
+523 -80
View File
@@ -26,6 +26,11 @@ import com.jpexs.asdec.helpers.Helper;
import com.jpexs.asdec.tags.*;
import com.jpexs.asdec.types.*;
import com.jpexs.asdec.types.filters.*;
import com.jpexs.asdec.types.shaperecords.CurvedEdgeRecord;
import com.jpexs.asdec.types.shaperecords.EndShapeRecord;
import com.jpexs.asdec.types.shaperecords.SHAPERECORD;
import com.jpexs.asdec.types.shaperecords.StraightEdgeRecord;
import com.jpexs.asdec.types.shaperecords.StyleChangeRecord;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -485,105 +490,215 @@ public class SWFInputStream extends InputStream {
byte data[] = readBytes((int) tagLength);
Tag ret;
switch (tagID) {
case 82:
ret = new DoABCTag(data, version, pos);
break;
case 12:
ret = new DoActionTag(data, version, pos);
break;
case 59:
ret = new DoInitActionTag(data, version, pos);
break;
case 39:
ret = new DefineSpriteTag(data, version, level, pos);
break;
case 1:
ret = new ShowFrameTag(pos);
break;
case 26:
ret = new PlaceObject2Tag(data, version, pos);
break;
case 56:
ret = new ExportAssetsTag(data, version, pos);
break;
case 70:
ret = new PlaceObject3Tag(data, version, pos);
break;
case 7:
ret = new DefineButtonTag(data, version, pos);
break;
case 34:
ret = new DefineButton2Tag(data, version, pos);
break;
case 69:
ret = new FileAttributesTag(data, version, pos);
break;
case 77:
ret = new MetadataTag(data, pos);
break;
case 65:
ret = new ScriptLimitsTag(data, version, pos);
break;
case 9:
ret = new SetBackgroundColorTag(data, pos);
break;
case 41:
ret = new ProductInfoTag(data, version, pos);
break;
case 43:
ret = new FrameLabelTag(data, version, pos);
break;
case 36:
ret = new DefineBitsLossless2Tag(data, version, pos);
break;
case 76:
ret = new SymbolClassTag(data, version, pos);
break;
case 32:
ret = new DefineShape3(data, version, pos);
break;
case 28:
ret = new RemoveObject2Tag(data, version, pos);
break;
case 78:
ret = new DefineScalingGridTag(data, version, pos);
break;
case 2:
ret = new DefineShapeTag(data, version, pos);
break;
case 22:
ret = new DefineShape2(data, version, pos);
//case 3
case 4:
ret = new PlaceObjectTag(data, version, pos);
break;
case 83:
ret = new DefineShape4(data, version, pos);
break;
case 20:
ret = new DefineBitsLosslessTag(data, version, pos);
break;
case 35:
ret = new DefineBitsJPEG3Tag(data, version, pos);
break;
case 87:
ret = new DefineBinaryDataTag(data, version, pos);
break;
case 8:
ret = new JPEGTablesTag(data, pos);
case 5:
ret = new RemoveObjectTag(data, version, pos);
break;
case 6:
ret = new DefineBitsTag(data, version, pos);
break;
case 7:
ret = new DefineButtonTag(data, version, pos);
break;
case 8:
ret = new JPEGTablesTag(data, pos);
break;
case 9:
ret = new SetBackgroundColorTag(data, pos);
break;
case 10:
ret = new DefineFontTag(data, version, pos);
break;
case 11:
ret = new DefineTextTag(data, version, pos);
break;
case 12:
ret = new DoActionTag(data, version, pos);
break;
case 13:
ret = new NotDefinedTag("DefineFontInfo",13,data,pos);
break;
case 14:
ret = new NotDefinedTag("DefineSound",14,data,pos);
break;
case 15:
ret = new NotDefinedTag("StartSound",15,data,pos);
break;
//case 16
case 17:
ret = new NotDefinedTag("DefineButtonSound",17,data,pos);
break;
case 18:
ret = new NotDefinedTag("SoundStreamHead",18,data,pos);
break;
case 19:
ret = new NotDefinedTag("SoundStreamBlock",19,data,pos);
break;
case 21:
ret = new DefineBitsJPEG2Tag(data, version, pos);
break;
case 20:
ret = new DefineBitsLosslessTag(data, version, pos);
break;
case 22:
ret = new DefineShape2(data, version, pos);
break;
case 23:
ret = new NotDefinedTag("DefineButtonCxform",23,data,pos);
break;
case 24:
ret = new ProtectTag(data, version, pos);
break;
//case 25:
case 26:
ret = new PlaceObject2Tag(data, version, pos);
break;
//case 27:
case 28:
ret = new RemoveObject2Tag(data, version, pos);
break;
//case 29:
//case 30:
//case 31:
case 32:
ret = new DefineShape3(data, version, pos);
break;
case 33:
ret = new NotDefinedTag("DefineText2",33,data,pos);
break;
case 34:
ret = new DefineButton2Tag(data, version, pos);
break;
case 35:
ret = new DefineBitsJPEG3Tag(data, version, pos);
break;
case 36:
ret = new DefineBitsLossless2Tag(data, version, pos);
break;
case 37:
ret = new NotDefinedTag("DefineEditText",37,data,pos);
break;
//case 38:
case 39:
ret = new DefineSpriteTag(data, version, level, pos);
break;
//case 40:
case 41:
ret = new ProductInfoTag(data, version, pos);
break;
//case 42:
case 43:
ret = new FrameLabelTag(data, version, pos);
break;
//case 44:
case 45:
ret = new NotDefinedTag("SoundStreamHead2",45,data,pos);
break;
case 46:
ret = new NotDefinedTag("DefineMorphShape",46,data,pos);
break;
//case 47:
case 48:
ret = new NotDefinedTag("DefineFont2",48,data,pos);
break;
//case 49-55:
case 56:
ret = new ExportAssetsTag(data, version, pos);
break;
case 57:
ret = new ImportAssetsTag(data, version, pos);
break;
case 58:
ret = new EnableDebuggerTag(data, version, pos);
break;
case 59:
ret = new DoInitActionTag(data, version, pos);
break;
case 60:
ret = new NotDefinedTag("DefineVideoStream",60,data,pos);
break;
case 61:
ret = new NotDefinedTag("VideoFrame",61,data,pos);
break;
case 62:
ret = new NotDefinedTag("DefineFontInfo2",62,data,pos);
break;
case 63:
ret = new DebugIDTag(data, version, pos);
break;
case 64:
ret = new EnableDebugger2Tag(data, version, pos);
break;
case 65:
ret = new ScriptLimitsTag(data, version, pos);
break;
case 66:
ret = new SetTabIndexTag(data, version, pos);
break;
//case 67-68:
case 69:
ret = new FileAttributesTag(data, version, pos);
break;
case 70:
ret = new PlaceObject3Tag(data, version, pos);
break;
case 71:
ret = new ImportAssets2Tag(data, version, pos);
break;
//case 72:
case 73:
ret = new DefineFontAlignZonesTag(data, version, pos);
break;
case 74:
ret = new NotDefinedTag("DefineFontInfo2",62,data,pos);
break;
case 75:
ret = new DefineFont3Tag(data, version, pos);
break;
case 73:
ret = new DefineFontAlignZonesTag(data, version, pos);
case 76:
ret = new SymbolClassTag(data, version, pos);
break;
case 77:
ret = new MetadataTag(data, version, pos);
break;
case 78:
ret = new DefineScalingGridTag(data, version, pos);
break;
//case 79-81:
case 82:
ret = new DoABCTag(data, version, pos);
break;
case 83:
ret = new DefineShape4(data, version, pos);
break;
case 84:
ret = new NotDefinedTag("DefineMorphShape2",84,data,pos);
break;
//case 85:
case 86:
ret = new DefineSceneAndFrameLabelDataTag(data, version, pos);
break;
case 87:
ret = new DefineBinaryDataTag(data, version, pos);
break;
case 88:
ret = new DefineFontNameTag(data, version, pos);
break;
case 89:
ret = new NotDefinedTag("StartSound2",89,data,pos);
break;
case 90:
ret = new NotDefinedTag("DefineBitsJPEG4",84,data,pos);
break;
case 91:
ret = new DefineFont4Tag(data, version, pos);
break;
@@ -884,7 +999,7 @@ public class SWFInputStream extends InputStream {
alignByte();
return ret;
}
/**
* Reads one CXFORM value from the stream
*
@@ -900,7 +1015,7 @@ public class SWFInputStream extends InputStream {
if (ret.hasMultTerms) {
ret.redMultTerm = (int) readSB(Nbits);
ret.greenMultTerm = (int) readSB(Nbits);
ret.blueMultTerm = (int) readSB(Nbits);
ret.blueMultTerm = (int) readSB(Nbits);
}
if (ret.hasAddTerms) {
ret.redAddTerm = (int) readSB(Nbits);
@@ -1015,6 +1130,20 @@ public class SWFInputStream extends InputStream {
return ret;
}
/**
* Reads one RGB value from the stream
*
* @return RGB value
* @throws IOException
*/
public RGB readRGB() throws IOException {
RGB ret = new RGB();
ret.red = readUI8();
ret.green = readUI8();
ret.blue = readUI8();
return ret;
}
/**
* Reads one CONVOLUTIONFILTER value from the stream
*
@@ -1331,6 +1460,320 @@ public class SWFInputStream extends InputStream {
return ret;
}
/**
* Reads one GRADRECORD value from the stream
*
* @return GRADRECORD value
* @throws IOException
*/
public GRADRECORD readGRADRECORD(boolean inShape3) throws IOException {
GRADRECORD ret = new GRADRECORD();
ret.ratio = readUI8();
if (ret.inShape3 = inShape3) {
ret.colorA = readRGBA();
} else {
ret.color = readRGB();
}
return ret;
}
/**
* Reads one GRADIENT value from the stream
*
* @return GRADIENT value
* @throws IOException
*/
public GRADIENT readGRADIENT(boolean inShape3) throws IOException {
GRADIENT ret = new GRADIENT();
ret.spreadMode = (int) readUB(2);
ret.interPolationMode = (int) readUB(2);
int numGradients = (int) readUB(4);
ret.gradientRecords = new GRADRECORD[numGradients];
for (int i = 0; i < numGradients; i++) {
ret.gradientRecords[i] = readGRADRECORD(inShape3);
}
return ret;
}
/**
* Reads one FOCALGRADIENT value from the stream
*
* @return FOCALGRADIENT value
* @throws IOException
*/
public FOCALGRADIENT readFOCALGRADIENT(boolean inShape3) throws IOException {
FOCALGRADIENT ret = new FOCALGRADIENT();
ret.spreadMode = (int) readUB(2);
ret.interPolationMode = (int) readUB(2);
int numGradients = (int) readUB(4);
ret.gradientRecords = new GRADRECORD[numGradients];
for (int i = 0; i < numGradients; i++) {
ret.gradientRecords[i] = readGRADRECORD(inShape3);
}
ret.focalPoint = readFIXED8();
return ret;
}
/**
* Reads one FILLSTYLE value from the stream
*
* @return FILLSTYLE value
* @throws IOException
*/
public FILLSTYLE readFILLSTYLE(boolean inShape3) throws IOException {
FILLSTYLE ret = new FILLSTYLE();
ret.fillStyleType = readUI8();
if (ret.fillStyleType == FILLSTYLE.SOLID) {
if (ret.inShape3 = inShape3) {
ret.colorA = readRGBA();
} else {
ret.color = readRGB();
}
}
if ((ret.fillStyleType == FILLSTYLE.LINEAR_GRADIENT)
|| (ret.fillStyleType == FILLSTYLE.RADIAL_GRADIENT)
|| (ret.fillStyleType == FILLSTYLE.FOCAL_RADIAL_GRADIENT)) {
ret.gradientMatrix = readMatrix();
}
if ((ret.fillStyleType == FILLSTYLE.LINEAR_GRADIENT)
|| (ret.fillStyleType == FILLSTYLE.RADIAL_GRADIENT)) {
ret.gradient = readGRADIENT(inShape3);
}
if (ret.fillStyleType == FILLSTYLE.FOCAL_RADIAL_GRADIENT) {
ret.focalGradient = readFOCALGRADIENT(inShape3);
}
if ((ret.fillStyleType == FILLSTYLE.REPEATING_BITMAP)
|| (ret.fillStyleType == FILLSTYLE.CLIPPED_BITMAP)
|| (ret.fillStyleType == FILLSTYLE.NON_SMOOTHED_REPEATING_BITMAP)
|| (ret.fillStyleType == FILLSTYLE.NON_SMOOTHED_CLIPPED_BITMAP)) {
ret.bitmapId = readUI16();
ret.bitmapMatrix = readMatrix();
}
return ret;
}
/**
* Reads one FILLSTYLEARRAY value from the stream
*
* @return FILLSTYLEARRAY value
* @throws IOException
*/
public FILLSTYLEARRAY readFILLSTYLEARRAY(int shapeNum) throws IOException {
FILLSTYLEARRAY ret = new FILLSTYLEARRAY();
int fillStyleCount = readUI8();
if (((shapeNum == 2) || (shapeNum == 3)) && (fillStyleCount == 0xff)) {
fillStyleCount = readUI16();
}
ret.fillStyles = new FILLSTYLE[fillStyleCount];
for (int i = 0; i < fillStyleCount; i++) {
ret.fillStyles[i] = readFILLSTYLE(shapeNum == 3);
}
return ret;
}
/**
* Reads one LINESTYLE value from the stream
*
* @return LINESTYLE value
* @throws IOException
*/
public LINESTYLE readLINESTYLE(int shapeNum) throws IOException {
LINESTYLE ret = new LINESTYLE();
ret.width = readUI16();
if ((shapeNum == 1) || (shapeNum == 2)) {
ret.color = readRGB();
}
if (shapeNum == 3) {
ret.colorA = readRGBA();
}
return ret;
}
/**
* Reads one LINESTYLE2 value from the stream
*
* @return LINESTYLE2 value
* @throws IOException
*/
public LINESTYLE2 readLINESTYLE2(boolean inShape3) throws IOException {
LINESTYLE2 ret = new LINESTYLE2();
ret.width = readUI16();
ret.startCapStyle = (int) readUB(2);
ret.joinStyle = (int) readUB(2);
ret.hasFillFlag = (int) readUB(1) == 1;
ret.noHScaleFlag = (int) readUB(1) == 1;
ret.noVScaleFlag = (int) readUB(1) == 1;
ret.pixelHintingFlag = (int) readUB(1) == 1;
readUB(5);//reserved
ret.noClose = (int) readUB(1) == 1;
ret.endCapStyle = (int) readUB(2);
if (ret.joinStyle == LINESTYLE2.MITER_JOIN) {
ret.miterLimitFactor = readUI16();
}
if (!ret.hasFillFlag) {
ret.color = readRGBA();
} else {
ret.fillType = readFILLSTYLE(inShape3);
}
return ret;
}
/**
* Reads one LINESTYLEARRAY value from the stream
*
* @return LINESTYLEARRAY value
* @throws IOException
*/
public LINESTYLEARRAY readLINESTYLEARRAY(int shapeNum) throws IOException {
LINESTYLEARRAY ret = new LINESTYLEARRAY();
int lineStyleCount = readUI8();
if (lineStyleCount == 0xff) {
lineStyleCount = readUI16();
}
if ((shapeNum == 1 || shapeNum == 2 || shapeNum == 3)) {
ret.lineStyles = new LINESTYLE[lineStyleCount];
for (int i = 0; i < lineStyleCount; i++) {
ret.lineStyles[i] = readLINESTYLE(shapeNum);
}
} else if (shapeNum == 4) {
ret.lineStyles2 = new LINESTYLE2[lineStyleCount];
for (int i = 0; i < lineStyleCount; i++) {
ret.lineStyles2[i] = readLINESTYLE2(shapeNum == 3);
}
}
return ret;
}
/**
* Reads one SHAPERECORD value from the stream
*
* @return SHAPERECORD value
* @throws IOException
*/
public SHAPERECORD readSHAPERECORD(int fillBits, int lineBits, int shapeNum) throws IOException {
SHAPERECORD ret;
int typeFlag = (int) readUB(1);
if (typeFlag == 0) {
boolean stateNewStyles = readUB(1) == 1;
boolean stateLineStyle = readUB(1) == 1;
boolean stateFillStyle1 = readUB(1) == 1;
boolean stateFillStyle0 = readUB(1) == 1;
boolean stateMoveTo = readUB(1) == 1;
if ((!stateNewStyles) && (!stateLineStyle) && (!stateFillStyle1) && (!stateFillStyle0) && (!stateMoveTo)) {
ret = new EndShapeRecord();
} else {
StyleChangeRecord scr = new StyleChangeRecord();
scr.stateNewStyles = stateNewStyles;
scr.stateLineStyle = stateLineStyle;
scr.stateFillStyle0 = stateFillStyle0;
scr.stateFillStyle1 = stateFillStyle1;
scr.stateMoveTo = stateMoveTo;
if (stateMoveTo) {
scr.moveBits = (int) readUB(5);
scr.moveDeltaX = (int) readSB(scr.moveBits);
scr.moveDeltaY = (int) readSB(scr.moveBits);
}
if (stateFillStyle0) {
scr.fillStyle0 = (int) readUB(fillBits);
}
if (stateFillStyle1) {
scr.fillStyle1 = (int) readUB(fillBits);
}
if (stateLineStyle) {
scr.lineStyle = (int) readUB(lineBits);
}
if (stateNewStyles) {
scr.fillStyles = readFILLSTYLEARRAY(shapeNum);
scr.lineStyles = readLINESTYLEARRAY(shapeNum);
scr.numFillBits = (int) readUB(4);
scr.numLineBits = (int) readUB(4);
}
ret = scr;
}
} else {//typeFlag==1
int straightFlag = (int) readUB(1);
if (straightFlag == 1) {
StraightEdgeRecord ser = new StraightEdgeRecord();
ser.numBits = (int) readUB(4);
ser.generalLineFlag = readUB(1) == 1;
if (!ser.generalLineFlag) {
ser.vertLineFlag = readSB(1) == 1;
}
if (ser.generalLineFlag || (!ser.vertLineFlag)) {
ser.deltaX = (int) readSB(ser.numBits + 2);
}
if (ser.generalLineFlag || (ser.vertLineFlag)) {
ser.deltaY = (int) readSB(ser.numBits + 2);
}
ret = ser;
} else {
CurvedEdgeRecord cer = new CurvedEdgeRecord();
cer.numBits = (int) readUB(4);
cer.controlDeltaX = (int) readSB(cer.numBits + 2);
cer.controlDeltaY = (int) readSB(cer.numBits + 2);
cer.anchorDeltaX = (int) readSB(cer.numBits + 2);
cer.anchorDeltaY = (int) readSB(cer.numBits + 2);
ret = cer;
}
}
return ret;
}
/**
* Reads one SHAPE value from the stream
*
* @return SHAPE value
* @throws IOException
*/
public SHAPE readSHAPE(int shapeNum) throws IOException {
SHAPE ret = new SHAPE();
ret.numFillBits = (int) readUB(4);
ret.numLineBits = (int) readUB(4);
ret.shapeRecords = readSHAPERECORDS(shapeNum, ret.numFillBits, ret.numLineBits);
return ret;
}
/**
* Reads one SHAPEWITHSTYLE value from the stream
*
* @return SHAPEWITHSTYLE value
* @throws IOException
*/
public SHAPEWITHSTYLE readSHAPEWITHSTYLE(int shapeNum) throws IOException {
SHAPEWITHSTYLE ret = new SHAPEWITHSTYLE();
ret.fillStyles = readFILLSTYLEARRAY(shapeNum);
ret.lineStyles = readLINESTYLEARRAY(shapeNum);
ret.numFillBits = (int) readUB(4);
ret.numLineBits = (int) readUB(4);
ret.shapeRecords = readSHAPERECORDS(shapeNum, ret.numFillBits, ret.numLineBits);
return ret;
}
/**
* Reads list of SHAPERECORDs from the stream
*
* @return SHAPERECORDs array
* @throws IOException
*/
public List<SHAPERECORD> readSHAPERECORDS(int shapeNum, int fillBits, int lineBits) throws IOException {
List<SHAPERECORD> ret = new ArrayList<SHAPERECORD>();
SHAPERECORD rec;
do {
rec = readSHAPERECORD(fillBits, lineBits, shapeNum);
if (rec instanceof StyleChangeRecord) {
if (((StyleChangeRecord) rec).stateNewStyles) {
fillBits = ((StyleChangeRecord) rec).numFillBits;
lineBits = ((StyleChangeRecord) rec).numLineBits;
}
}
ret.add(rec);
} while (!(rec instanceof EndShapeRecord));
return ret;
}
@Override
public int available() throws IOException {
return is.available();
+194 -1
View File
@@ -537,7 +537,7 @@ public class SWFOutputStream extends OutputStream {
}
alignByte();
}
/**
* Writes CXFORMWITHALPHA value to the stream
*
@@ -674,6 +674,18 @@ public class SWFOutputStream extends OutputStream {
writeUI8(value.alpha);
}
/**
* Writes RGB value to the stream
*
* @param value RGB value
* @throws IOException
*/
public void writeRGB(RGB value) throws IOException {
writeUI8(value.red);
writeUI8(value.green);
writeUI8(value.blue);
}
/**
* Writes CONVOLUTIONFILTER value to the stream
*
@@ -955,4 +967,185 @@ public class SWFOutputStream extends OutputStream {
}
write(data);
}
/**
* Writes FILLSTYLE value to the stream
*
* @param value FILLSTYLE value
* @throws IOException
*/
public void writeFILLSTYLE(FILLSTYLE value, int shapeNum) throws IOException {
writeUI8(value.fillStyleType);
if (value.fillStyleType == FILLSTYLE.SOLID) {
if (shapeNum == 3) {
writeRGBA(value.colorA);
} else if (shapeNum == 1 || shapeNum == 2) {
writeRGB(value.color);
}
}
if ((value.fillStyleType == FILLSTYLE.LINEAR_GRADIENT)
|| (value.fillStyleType == FILLSTYLE.RADIAL_GRADIENT)
|| (value.fillStyleType == FILLSTYLE.FOCAL_RADIAL_GRADIENT)) {
writeMatrix(value.gradientMatrix);
}
if ((value.fillStyleType == FILLSTYLE.LINEAR_GRADIENT)
|| (value.fillStyleType == FILLSTYLE.RADIAL_GRADIENT)) {
writeGRADIENT(value.gradient, shapeNum);
}
if (value.fillStyleType == FILLSTYLE.FOCAL_RADIAL_GRADIENT) {
writeFOCALGRADIENT(value.focalGradient, shapeNum);
}
if ((value.fillStyleType == FILLSTYLE.REPEATING_BITMAP)
|| (value.fillStyleType == FILLSTYLE.CLIPPED_BITMAP)
|| (value.fillStyleType == FILLSTYLE.NON_SMOOTHED_REPEATING_BITMAP)
|| (value.fillStyleType == FILLSTYLE.NON_SMOOTHED_CLIPPED_BITMAP)) {
writeUI16(value.bitmapId);
writeMatrix(value.bitmapMatrix);
}
}
/**
* Writes FILLSTYLEARRAY value to the stream
*
* @param value FILLSTYLEARRAY value
* @throws IOException
*/
public void writeFILLSTYLEARRAY(FILLSTYLEARRAY value,int shapeNum) throws IOException {
int fillStyleCount=value.fillStyles.length;
if(shapeNum==2||shapeNum==3){
if(fillStyleCount>=0xff){
writeUI8(0xff);
writeUI16(fillStyleCount);
}else{
writeUI8(fillStyleCount);
}
}else{
writeUI8(fillStyleCount);
}
for (int i = 0; i < value.fillStyles.length; i++) {
writeFILLSTYLE(value.fillStyles[i], shapeNum);
}
}
/**
* Writes FOCALGRADIENT value to the stream
*
* @param value FILLSTYLEARRAY value
* @throws IOException
*/
public void writeFOCALGRADIENT(FOCALGRADIENT value, int shapeNum) throws IOException {
writeUB(2, value.spreadMode);
writeUB(2, value.interPolationMode);
writeUB(4, value.gradientRecords.length);
for (int i = 0; i < value.gradientRecords.length; i++) {
writeGRADRECORD(value.gradientRecords[i], shapeNum);
}
writeFIXED8(value.focalPoint);
}
/**
* Writes GRADIENT value to the stream
*
* @param value GRADIENT value
* @throws IOException
*/
public void writeGRADIENT(GRADIENT value, int shapeNum) throws IOException {
writeUB(2, value.spreadMode);
writeUB(2, value.interPolationMode);
writeUB(4, value.gradientRecords.length);
for (int i = 0; i < value.gradientRecords.length; i++) {
writeGRADRECORD(value.gradientRecords[i], shapeNum);
}
}
/**
* Writes GRADRECORD value to the stream
*
* @param value GRADRECORD value
* @throws IOException
*/
public void writeGRADRECORD(GRADRECORD value, int shapeNum) throws IOException {
writeUI8(value.ratio);
if (shapeNum == 1 || shapeNum == 2) {
writeRGB(value.color);
} else if (shapeNum == 3) {
writeRGBA(value.colorA);
}
}
/**
* Writes LINESTYLE value to the stream
*
* @param value LINESTYLE value
* @throws IOException
*/
public void writeLINESTYLE(LINESTYLE value, int shapeNum) throws IOException {
writeUI16(value.width);
if (shapeNum == 1 || shapeNum == 2) {
writeRGB(value.color);
} else if (shapeNum == 3) {
writeRGBA(value.colorA);
}
}
/**
* Writes LINESTYLE2 value to the stream
*
* @param value LINESTYLE2 value
* @throws IOException
*/
public void writeLINESTYLE2(LINESTYLE2 value,int shapeNum) throws IOException {
writeUI16(value.width);
writeUB(2, value.startCapStyle);
writeUB(2, value.joinStyle);
writeUB(1, value.hasFillFlag ? 1 : 0);
writeUB(1, value.noHScaleFlag ? 1 : 0);
writeUB(1, value.noVScaleFlag ? 1 : 0);
writeUB(1, value.pixelHintingFlag ? 1 : 0);
writeUB(5, 0);//reserved
writeUB(1, value.noClose ? 1 : 0);
writeUB(2, value.endCapStyle);
if (value.joinStyle == LINESTYLE2.MITER_JOIN) {
writeUI16(value.miterLimitFactor);
}
if (!value.hasFillFlag) {
writeRGBA(value.color);
} else {
writeFILLSTYLE(value.fillType,shapeNum);
}
}
/**
* Writes LINESTYLEARRAY value to the stream
*
* @param value FILLSTYLEARRAY value
* @throws IOException
*/
public void writeLINESTYLEARRAY(LINESTYLEARRAY value, int shapeNum) throws IOException {
int lineStyleCount;
if (shapeNum == 1 || shapeNum == 2 || shapeNum == 3) {
lineStyleCount = value.lineStyles.length;
if (lineStyleCount >= 0xff) {
writeUI8(0xff);
writeUI16(lineStyleCount);
} else {
writeUI8(lineStyleCount);
}
for (int i = 0; i < lineStyleCount; i++) {
writeLINESTYLE(value.lineStyles[i], shapeNum);
}
} else if (shapeNum == 4) {
lineStyleCount = value.lineStyles2.length;
if (lineStyleCount >= 0xff) {
writeUI8(0xff);
writeUI16(lineStyleCount);
} else {
writeUI8(lineStyleCount);
}
for (int i = 0; i < lineStyleCount; i++) {
writeLINESTYLE2(value.lineStyles2[i],shapeNum);
}
}
}
}
@@ -0,0 +1,77 @@
/*
* 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.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
*
*
* @author JPEXS
*/
public class DebugIDTag extends Tag {
public byte debugId[];
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
sos.write(debugId);
} catch (IOException e) {
}
return baos.toByteArray();
}
/**
* Constructor
*
* @param data Data bytes
* @param version SWF version
* @throws IOException
*/
public DebugIDTag(byte data[], int version, long pos) throws IOException {
super(63, data, pos);
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
debugId = sis.readBytes(16);
}
/**
* Returns string representation of the object
*
* @return String representation of the object
*/
@Override
public String toString() {
return "DebugID";
}
}
@@ -181,6 +181,6 @@ public class DefineButton2Tag extends Tag implements Container, TagName {
name = ": " + eat.assets.get((Integer) buttonId);
}
}
return "DefineButton2Tag (" + buttonId + name + ")";
return "DefineButton2 (" + buttonId + name + ")";
}
}
@@ -114,7 +114,7 @@ public class DefineButtonTag extends Tag implements ASMSource, TagName {
name = ": " + eat.assets.get((Integer) buttonId);
}
}
return "DefineButtonTag (" + buttonId + name + ")";
return "DefineButton (" + buttonId + name + ")";
}
/**
@@ -0,0 +1,75 @@
/*
* 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.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
*
*
* @author JPEXS
*/
public class DefineFontTag extends Tag {
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
/*try {
//sos.write
} catch (IOException e) {
}*/
return baos.toByteArray();
}
/**
* Constructor
*
* @param data Data bytes
* @param version SWF version
* @throws IOException
*/
public DefineFontTag(byte data[], int version, long pos) throws IOException {
super(10, data, pos);
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
}
/**
* Returns string representation of the object
*
* @return String representation of the object
*/
@Override
public String toString() {
return "DefineFont";
}
}
@@ -17,10 +17,16 @@
package com.jpexs.asdec.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import com.jpexs.asdec.types.RECT;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* @author JPEXS
*/
public class DefineScalingGridTag extends Tag {
private int characterId;
@@ -33,6 +39,25 @@ public class DefineScalingGridTag extends Tag {
splitter = sis.readRECT();
}
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
sos.writeUI16(characterId);
sos.writeRECT(splitter);
} catch (IOException e) {
}
return baos.toByteArray();
}
@Override
public String toString() {
return "DefineScalingGrid";
@@ -0,0 +1,103 @@
/*
* 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.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
*
*
* @author JPEXS
*/
public class DefineSceneAndFrameLabelDataTag extends Tag {
public long sceneOffsets[];
public String sceneNames[];
public long frameNums[];
public String frameNames[];
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
int sceneCount = sceneOffsets.length;
sos.writeEncodedU32(sceneCount);
for (int i = 0; i < sceneCount; i++) {
sos.writeEncodedU32(sceneOffsets[i]);
sos.writeString(sceneNames[i]);
}
int frameLabelCount = frameNums.length;
sos.writeEncodedU32(frameLabelCount);
for (int i = 0; i < frameLabelCount; i++) {
sos.writeEncodedU32(frameNums[i]);
sos.writeString(frameNames[i]);
}
} catch (IOException e) {
}
return baos.toByteArray();
}
/**
* Constructor
*
* @param data Data bytes
* @param version SWF version
* @throws IOException
*/
public DefineSceneAndFrameLabelDataTag(byte data[], int version, long pos) throws IOException {
super(86, data, pos);
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
int sceneCount = (int) sis.readEncodedU32();
sceneOffsets = new long[sceneCount];
sceneNames = new String[sceneCount];
for (int i = 0; i < sceneCount; i++) {
sceneOffsets[i] = sis.readEncodedU32();
sceneNames[i] = sis.readString();
}
int frameLabelCount = (int) sis.readEncodedU32();
for (int i = 0; i < frameLabelCount; i++) {
frameNums[i] = sis.readEncodedU32();
frameNames[i] = sis.readString();
}
}
/**
* Returns string representation of the object
*
* @return String representation of the object
*/
@Override
public String toString() {
return "DefineSceneAndFrameLabelData";
}
}
@@ -16,13 +16,22 @@
*/
package com.jpexs.asdec.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.types.RECT;
import com.jpexs.asdec.types.SHAPEWITHSTYLE;
import java.io.ByteArrayInputStream;
import java.io.IOException;
public class DefineShape2 extends Tag {
public int shapeId;
public RECT shapeBounds;
public SHAPEWITHSTYLE shapes;
public DefineShape2(byte[] data, int version, long pos) throws IOException {
super(22, data, pos);
// TODO Auto-generated constructor stub
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
shapeId=sis.readUI16();
shapeBounds=sis.readRECT();
shapes=sis.readSHAPEWITHSTYLE(2);
}
@Override
@@ -16,13 +16,24 @@
*/
package com.jpexs.asdec.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.types.RECT;
import com.jpexs.asdec.types.SHAPEWITHSTYLE;
import java.io.ByteArrayInputStream;
import java.io.IOException;
public class DefineShape3 extends Tag {
public int shapeId;
public RECT shapeBounds;
public SHAPEWITHSTYLE shapes;
public DefineShape3(byte[] data, int version, long pos) throws IOException {
super(32, data, pos);
// TODO Auto-generated constructor stub
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
shapeId = sis.readUI16();
shapeBounds = sis.readRECT();
shapes = sis.readSHAPEWITHSTYLE(3);
}
@Override
@@ -16,10 +16,33 @@
*/
package com.jpexs.asdec.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.types.RECT;
import com.jpexs.asdec.types.SHAPEWITHSTYLE;
import java.io.ByteArrayInputStream;
import java.io.IOException;
public class DefineShape4 extends Tag {
public DefineShape4(byte[] data, int version, long pos) {
public int shapeId;
public RECT shapeBounds;
public RECT edgeBounds;
public boolean usesFillWindingRule;
public boolean usesNonScalingStrokes;
public boolean usesScalingStrokes;
public SHAPEWITHSTYLE shapes;
public DefineShape4(byte[] data, int version, long pos) throws IOException {
super(83, data, pos);
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
shapeId=sis.readUI16();
shapeBounds=sis.readRECT();
edgeBounds=sis.readRECT();
sis.readUB(5);
usesFillWindingRule=sis.readUB(1)==1;
usesNonScalingStrokes=sis.readUB(1)==1;
usesScalingStrokes=sis.readUB(1)==1;
shapes=sis.readSHAPEWITHSTYLE(4);
}
@Override
@@ -16,13 +16,23 @@
*/
package com.jpexs.asdec.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.types.RECT;
import com.jpexs.asdec.types.SHAPEWITHSTYLE;
import java.io.ByteArrayInputStream;
import java.io.IOException;
public class DefineShapeTag extends Tag {
public int shapeId;
public RECT shapeBounds;
public SHAPEWITHSTYLE shapes;
public DefineShapeTag(byte[] data, int version, long pos) throws IOException {
super(2, data, pos);
// TODO Auto-generated constructor stub
super(2, data, pos);
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
shapeId=sis.readUI16();
shapeBounds=sis.readRECT();
shapes=sis.readSHAPEWITHSTYLE(1);
}
@Override
@@ -0,0 +1,75 @@
/*
* 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.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
*
*
* @author JPEXS
*/
public class DefineTextTag extends Tag {
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
/*try {
//sos.write
} catch (IOException e) {
}*/
return baos.toByteArray();
}
/**
* Constructor
*
* @param data Data bytes
* @param version SWF version
* @throws IOException
*/
public DefineTextTag(byte data[], int version, long pos) throws IOException {
super(11, data, pos);
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
}
/**
* Returns string representation of the object
*
* @return String representation of the object
*/
@Override
public String toString() {
return "DefineText";
}
}
@@ -100,7 +100,7 @@ public class DoActionTag extends Tag implements ASMSource {
*/
@Override
public String toString() {
return "DoActionTag";
return "DoAction";
}
public List<Action> getActions(int version) {
@@ -88,11 +88,11 @@ public class DoInitActionTag extends Tag implements ASMSource, TagName {
name = ": " + eat.assets.get((Integer) spriteId);
}
}
return "DoInitActionTag (" + spriteId + name + ")";
return "DoInitAction (" + spriteId + name + ")";
}
public String getName() {
return "DoInitActionTag" + spriteId;
return "DoInitAction" + spriteId;
}
/**
@@ -0,0 +1,81 @@
/*
* 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.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* Marks the file is not importable for editing
*
* @author JPEXS
*/
public class EnableDebugger2Tag extends Tag {
/**
* MD5 hash of password
*/
public String passwordHash;
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
sos.writeUI16(0);//reserved
sos.writeString(passwordHash);
} catch (IOException e) {
}
return baos.toByteArray();
}
/**
* Constructor
*
* @param data Data bytes
* @param version SWF version
* @throws IOException
*/
public EnableDebugger2Tag(byte data[], int version, long pos) throws IOException {
super(64, data, pos);
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
sis.readUI16(); //reserved
passwordHash = sis.readString();
}
/**
* Returns string representation of the object
*
* @return String representation of the object
*/
@Override
public String toString() {
return "EnableDebugger2";
}
}
@@ -0,0 +1,80 @@
/*
* 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.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* Marks the file is not importable for editing
*
* @author JPEXS
*/
public class EnableDebuggerTag extends Tag {
/**
* MD5 hash of password
*/
public String passwordHash;
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
if (passwordHash != null) {
sos.writeString(passwordHash);
}
} catch (IOException e) {
}
return baos.toByteArray();
}
/**
* Constructor
*
* @param data Data bytes
* @param version SWF version
* @throws IOException
*/
public EnableDebuggerTag(byte data[], int version, long pos) throws IOException {
super(58, data, pos);
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
passwordHash = sis.readString();
}
/**
* Returns string representation of the object
*
* @return String representation of the object
*/
@Override
public String toString() {
return "EnableDebugger";
}
}
@@ -0,0 +1,67 @@
/*
* 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.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
* Extends the functionality of the PlaceObject2Tag
*
* @author JPEXS
*/
public class EndTag extends Tag {
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
return new byte[0];
}
/**
* Constructor
*
* @param data Data bytes
* @param version SWF version
* @throws IOException
*/
public EndTag(byte data[], int version, long pos) throws IOException {
super(0, data, pos);
}
/**
* Returns string representation of the object
*
* @return String representation of the object
*/
@Override
public String toString() {
return "End";
}
}
@@ -17,8 +17,11 @@
package com.jpexs.asdec.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
/**
@@ -51,6 +54,28 @@ public class ExportAssetsTag extends Tag {
assets.put(characterId, name);
}
}
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
sos.writeUI16(assets.size());
for(int characterId:assets.keySet()){
sos.writeUI16(characterId);
sos.writeString(assets.get(characterId));
}
} catch (IOException e) {
}
return baos.toByteArray();
}
/**
* Returns string representation of the object
@@ -17,8 +17,11 @@
package com.jpexs.asdec.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class FileAttributesTag extends Tag {
@@ -40,6 +43,42 @@ public class FileAttributesTag extends Tag {
sis.readUB(2); // reserved
useNetwork = sis.readUB(1) != 0;
// UB[24] == 0 (reserved)
sis.readUB(24); //reserved
}
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
sos.writeUB(1, 0); //reserved
if(useDirectBlit){
sos.writeUB(1, 1);
}
if(useGPU){
sos.writeUB(1, 1);
}
if(hasMetadata){
sos.writeUB(1, 1);
}
if(actionScript3){
sos.writeUB(1, 1);
}
sos.writeUB(2, 0); //reserved
if(useNetwork){
sos.writeUB(1, 1);
}
sos.writeUB(24, 0); //reserved
} catch (IOException e) {
}
return baos.toByteArray();
}
@Override
@@ -17,21 +17,51 @@
package com.jpexs.asdec.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class FrameLabelTag extends Tag {
private String name;
private boolean namedAnchor = false;
public FrameLabelTag(byte[] data, int version, long pos) throws IOException {
super(43, data, pos);
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
name = sis.readString();
if (sis.available() > 0) {
if (sis.readUI8() == 1) {
namedAnchor = true;
}
}
}
@Override
public String toString() {
return "FrameLabel";
}
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
sos.writeString(name);
if (namedAnchor) {
sos.writeUI8(1);
}
} catch (IOException e) {
}
return baos.toByteArray();
}
}
@@ -0,0 +1,96 @@
/*
* 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.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
/**
* Imports characters from another file, v2
*
* @author JPEXS
*/
public class ImportAssets2Tag extends Tag {
public String url;
/**
* HashMap with assets
*/
public HashMap<Integer, String> assets;
/**
* Constructor
*
* @param data Data bytes
* @param version SWF version
* @throws IOException
*/
public ImportAssets2Tag(byte data[], int version, long pos) throws IOException {
super(57, data, pos);
assets = new HashMap<Integer, String>();
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
url = sis.readString();
sis.readUI8();//reserved, must be 1
sis.readUI8();//reserved, must be 0
int count = sis.readUI16();
for (int i = 0; i < count; i++) {
int characterId = sis.readUI16();
String name = sis.readString();
assets.put(characterId, name);
}
}
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
sos.writeString(url);
sos.writeUI8(1); //reserved
sos.writeUI8(0); //reserved
sos.writeUI16(assets.size());
for (int characterId : assets.keySet()) {
sos.writeUI16(characterId);
sos.writeString(assets.get(characterId));
}
} catch (IOException e) {
}
return baos.toByteArray();
}
/**
* Returns string representation of the object
*
* @return String representation of the object
*/
@Override
public String toString() {
return "ImportAssets2";
}
}
@@ -0,0 +1,92 @@
/*
* 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.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
/**
* Imports characters from another file
*
* @author JPEXS
*/
public class ImportAssetsTag extends Tag {
public String url;
/**
* HashMap with assets
*/
public HashMap<Integer, String> assets;
/**
* Constructor
*
* @param data Data bytes
* @param version SWF version
* @throws IOException
*/
public ImportAssetsTag(byte data[], int version, long pos) throws IOException {
super(57, data, pos);
assets = new HashMap<Integer, String>();
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
url = sis.readString();
int count = sis.readUI16();
for (int i = 0; i < count; i++) {
int characterId = sis.readUI16();
String name = sis.readString();
assets.put(characterId, name);
}
}
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
sos.writeString(url);
sos.writeUI16(assets.size());
for (int characterId : assets.keySet()) {
sos.writeUI16(characterId);
sos.writeString(assets.get(characterId));
}
} catch (IOException e) {
}
return baos.toByteArray();
}
/**
* Returns string representation of the object
*
* @return String representation of the object
*/
@Override
public String toString() {
return "ImportAssets";
}
}
@@ -16,20 +16,44 @@
*/
package com.jpexs.asdec.tags;
import java.io.UnsupportedEncodingException;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class MetadataTag extends Tag {
private String xmlMetadata;
public MetadataTag(byte[] data, long pos) {
super(77, data, pos);
public MetadataTag(byte[] data, int version, long pos) {
super(77, data, pos);
try {
xmlMetadata = new String(data, "UTF-8");
} catch (UnsupportedEncodingException e) {
//ignore
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
xmlMetadata = sis.readString();
} catch (IOException ex) {
}
}
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
sos.writeString(xmlMetadata);
} catch (IOException e) {
}
return baos.toByteArray();
}
@Override
public String toString() {
@@ -0,0 +1,36 @@
/*
* 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.tags;
/**
*
* @author JPEXS
*/
public class NotDefinedTag extends Tag {
private String name;
public NotDefinedTag(String name,int id, byte[] data, long pos) {
super(id, data, pos);
this.name=name;
}
@Override
public String toString() {
return name;
}
}
@@ -206,7 +206,7 @@ public class PlaceObject2Tag extends Tag implements Container {
*/
@Override
public String toString() {
return "PlaceObject2Tag";
return "PlaceObject2";
}
/**
@@ -294,7 +294,7 @@ public class PlaceObject3Tag extends Tag implements Container {
*/
@Override
public String toString() {
return "PlaceObject3Tag";
return "PlaceObject3";
}
/**
@@ -26,7 +26,7 @@ import java.io.IOException;
import java.io.OutputStream;
/**
* Extends the functionality of the PlaceObject2Tag
* Adds character to the display list
*
* @author JPEXS
*/
@@ -97,6 +97,6 @@ public class PlaceObjectTag extends Tag {
*/
@Override
public String toString() {
return "PlaceObjectTag";
return "PlaceObject";
}
}
@@ -0,0 +1,82 @@
/*
* 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.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* Marks the file is not importable for editing
*
* @author JPEXS
*/
public class ProtectTag extends Tag {
/**
* MD5 hash of password
*/
public String passwordHash;
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
if (passwordHash != null) {
sos.writeString(passwordHash);
}
} catch (IOException e) {
}
return baos.toByteArray();
}
/**
* Constructor
*
* @param data Data bytes
* @param version SWF version
* @throws IOException
*/
public ProtectTag(byte data[], int version, long pos) throws IOException {
super(24, data, pos);
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
if (sis.available() > 0) {
passwordHash = sis.readString();
}
}
/**
* Returns string representation of the object
*
* @return String representation of the object
*/
@Override
public String toString() {
return "Protect";
}
}
@@ -24,7 +24,7 @@ import java.io.IOException;
import java.io.OutputStream;
/**
* Extends the functionality of the PlaceObject2Tag
* Removes the specified character
*
* @author JPEXS
*/
@@ -79,6 +79,6 @@ public class RemoveObjectTag extends Tag {
*/
@Override
public String toString() {
return "RemoveObjectTag";
return "RemoveObject";
}
}
@@ -17,8 +17,11 @@
package com.jpexs.asdec.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class ScriptLimitsTag extends Tag {
@@ -32,6 +35,25 @@ public class ScriptLimitsTag extends Tag {
scriptTimeoutSeconds = sis.readUI16();
}
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
sos.writeUI16(maxRecursionDepth);
sos.writeUI16(scriptTimeoutSeconds);
} catch (IOException e) {
}
return baos.toByteArray();
}
@Override
public String toString() {
return "ScriptLimits";
@@ -0,0 +1,84 @@
/*
* 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.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* Sets the index of an object within the tab order.
*
* @author JPEXS
*/
public class SetTabIndexTag extends Tag {
/**
* Depth of character
*/
public int depth;
/**
* Tab order value
*/
public int tabIndex;
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
sos.writeUI16(depth);
sos.writeUI16(tabIndex);
} catch (IOException e) {
}
return baos.toByteArray();
}
/**
* Constructor
*
* @param data Data bytes
* @param version SWF version
* @throws IOException
*/
public SetTabIndexTag(byte data[], int version, long pos) throws IOException {
super(66, data, pos);
SWFInputStream sis = new SWFInputStream(new ByteArrayInputStream(data), version);
depth = sis.readUI16();
tabIndex = sis.readUI16();
}
/**
* Returns string representation of the object
*
* @return String representation of the object
*/
@Override
public String toString() {
return "";
}
}
+2 -2
View File
@@ -26,7 +26,7 @@ import java.util.ArrayList;
import java.util.List;
/**
* Extends the functionality of the PlaceObject2Tag
*
*
* @author JPEXS
*/
@@ -70,6 +70,6 @@ public class StubTag extends Tag {
*/
@Override
public String toString() {
return "PlaceObjectTag";
return "";
}
}
@@ -17,8 +17,11 @@
package com.jpexs.asdec.tags;
import com.jpexs.asdec.SWFInputStream;
import com.jpexs.asdec.SWFOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class SymbolClassTag extends Tag {
@@ -39,6 +42,29 @@ public class SymbolClassTag extends Tag {
}
}
/**
* Gets data bytes
*
* @param version SWF version
* @return Bytes of data
*/
@Override
public byte[] getData(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, version);
try {
int numSymbols = tagIDs.length;
sos.writeUI16(numSymbols);
for (int ii = 0; ii < numSymbols; ii++) {
sos.writeUI16(tagIDs[ii]);
sos.writeString(classNames[ii]);
}
} catch (IOException e) {
}
return baos.toByteArray();
}
@Override
public String toString() {
return "SymbolClass";
@@ -0,0 +1,43 @@
/*
* 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.types;
/**
*
* @author JPEXS
*/
public class FILLSTYLE {
public int fillStyleType;
public static final int SOLID=0x0;
public static final int LINEAR_GRADIENT=0x10;
public static final int RADIAL_GRADIENT=0x12;
public static final int FOCAL_RADIAL_GRADIENT=0x13;
public static final int REPEATING_BITMAP=0x40;
public static final int CLIPPED_BITMAP=0x41;
public static final int NON_SMOOTHED_REPEATING_BITMAP=0x42;
public static final int NON_SMOOTHED_CLIPPED_BITMAP=0x43;
public boolean inShape3;
public RGB color;
public RGBA colorA; //Shape3
public MATRIX gradientMatrix;
public GRADIENT gradient;
public FOCALGRADIENT focalGradient;
public int bitmapId;
public MATRIX bitmapMatrix;
}
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2010-2013 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.types;
/**
*
* @author JPEXS
*/
public class FILLSTYLEARRAY {
public FILLSTYLE fillStyles[];
}
@@ -0,0 +1,30 @@
/*
* 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.types;
/**
*
* @author JPEXS
*/
public class FOCALGRADIENT {
public int spreadMode;
public int interPolationMode;
public GRADRECORD gradientRecords[];
public float focalPoint;
}
@@ -0,0 +1,40 @@
/*
* 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.types;
/**
*
* @author JPEXS
*/
public class GRADIENT {
public int spreadMode;
public static final int SPREAD_PAD_MODE=0;
public static final int SPREAD_REFLECT_MODE=1;
public static final int SPREAD_REPAT_MODE=2;
public static final int SPREAD_RESERVED=3;
public int interPolationMode;
public static final int INTERPOLATION_RGB_MODE=0;
public static final int INTERPOLATION_LINEAR_RGB_MODE=1;
public static final int INTERPOLATION_RESERVED1=2;
public static final int INTERPOLATION_RESERVED2=3;
public GRADRECORD gradientRecords[];
}
@@ -0,0 +1,29 @@
/*
* 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.types;
/**
*
* @author JPEXS
*/
public class GRADRECORD {
public int ratio;
public boolean inShape3;
public RGB color;
public RGBA colorA;
}
@@ -0,0 +1,28 @@
/*
* 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.types;
/**
*
* @author JPEXS
*/
public class LINESTYLE {
public int width;
public RGB color;
public RGBA colorA;
}
@@ -0,0 +1,47 @@
/*
* 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.types;
/**
*
* @author JPEXS
*/
public class LINESTYLE2 {
public int width;
public int startCapStyle;
public int joinStyle;
public static final int ROUND_JOIN=0;
public static final int BEVEL_JOIN=1;
public static final int MITER_JOIN=2;
public boolean hasFillFlag;
public boolean noHScaleFlag;
public boolean noVScaleFlag;
public boolean pixelHintingFlag;
public boolean noClose;
public int endCapStyle;
public static final int ROUND_CAP=0;
public static final int NO_CAP=1;
public static final int SQUARE_CAP=2;
public int miterLimitFactor;
public RGBA color;
public FILLSTYLE fillType;
}
@@ -0,0 +1,26 @@
/*
* Copyright (C) 2010-2013 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.types;
/**
*
* @author JPEXS
*/
public class LINESTYLEARRAY {
public LINESTYLE lineStyles[];
public LINESTYLE2 lineStyles2[];
}
@@ -0,0 +1,30 @@
/*
* 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.types;
import com.jpexs.asdec.types.shaperecords.SHAPERECORD;
import java.util.List;
/**
*
* @author JPEXS
*/
public class SHAPE {
public int numFillBits;
public int numLineBits;
public List<SHAPERECORD> shapeRecords;
}
@@ -0,0 +1,32 @@
/*
* 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.types;
import com.jpexs.asdec.types.shaperecords.SHAPERECORD;
import java.util.List;
/**
*
* @author JPEXS
*/
public class SHAPEWITHSTYLE {
public FILLSTYLEARRAY fillStyles;
public LINESTYLEARRAY lineStyles;
public int numFillBits;
public int numLineBits;
public List<SHAPERECORD> shapeRecords;
}
@@ -0,0 +1,32 @@
/*
* 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.types.shaperecords;
/**
*
* @author JPEXS
*/
public class CurvedEdgeRecord implements SHAPERECORD{
public int typeFlag=1;
public int straightFlag=0;
public int numBits;
public int controlDeltaX;
public int controlDeltaY;
public int anchorDeltaX;
public int anchorDeltaY;
}
@@ -0,0 +1,26 @@
/*
* 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.types.shaperecords;
/**
*
* @author JPEXS
*/
public class EndShapeRecord implements SHAPERECORD{
public int typeFlag=0;
public int endOfShape=0;
}
@@ -0,0 +1,25 @@
/*
* 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.types.shaperecords;
/**
*
* @author JPEXS
*/
public interface SHAPERECORD {
}
@@ -0,0 +1,32 @@
/*
* 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.types.shaperecords;
/**
*
* @author JPEXS
*/
public class StraightEdgeRecord implements SHAPERECORD{
public int typeFlag=1;
public int straightFlag=1;
public int numBits;
public boolean generalLineFlag;
public boolean vertLineFlag;
public int deltaX;
public int deltaY;
}
@@ -0,0 +1,44 @@
/*
* 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.types.shaperecords;
import com.jpexs.asdec.types.FILLSTYLEARRAY;
import com.jpexs.asdec.types.LINESTYLEARRAY;
/**
*
* @author JPEXS
*/
public class StyleChangeRecord implements SHAPERECORD{
public int typeFlag=0;
public boolean stateNewStyles;
public boolean stateLineStyle;
public boolean stateFillStyle1;
public boolean stateFillStyle0;
public boolean stateMoveTo;
public int moveBits;
public int moveDeltaX;
public int moveDeltaY;
public int fillStyle0;
public int fillStyle1;
public int lineStyle;
public FILLSTYLEARRAY fillStyles;
public LINESTYLEARRAY lineStyles;
public int numFillBits;
public int numLineBits;
}