error handling added to flashplayer + cleanup

This commit is contained in:
Honfika
2014-02-05 21:10:09 +01:00
39 changed files with 528 additions and 7 deletions

View File

@@ -1548,19 +1548,19 @@ public class SWFInputStream extends InputStream {
int NScaleBits = (int) readUB(5);
ret.scaleX = (int) readSB(NScaleBits);
ret.scaleY = (int) readSB(NScaleBits);
ret.bitsScale = NScaleBits;
ret.nScaleBits = NScaleBits;
}
ret.hasRotate = readUB(1) == 1;
if (ret.hasRotate) {
int NRotateBits = (int) readUB(5);
ret.rotateSkew0 = (int) readSB(NRotateBits);
ret.rotateSkew1 = (int) readSB(NRotateBits);
ret.bitsRotate = NRotateBits;
ret.nRotateBits = NRotateBits;
}
int NTranslateBits = (int) readUB(5);
ret.translateX = (int) readSB(NTranslateBits);
ret.translateY = (int) readSB(NTranslateBits);
ret.bitsTranslate = NTranslateBits;
ret.nTranslateBits = NTranslateBits;
alignByte();
return ret;
}

View File

@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import java.awt.Color;
/**
@@ -28,18 +29,22 @@ public class ARGB {
/**
* Alpha value defining opacity
*/
@SWFType(BasicType.UI8)
public int alpha;
/**
* Red color value
*/
@SWFType(BasicType.UI8)
public int red;
/**
* Green color value
*/
@SWFType(BasicType.UI8)
public int green;
/**
* Blue color value
*/
@SWFType(BasicType.UI8)
public int blue;
@Override

View File

@@ -25,6 +25,9 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.tags.base.ContainerItem;
import com.jpexs.decompiler.flash.tags.base.Exportable;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.Internal;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.MemoryInputStream;
@@ -80,6 +83,7 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem {
/**
* Is this BUTTONCONDACTION last in the list?
*/
@Internal
public boolean isLast;
/**
* Idle to OverDown
@@ -116,6 +120,8 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem {
/**
* @since SWF 4 key code
*/
@SWFType(value=BasicType.UB,count=7)
@Conditional(minSwfVersion=4)
public int condKeyPress;
/**
* OverDown to Idle
@@ -128,6 +134,7 @@ public class BUTTONCONDACTION implements ASMSource, Exportable, ContainerItem {
/**
* Actions to perform in byte array
*/
@Internal
public byte[] actionBytes;
/**

View File

@@ -16,6 +16,9 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.tags.DefineButton2Tag;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import com.jpexs.decompiler.flash.types.filters.FILTER;
import java.util.List;
@@ -53,10 +56,12 @@ public class BUTTONRECORD {
/**
* ID of character to place
*/
@SWFType(BasicType.UI16)
public int characterId;
/**
* Depth at which to place character
*/
@SWFType(BasicType.UI16)
public int placeDepth;
/**
* Transformation matrix for character placement
@@ -74,6 +79,8 @@ public class BUTTONRECORD {
/**
* If within DefineButton2Tag and buttonHasBlendMode: Blend mode
*/
@SWFType(BasicType.UI8)
@Conditional(value={"buttonHasBlendMode"},tags={DefineButton2Tag.ID})
public int blendMode;
@Override

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2014 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.decompiler.flash.types;
/**
*
* @author JPEXS
*/
public enum BasicType {
UI8,
UI16,
UI32,
SI8,
SI16,
SI32,
UB,
SB,
FB,
FLOAT,
FLOAT16,
FIXED,
FIXED8,
NONE
}

View File

@@ -25,6 +25,8 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.tags.base.ContainerItem;
import com.jpexs.decompiler.flash.tags.base.Exportable;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.Internal;
import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.MemoryInputStream;
@@ -85,8 +87,11 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem {
"<Space>"
};
@Internal
private final SWF swf;
@Internal
private long pos;
@Internal
private long hdrPos;
public CLIPACTIONRECORD(SWF swf, InputStream is, int version, long pos) throws IOException {
@@ -123,11 +128,13 @@ public class CLIPACTIONRECORD implements ASMSource, Exportable, ContainerItem {
/**
* If EventFlags contain ClipEventKeyPress: Key code to trap
*/
@Conditional("eventFlags.clipEventKeyPress")
public int keyCode;
/**
* Actions to perform
*/
//public List<Action> actions;
@Internal
public byte[] actionBytes;
/**

View File

@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.helpers.Helper;
import java.util.ArrayList;
import java.util.List;
@@ -62,30 +63,37 @@ public class CLIPEVENTFLAGS {
/**
* @since SWF 6 Mouse drag over event
*/
@Conditional(minSwfVersion=6)
public boolean clipEventDragOver;
/**
* @since SWF 6 Mouse rollout event
*/
@Conditional(minSwfVersion=6)
public boolean clipEventRollOut;
/**
* @since SWF 6 Mouse rollover event
*/
@Conditional(minSwfVersion=6)
public boolean clipEventRollOver;
/**
* @since SWF 6 Mouse release outside event
*/
@Conditional(minSwfVersion=6)
public boolean clipEventReleaseOutside;
/**
* @since SWF 6 Mouse release inside event
*/
@Conditional(minSwfVersion=6)
public boolean clipEventRelease;
/**
* @since SWF 6 Mouse press event
*/
@Conditional(minSwfVersion=6)
public boolean clipEventPress;
/**
* @since SWF 6 Initialize event
*/
@Conditional(minSwfVersion=6)
public boolean clipEventInitialize;
/**
* Data received event
@@ -94,14 +102,17 @@ public class CLIPEVENTFLAGS {
/**
* @since SWF 7 Construct event
*/
@Conditional(minSwfVersion=7)
public boolean clipEventConstruct = false;
/**
* @since SWF 6 Key press event
*/
@Conditional(minSwfVersion=6)
public boolean clipEventKeyPress = false;
/**
* @since SWF 6 Mouse drag out event
*/
@Conditional(minSwfVersion=6)
public boolean clipEventDragOut = false;
public String getHeader(int key, boolean asFileName) {

View File

@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import com.jpexs.decompiler.flash.types.filters.Filtering;
import com.jpexs.helpers.SerializableImage;
@@ -35,30 +36,37 @@ public class CXFORM {
* Has color multiply values
*/
public boolean hasMultTerms;
@SWFType(value=BasicType.UB,count=4)
public int nbits;
/**
* Red multiply value
*/
@SWFType(value=BasicType.SB,countField="nbits")
public int redMultTerm;
/**
* Green multiply value
*/
@SWFType(value=BasicType.SB,countField="nbits")
public int greenMultTerm;
/**
* Blue multiply value
*/
@SWFType(value=BasicType.SB,countField="nbits")
public int blueMultTerm;
/**
* Red addition value
*/
@SWFType(value=BasicType.SB,countField="nbits")
public int redAddTerm;
/**
* Green addition value
*/
@SWFType(value=BasicType.SB,countField="nbits")
public int greenAddTerm;
/**
* Blue addition value
*/
@SWFType(value=BasicType.SB,countField="nbits")
public int blueAddTerm;
public SerializableImage apply(SerializableImage src) {

View File

@@ -16,6 +16,8 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import com.jpexs.decompiler.flash.types.filters.Filtering;
import com.jpexs.helpers.SerializableImage;
@@ -38,35 +40,53 @@ public class CXFORMWITHALPHA {
/**
* Red multiply value
*/
@Conditional("hasMultTerms")
@SWFType(value=BasicType.SB,countField="nbits")
public int redMultTerm;
/**
* Green multiply value
*/
@Conditional("hasMultTerms")
@SWFType(value=BasicType.SB,countField="nbits")
public int greenMultTerm;
/**
* Blue multiply value
*/
@Conditional("hasMultTerms")
@SWFType(value=BasicType.SB,countField="nbits")
public int blueMultTerm;
/**
* Alpha multiply value
*/
@Conditional("hasMultTerms")
@SWFType(value=BasicType.SB,countField="nbits")
public int alphaMultTerm;
/**
* Red addition value
*/
@Conditional("hasAddTerms")
@SWFType(value=BasicType.SB,countField="nbits")
public int redAddTerm;
/**
* Green addition value
*/
@Conditional("hasAddTerms")
@SWFType(value=BasicType.SB,countField="nbits")
public int greenAddTerm;
/**
* Blue addition value
*/
@Conditional("hasAddTerms")
@SWFType(value=BasicType.SB,countField="nbits")
public int blueAddTerm;
/**
* Alpha addition value
*/
@Conditional("hasAddTerms")
@SWFType(value=BasicType.SB,countField="nbits")
public int alphaAddTerm;
@SWFType(value=BasicType.UB, count=4)
public int nbits;
public SerializableImage apply(SerializableImage src) {

View File

@@ -16,7 +16,12 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.tags.DefineShape3Tag;
import com.jpexs.decompiler.flash.tags.base.NeedsCharacters;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.ConditionalType;
import com.jpexs.decompiler.flash.types.annotations.Internal;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import java.util.HashSet;
import java.util.Set;
@@ -26,6 +31,7 @@ import java.util.Set;
*/
public class FILLSTYLE implements NeedsCharacters {
@SWFType(BasicType.UI8)
public int fillStyleType;
public static final int SOLID = 0x0;
public static final int LINEAR_GRADIENT = 0x10;
@@ -35,11 +41,22 @@ public class FILLSTYLE implements NeedsCharacters {
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;
@Internal
public boolean inShape3;
@ConditionalType(type = RGBA.class,tags = DefineShape3Tag.ID)
public RGB color;
@Conditional(value="fillStyleType",options={LINEAR_GRADIENT,RADIAL_GRADIENT,FOCAL_RADIAL_GRADIENT})
public MATRIX gradientMatrix;
@Conditional(value="fillStyleType",options={LINEAR_GRADIENT,RADIAL_GRADIENT,FOCAL_RADIAL_GRADIENT})
@ConditionalType(value="fillStyleType",type=FOCALGRADIENT.class, options={FOCAL_RADIAL_GRADIENT})
public GRADIENT gradient;
@Conditional(value="fillStyleType",options={REPEATING_BITMAP,CLIPPED_BITMAP,NON_SMOOTHED_REPEATING_BITMAP,NON_SMOOTHED_CLIPPED_BITMAP})
public int bitmapId;
@Conditional(value="fillStyleType",options={REPEATING_BITMAP,CLIPPED_BITMAP,NON_SMOOTHED_REPEATING_BITMAP,NON_SMOOTHED_CLIPPED_BITMAP})
public MATRIX bitmapMatrix;
@Override

View File

@@ -16,11 +16,14 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
*
* @author JPEXS
*/
public class FOCALGRADIENT extends GRADIENT {
@SWFType(BasicType.FIXED8)
public float focalPoint;
}

View File

@@ -16,13 +16,17 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
*
* @author JPEXS
*/
public class GLYPHENTRY {
@SWFType(value=BasicType.UB,countField="+glyphBits")
public int glyphIndex;
@SWFType(value=BasicType.SB,countField="advanceBits")
public int glyphAdvance;
@Override

View File

@@ -16,6 +16,8 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
*
* @author JPEXS
@@ -25,6 +27,7 @@ public class GRADIENT {
/**
* Spread mode
*/
@SWFType(value=BasicType.UB,count=2)
public int spreadMode;
public static final int SPREAD_PAD_MODE = 0;
public static final int SPREAD_REFLECT_MODE = 1;
@@ -33,6 +36,7 @@ public class GRADIENT {
/**
* Interpolation mode
*/
@SWFType(value=BasicType.UB,count=2)
public int interpolationMode;
public static final int INTERPOLATION_RGB_MODE = 0;
public static final int INTERPOLATION_LINEAR_RGB_MODE = 1;

View File

@@ -16,13 +16,19 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.Internal;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
*
* @author JPEXS
*/
public class GRADRECORD {
@SWFType(BasicType.UI8)
public int ratio;
@Internal
public boolean inShape3;
public RGB color;

View File

@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import java.awt.Font;
import java.awt.font.GlyphVector;
import java.awt.font.TextAttribute;
@@ -31,8 +32,13 @@ import javax.swing.JPanel;
*/
public class KERNINGRECORD {
@SWFType(value=BasicType.UI8,alternateValue = BasicType.UI16, alternateCondition = "fontFlagsWideCodes")
public int fontKerningCode1;
@SWFType(value=BasicType.UI8,alternateValue = BasicType.UI16, alternateCondition = "fontFlagsWideCodes")
public int fontKerningCode2;
@SWFType(BasicType.SI16)
public int fontKerningAdjustment;
@Override

View File

@@ -16,12 +16,15 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
*
* @author JPEXS
*/
public class LANGCODE {
@SWFType(BasicType.UI8)
public int languageCode;
public LANGCODE() {
@@ -30,4 +33,11 @@ public class LANGCODE {
public LANGCODE(int languageCode) {
this.languageCode = languageCode;
}
@Override
public String toString() {
return "[LANGCODE:"+languageCode+"]";
}
}

View File

@@ -16,12 +16,20 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.tags.DefineShape3Tag;
import com.jpexs.decompiler.flash.tags.DefineShape4Tag;
import com.jpexs.decompiler.flash.types.annotations.ConditionalType;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
*
* @author JPEXS
*/
public class LINESTYLE {
@SWFType(BasicType.UI16)
public int width;
@ConditionalType(tags = {DefineShape3Tag.ID,DefineShape4Tag.ID}, type=RGBA.class)
public RGB color;
}

View File

@@ -16,13 +16,18 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
*
* @author JPEXS
*/
public class LINESTYLE2 extends LINESTYLE {
@SWFType(value=BasicType.UB,count = 2)
public int startCapStyle;
@SWFType(value=BasicType.UB,count = 2)
public int joinStyle;
public static final int ROUND_JOIN = 0;
public static final int BEVEL_JOIN = 1;
@@ -32,10 +37,14 @@ public class LINESTYLE2 extends LINESTYLE {
public boolean noVScaleFlag;
public boolean pixelHintingFlag;
public boolean noClose;
@SWFType(value=BasicType.UB,count = 2)
public int endCapStyle;
public static final int ROUND_CAP = 0;
public static final int NO_CAP = 1;
public static final int SQUARE_CAP = 2;
@SWFType(BasicType.UI16)
@Conditional(value="joinStyle",options = MITER_JOIN)
public int miterLimitFactor;
public FILLSTYLE fillType;
}

View File

@@ -16,6 +16,8 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import java.awt.Point;
import java.io.Serializable;
@@ -34,10 +36,14 @@ public class MATRIX implements Serializable {
/**
* X scale value
*/
@Conditional("hasScale")
@SWFType(value=BasicType.FB,countField = "nScaleBits")
public int scaleX;
/**
* Y scale value
*/
@Conditional("hasScale")
@SWFType(value=BasicType.FB,countField = "nScaleBits")
public int scaleY;
/**
* Has rotate and skew values
@@ -46,23 +52,35 @@ public class MATRIX implements Serializable {
/**
* First rotate and skew value
*/
@Conditional("hasRotate")
@SWFType(value=BasicType.FB,countField = "nRotateBits")
public int rotateSkew0;
/**
* Second rotate and skew value
*/
@Conditional("hasRotate")
@SWFType(value=BasicType.FB,countField = "nRotateBits")
public int rotateSkew1;
/**
* X translate value in twips
*/
@SWFType(value=BasicType.SB,countField = "nTranslateBits")
public int translateX;
/**
* Y translate value in twips
*/
@SWFType(value=BasicType.SB,countField = "nTranslateBits")
public int translateY;
public int bitsTranslate;
public int bitsRotate;
public int bitsScale;
@SWFType(value=BasicType.UB,count = 5)
public int nTranslateBits;
@SWFType(value=BasicType.UB,count = 5)
public int nRotateBits;
@SWFType(value=BasicType.UB,count = 5)
public int nScaleBits;
public MATRIX() {
}

View File

@@ -17,6 +17,8 @@
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.tags.base.NeedsCharacters;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import java.util.HashSet;
import java.util.Set;
@@ -26,7 +28,9 @@ import java.util.Set;
*/
public class MORPHFILLSTYLE implements NeedsCharacters {
@SWFType(BasicType.UI8)
public int fillStyleType;
public static final int SOLID = 0x0;
public static final int LINEAR_GRADIENT = 0x10;
public static final int RADIAL_GRADIENT = 0x12;
@@ -34,13 +38,29 @@ public class MORPHFILLSTYLE implements NeedsCharacters {
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;
@Conditional(value="fillStyleType",options = {SOLID})
public RGBA startColor;
@Conditional(value="fillStyleType",options = {SOLID})
public RGBA endColor;
@Conditional(value="fillStyleType",options = {LINEAR_GRADIENT,RADIAL_GRADIENT})
public MATRIX startGradientMatrix;
@Conditional(value="fillStyleType",options = {LINEAR_GRADIENT,RADIAL_GRADIENT})
public MATRIX endGradientMatrix;
@Conditional(value="fillStyleType",options = {LINEAR_GRADIENT,RADIAL_GRADIENT})
public MORPHGRADIENT gradient;
@Conditional(value="fillStyleType",options = {CLIPPED_BITMAP,NON_SMOOTHED_REPEATING_BITMAP,NON_SMOOTHED_CLIPPED_BITMAP})
public int bitmapId;
@Conditional(value="fillStyleType",options = {CLIPPED_BITMAP,NON_SMOOTHED_REPEATING_BITMAP,NON_SMOOTHED_CLIPPED_BITMAP})
public MATRIX startBitmapMatrix;
@Conditional(value="fillStyleType",options = {CLIPPED_BITMAP,NON_SMOOTHED_REPEATING_BITMAP,NON_SMOOTHED_CLIPPED_BITMAP})
public MATRIX endBitmapMatrix;
@Override

View File

@@ -16,6 +16,9 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.Internal;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
*
* @author JPEXS
@@ -25,12 +28,17 @@ public class MORPHGRADIENT {
/**
* Spread mode. See GRADIENT.SPREAD_* constants
*/
@SWFType(value=BasicType.UB,count=2)
public int spreadMode;
/**
* Interpolation mode. See GRADIENT.INTERPOLATION_* constants
*/
@SWFType(value=BasicType.UB,count=2)
public int interPolationMode;
@Internal
public int numGradients;
public MORPHGRADRECORD[] gradientRecords;
public static RGBA morphColor(RGBA c1, RGBA c2, int ratio) {

View File

@@ -16,15 +16,22 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
*
* @author JPEXS
*/
public class MORPHGRADRECORD {
@SWFType(BasicType.UI8)
public int startRatio;
public RGBA startColor;
@SWFType(BasicType.UI8)
public int endRatio;
public RGBA endColor;
public GRADRECORD getStartRecord() {

View File

@@ -16,13 +16,17 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
*
* @author JPEXS
*/
public class MORPHLINESTYLE {
@SWFType(BasicType.UI16)
public int startWidth;
@SWFType(BasicType.UI16)
public int endWidth;
public RGBA startColor;
public RGBA endColor;

View File

@@ -16,15 +16,22 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
*
* @author JPEXS
*/
public class MORPHLINESTYLE2 {
@SWFType(BasicType.UI16)
public int startWidth;
@SWFType(BasicType.UI16)
public int endWidth;
@SWFType(value=BasicType.UB,count = 2)
public int startCapStyle;
@SWFType(value=BasicType.UB,count = 2)
public int joinStyle;
public static final int ROUND_JOIN = 0;
public static final int BEVEL_JOIN = 1;
@@ -34,13 +41,25 @@ public class MORPHLINESTYLE2 {
public boolean noVScaleFlag;
public boolean pixelHintingFlag;
public boolean noClose;
@SWFType(value=BasicType.UB,count = 2)
public int endCapStyle;
public static final int ROUND_CAP = 0;
public static final int NO_CAP = 1;
public static final int SQUARE_CAP = 2;
@SWFType(value=BasicType.UI16)
@Conditional(value="joinStyle",options = {MITER_JOIN})
public int miterLimitFactor;
@Conditional(value="hasFillFlag",revert = true)
public RGBA startColor;
@Conditional(value="hasFillFlag",revert = true)
public RGBA endColor;
@Conditional(value="hasFillFlag")
public MORPHFILLSTYLE fillType;
public LINESTYLE2 getLineStyle2At(int ratio) {

View File

@@ -16,6 +16,8 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
* Represents 15-bit red, green and blue value
*
@@ -26,13 +28,16 @@ public class PIX15 {
/**
* Red color value
*/
@SWFType(value=BasicType.UB, count = 5)
public int red;
/**
* Green color value
*/
@SWFType(value=BasicType.UB, count = 5)
public int green;
/**
* Blue color value
*/
@SWFType(value=BasicType.UB, count = 5)
public int blue;
}

View File

@@ -16,6 +16,9 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.Reserved;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
* Represents 15-bit red, green and blue value
*
@@ -23,18 +26,23 @@ package com.jpexs.decompiler.flash.types;
*/
public class PIX24 {
@SWFType(BasicType.UI8)
@Reserved
public int reserved;
/**
* Red color value
*/
@SWFType(BasicType.UI8)
public int red;
/**
* Green color value
*/
@SWFType(BasicType.UI8)
public int green;
/**
* Blue color value
*/
@SWFType(BasicType.UI8)
public int blue;
@Override

View File

@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import java.awt.Point;
import java.io.Serializable;
@@ -29,19 +30,28 @@ public class RECT implements Serializable {
/**
* X minimum position for rectangle in twips
*/
@SWFType(value=BasicType.SB, countField = "nbits")
public int Xmin;
/**
* X maximum position for rectangle in twips
*/
@SWFType(value=BasicType.SB, countField = "nbits")
public int Xmax;
/**
* Y minimum position for rectangle in twips
*/
@SWFType(value=BasicType.SB, countField = "nbits")
public int Ymin;
/**
* Y maximum position for rectangle in twips
*/
@SWFType(value=BasicType.SB, countField = "nbits")
public int Ymax;
@SWFType(value=BasicType.UB, count = 5)
public int nbits;
public RECT(int Xmin, int Xmax, int Ymin, int Ymax) {

View File

@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import java.awt.Color;
/**
@@ -28,14 +29,17 @@ public class RGB {
/**
* Red color value
*/
@SWFType(BasicType.UI8)
public int red;
/**
* Green color value
*/
@SWFType(BasicType.UI8)
public int green;
/**
* Blue color value
*/
@SWFType(BasicType.UI8)
public int blue;
public RGB(int red, int green, int blue) {

View File

@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import java.awt.Color;
/**
@@ -28,6 +29,7 @@ public class RGBA extends RGB {
/**
* Alpha value defining opacity
*/
@SWFType(BasicType.UI8)
public int alpha;
public float getAlphaFloat() {

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.tags.base.NeedsCharacters;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
import java.util.HashSet;
import java.util.List;
@@ -28,7 +29,9 @@ import java.util.Set;
*/
public class SHAPE implements NeedsCharacters {
@SWFType(value=BasicType.UB, count=4)
public int numFillBits;
@SWFType(value=BasicType.UB, count=4)
public int numLineBits;
public List<SHAPERECORD> shapeRecords;

View File

@@ -16,13 +16,18 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
*
* @author JPEXS
*/
public class SOUNDENVELOPE {
@SWFType(BasicType.UI32)
public long pos44;
@SWFType(BasicType.UI16)
public int leftLevel;
@SWFType(BasicType.UI16)
public int rightLevel;
}

View File

@@ -16,6 +16,9 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
*
* @author JPEXS
@@ -28,8 +31,19 @@ public class SOUNDINFO {
public boolean hasLoops;
public boolean hasOutPoint;
public boolean hasInPoint;
@Conditional("hasInPoint")
@SWFType(BasicType.UI32)
public long inPoint;
@Conditional("hasOutPoint")
@SWFType(BasicType.UI32)
public long outPoint;
@Conditional("hasLoops")
@SWFType(BasicType.UI16)
public int loopCount;
@Conditional("hasEnvelope")
public SOUNDENVELOPE[] envelopeRecords = new SOUNDENVELOPE[0];
}

View File

@@ -16,8 +16,12 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.tags.DefineText2Tag;
import com.jpexs.decompiler.flash.tags.DefineTextTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.FontTag;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import java.util.List;
/**
@@ -30,12 +34,29 @@ public class TEXTRECORD {
public boolean styleFlagsHasColor;
public boolean styleFlagsHasYOffset;
public boolean styleFlagsHasXOffset;
@Conditional("styleFlagsHasFont")
@SWFType(BasicType.UI16)
public int fontId;
@Conditional(value="styleFlagsHasColor", tags = {DefineTextTag.ID})
public RGB textColor;
@Conditional(value="styleFlagsHasColor", tags = {DefineText2Tag.ID})
public RGBA textColorA;
@Conditional("styleFlagsHasXOffset")
@SWFType(BasicType.SI16)
public int xOffset;
@Conditional("styleFlagsHasYOffset")
@SWFType(BasicType.SI16)
public int yOffset;
@Conditional("styleFlagsHasFont")
@SWFType(BasicType.UI16)
public int textHeight;
public GLYPHENTRY[] glyphEntries;
public String getText(List<Tag> tags, FontTag font) {

View File

@@ -16,6 +16,8 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
/**
* Represents 32-bit alpha, red, green and blue value
*
@@ -23,7 +25,9 @@ package com.jpexs.decompiler.flash.types;
*/
public class ZONEDATA {
@SWFType(BasicType.FLOAT16)
public int alignmentCoordinate;
@SWFType(BasicType.FLOAT16)
public int range;
@Override

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2014 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.decompiler.flash.types.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Mark for field that it is available only whern certain field (value) is set
* @author JPEXS
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Conditional {
///Name of field on which this depends
String[] value() default {};
///Tag IDs which this field must be in
int[] tags() default {};
///Minimum SWF version for this field
int minSwfVersion() default 1;
///Maximum SWF version for this field
int maxSwfVersion() default Integer.MAX_VALUE;
///List of values for condition (if true/false is not enough)
int[] options() default {};
///Revert condition (if false...)
boolean revert() default false;
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2014 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.decompiler.flash.types.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Mark for field that its type is different whern certain field (value) is set
* @author JPEXS
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ConditionalType {
///Name of field on which this depends
String[] value() default {};
///Tag IDs which this field must be in
int[] tags() default {};
///Minimum SWF version for this field
int minSwfVersion() default 1;
///Maximum SWF version for this field
int maxSwfVersion() default Integer.MAX_VALUE;
///List of values for condition (if true/false is not enough)
int[] options() default {};
///Revert condition (if false...)
boolean revert() default false;
///Field type when condition is met
Class type();
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (C) 2014 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.decompiler.flash.types.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Field is internal
* @author JPEXS
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Internal {
}

View File

@@ -0,0 +1,32 @@
/*
* Copyright (C) 2014 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.decompiler.flash.types.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Field is reserved
* @author JPEXS
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Reserved {
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2014 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.decompiler.flash.types.annotations;
import com.jpexs.decompiler.flash.types.BasicType;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Maps basic java types (int,float,double) to SWF types (UI8,UI16...FLOAT)
* @author JPEXS
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface SWFType {
/// Type of value
BasicType value();
/// Alternate type when condition is met
BasicType alternateValue() default BasicType.NONE;
/// Condition for alternate type
String alternateCondition() default "";
/// Count - used primarily for bit fields UB,SB,FB to specify number of bits
int count() default 1;
/// Field name on which Count depends
String countField() default "";
}