From 499f3cc050791dff9ea340e986bb09ebd6d8eca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Tue, 6 Aug 2024 03:55:30 +0200 Subject: [PATCH] Timeline package documentation. --- .../decompiler/flash/timeline/AS2Package.java | 81 +++++++++- .../decompiler/flash/timeline/AS3Package.java | 148 +++++++++++++++++- .../jpexs/decompiler/flash/timeline/Clip.java | 8 +- .../decompiler/flash/timeline/DepthState.java | 125 ++++++++++++++- .../decompiler/flash/timeline/Frame.java | 97 +++++++++++- .../flash/timeline/FrameScript.java | 33 +++- .../decompiler/flash/timeline/Scene.java | 54 ++++++- .../decompiler/flash/timeline/SceneFrame.java | 48 +++++- .../flash/timeline/SoundStreamFrameRange.java | 120 +++++++++++++- .../decompiler/flash/timeline/SvgClip.java | 13 +- .../decompiler/flash/timeline/TagScript.java | 50 +++++- .../flash/timeline/TweenDetector.java | 4 +- .../decompiler/flash/timeline/TweenRange.java | 8 +- 13 files changed, 763 insertions(+), 26 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS2Package.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS2Package.java index 40d37378a..bc44331c3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS2Package.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS2Package.java @@ -26,25 +26,54 @@ import java.util.Map; import java.util.TreeMap; /** - * + * ActionScript 2 package TreeItem. * @author JPEXS */ public class AS2Package implements TreeItem { + /** + * SWF this package resides in. + */ private final SWF swf; + /** + * Name. + */ private final String name; + /** + * Parent package. + */ private final AS2Package parent; + /** + * Subpackges. + */ public Map subPackages = new TreeMap<>(); + /** + * Scripts in this package. + */ public Map scripts = new TreeMap<>(); - private boolean flat; + /** + * Whether the package is flat = in the format "mypkg.sub1.sub2" instead of "sub1". + */ + private final boolean flat; - private boolean defaultPackage; + /** + * Whether this is default package. + */ + private final boolean defaultPackage; + /** + * Constructs AS2Package + * @param name Name + * @param parent Parent package + * @param swf SWF this package resides in + * @param flat Whether the package is flat = in the format "mypkg.sub1.sub2" instead of "sub1" + * @param defaultPackage + */ public AS2Package(String name, AS2Package parent, SWF swf, boolean flat, boolean defaultPackage) { this.name = name; this.parent = parent; @@ -53,15 +82,27 @@ public class AS2Package implements TreeItem { this.defaultPackage = defaultPackage; } + /** + * Checks whether it is default package. + * @return + */ public boolean isDefaultPackage() { return defaultPackage; } + /** + * Gets openable. + * @return + */ @Override public Openable getOpenable() { return swf; } + /** + * Gets all subpackages and subscripts. + * @return + */ public List getAllChildren() { List result = new ArrayList<>(getChildCount()); result.addAll(subPackages.values()); @@ -69,6 +110,11 @@ public class AS2Package implements TreeItem { return result; } + /** + * Gets child at index. + * @param index + * @return + */ public TreeItem getChild(int index) { if (index < subPackages.size()) { for (AS2Package subPackage : subPackages.values()) { @@ -93,10 +139,19 @@ public class AS2Package implements TreeItem { return null; } + /** + * Gets child count. + * @return + */ public int getChildCount() { return subPackages.size() + scripts.size(); } + /** + * Gets index of child. + * @param child + * @return + */ public int getIndexOfChild(TreeItem child) { int res = 0; if (child instanceof AS2Package) { @@ -120,15 +175,27 @@ public class AS2Package implements TreeItem { return res; } + /** + * ToString. + * @return + */ @Override public String toString() { return name; } + /** + * Gets package name. + * @return + */ public String getName() { return name; } + /** + * Gets modified flag. + * @return + */ @Override public boolean isModified() { for (ASMSource s : scripts.values()) { @@ -143,7 +210,13 @@ public class AS2Package implements TreeItem { } return false; } - + + + /** + * Checks whether the package is flat. + * Flat = in the format "mypkg.sub1.sub2" instead of "sub1". + * @return + */ public boolean isFlat() { return flat; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS3Package.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS3Package.java index 918a28fd4..fa03ce2b4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS3Package.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/AS3Package.java @@ -29,37 +29,83 @@ import java.util.TreeMap; import natorder.NaturalOrderComparator; /** - * + * ActionScript 3 package AS3ClassTreeItem * @author JPEXS */ public class AS3Package extends AS3ClassTreeItem { + /** + * Openable. + */ private final Openable openable; + /** + * Package name. + */ public String packageName; + /** + * All subPackages. + */ @SuppressWarnings("unchecked") private final Map subPackages = new TreeMap<>(new NaturalOrderComparator()); + /** + * All scripts in this package + */ @SuppressWarnings("unchecked") private final Map scripts = new TreeMap<>(new NaturalOrderComparator()); + /** + * Sorted packages. + */ private List sortedPackages; + /** + * Sorted scripts. + */ private List sortedScripts; - private boolean flat; + /** + * Whether the package is flat = in the format "mypkg.sub1.sub2" instead of "sub1". + */ + private final boolean flat; - private boolean defaultPackage; + /** + * Whether this is default package. + */ + private final boolean defaultPackage; - private Integer compoundScriptIndex; + /** + * If this package is compound script package itself, index of scriptInfo + */ + private final Integer compoundScriptIndex; - private ABC abc; + /** + * ABC. + */ + private final ABC abc; + /** + * ScriptPack with compound script initializer. + */ private ScriptPack compoundInitializerPack = null; - private boolean partOfCompoundScript; + /** + * Whether this package is part of compound script. + */ + private final boolean partOfCompoundScript; + /** + * + * @param packageName Package name + * @param openable Openable + * @param flat Whether the package is flat = in the format "mypkg.sub1.sub2" instead of "sub1" + * @param defaultPackage Whether this is default package + * @param abc ABC of this package + * @param partOfCompoundScript Whether this package is part of compound script + * @param compoundScriptIndex If this package is compound script package itself, index of scriptInfo + */ public AS3Package(String packageName, Openable openable, boolean flat, boolean defaultPackage, ABC abc, boolean partOfCompoundScript, Integer compoundScriptIndex) { super(packageName, "", null); this.flat = flat; @@ -70,44 +116,86 @@ public class AS3Package extends AS3ClassTreeItem { this.abc = abc; this.partOfCompoundScript = partOfCompoundScript; } - + + /** + * Checks whether this package is part of compound script. + * @return + */ public boolean isPartOfCompoundScript() { return partOfCompoundScript; } + /** + * Sets ScriptPack with compound script initializer. + * @param compoundInitializerPack + */ public void setCompoundInitializerPack(ScriptPack compoundInitializerPack) { this.compoundInitializerPack = compoundInitializerPack; } + /** + * Gets ScriptPack with compound script initializer. + * @return + */ public ScriptPack getCompoundInitializerPack() { return compoundInitializerPack; } + /** + * Checks whether it is default package. + * @return + */ public boolean isDefaultPackage() { return defaultPackage; } + /** + * Checks whether the package is flat. + * Flat = in the format "mypkg.sub1.sub2" instead of "sub1". + * @return + */ public boolean isFlat() { return flat; } + /** + * Checks whether it is a compound script. + * Not just a part of it. + * @return + */ public boolean isCompoundScript() { return compoundScriptIndex != null; } + /** + * Gets index of compound scriptInfo. + * @return + */ public Integer getCompoundScriptIndex() { return compoundScriptIndex; } + /** + * Gets ABC. + * @return + */ public ABC getAbc() { return abc; } + /** + * Gets Openable. + * @return + */ @Override public Openable getOpenable() { return openable; } + /** + * Gets subpackages. + * @return + */ public List getSubPackages() { if (sortedPackages == null) { List list = new ArrayList<>(); @@ -121,6 +209,10 @@ public class AS3Package extends AS3ClassTreeItem { return sortedPackages; } + /** + * Gets ScriptPacks in this package. + * @return + */ public List getScriptPacks() { if (sortedScripts == null) { List list = new ArrayList<>(); @@ -134,21 +226,38 @@ public class AS3Package extends AS3ClassTreeItem { return sortedScripts; } + /** + * Adds ScriptPack to the package. + * @param script + */ public void addScriptPack(ScriptPack script) { ClassPath cp = script.getClassPath(); scripts.put(cp.className + cp.namespaceSuffix, script); sortedScripts = null; } + /** + * Adds subpackage. + * @param subPackage + */ public void addSubPackage(AS3Package subPackage) { subPackages.put(subPackage.getNameWithNamespaceSuffix(), subPackage); sortedPackages = null; } + /** + * Gets subpackage by name. + * @param packageName + * @return + */ public AS3Package getSubPackage(String packageName) { return subPackages.get(packageName); } + /** + * Gets all subpackages and scripts in this package. + * @return + */ public List getAllChildren() { List result = new ArrayList<>(getChildCount()); result.addAll(subPackages.values()); @@ -156,6 +265,11 @@ public class AS3Package extends AS3ClassTreeItem { return result; } + /** + * Gets child at index. + * @param index + * @return + */ public AS3ClassTreeItem getChild(int index) { if (index < subPackages.size()) { return getSubPackages().get(index); @@ -168,10 +282,19 @@ public class AS3Package extends AS3ClassTreeItem { return null; } + /** + * Gets child count. + * @return + */ public int getChildCount() { return subPackages.size() + getScriptPacks().size(); } + /** + * Gets index of child. + * @param child + * @return + */ public int getIndexOfChild(AS3ClassTreeItem child) { int res = 0; if (child instanceof AS3Package) { @@ -195,6 +318,9 @@ public class AS3Package extends AS3ClassTreeItem { return res; } + /** + * Clears subpackages and scripts in this package. + */ public void clear() { subPackages.clear(); scripts.clear(); @@ -202,6 +328,10 @@ public class AS3Package extends AS3ClassTreeItem { sortedScripts = null; } + /** + * ToString + * @return + */ @Override public String toString() { if (flat) { @@ -210,6 +340,10 @@ public class AS3Package extends AS3ClassTreeItem { return IdentifiersDeobfuscation.printIdentifier(true, packageName); } + /** + * Gets modified flag. + * @return + */ @Override public boolean isModified() { List sps = getScriptPacks(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Clip.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Clip.java index 53843f575..e7df30647 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Clip.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Clip.java @@ -19,13 +19,19 @@ package com.jpexs.decompiler.flash.timeline; import java.awt.Shape; /** - * + * Clipping region. * @author JPEXS */ public class Clip { + /** + * Shape. + */ public Shape shape; + /** + * Clipping depth. + */ public int depth; public Clip(Shape shape, int depth) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/DepthState.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/DepthState.java index e992c920b..1f57a3cfc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/DepthState.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/DepthState.java @@ -37,67 +37,155 @@ import java.util.Objects; import java.util.concurrent.atomic.AtomicLong; /** - * + * State at specific depth on a frame. * @author JPEXS */ public class DepthState { + /** + * Depth. + */ public int depth = -1; + /** + * CharacterId. + */ public int characterId = -1; + /** + * Matrix. + */ public MATRIX matrix; + /** + * Instance name. + */ public String instanceName; + /** + * Class name. + */ public String className; + /** + * Color transform. + */ public ColorTransform colorTransForm; + /** + * Whether to cache as bitmap. + */ public boolean cacheAsBitmap = false; + /** + * Blend mode. + */ public int blendMode = 0; + /** + * Filters. + */ public List filters = new ArrayList<>(); + /** + * Whether is visible. + */ public boolean isVisible = true; + /** + * Background color. + */ public RGBA backGroundColor; + /** + * Clip actions. + */ public CLIPACTIONS clipActions; + /** + * AMF data. + */ public byte[] amfData; + /** + * Ratio. + */ public int ratio = -1; + /** + * Whether this is a keyframe. + */ public boolean key = false; + /** + * Clip depth. + */ public int clipDepth = -1; + /** + * How many frames this depthstate is the same. + */ public int time = 0; + /** + * SWF file. + */ private final SWF swf; + /** + * Frame. + */ public Frame frame; + /** + * Frame of placeobject. + */ public Frame placeFrame; + /** + * Last placeObject. + */ public PlaceObjectTypeTag placeObjectTag; + /** + * Minimum required PlaceObject version. + */ public int minPlaceObjectNum; + /** + * Instance identifier. + */ public long instanceId; + /** + * Whether this is a motion tween. + */ public boolean motionTween = false; + /** + * Whether this state has an image placed. + */ public boolean hasImage = false; + /** + * Instance ids counter. + */ private static AtomicLong lastInstanceId = new AtomicLong(0); + /** + * Gets new instance id. + * @return + */ public static long getNewInstanceId() { return lastInstanceId.addAndGet(1); } + /** + * Constructs DepthState. + * @param swf SWF + * @param frame Frame + * @param placeFrame Frame of placeObject + */ public DepthState(SWF swf, Frame frame, Frame placeFrame) { this.swf = swf; this.frame = frame; @@ -105,6 +193,13 @@ public class DepthState { this.instanceId = getNewInstanceId(); } + /** + * Constructs DepthState. + * @param obj Last DepthState + * @param frame Frame + * @param placeFrame Frame of placeObject + * @param sameInstance Whether it is same instance + */ public DepthState(DepthState obj, Frame frame, Frame placeFrame, boolean sameInstance) { this.frame = frame; this.placeFrame = placeFrame; @@ -134,16 +229,29 @@ public class DepthState { } } + /** + * Sets matrix. + * @param matrix + */ public void setMATRIX(MATRIX matrix) { this.matrix = matrix; this.placeObjectTag.setMatrix(matrix); } + /** + * Checks whether cache as bitmap is on. + * @return + */ public boolean cacheAsBitmap() { return (placeObjectTag != null && placeObjectTag.cacheAsBitmap()) - || (filters != null && filters.size() > 0); + || (filters != null && !filters.isEmpty()); } + /** + * Converts DepthState to PlaceObject tag of required version. + * @param depth Depth + * @return + */ public PlaceObjectTypeTag toPlaceObjectTag(int depth) { if (minPlaceObjectNum <= 1) { CXFORM cxForm0 = colorTransForm == null ? null : new CXFORM(colorTransForm); @@ -160,6 +268,10 @@ public class DepthState { return new PlaceObject4Tag(swf, false, depth, className, characterId, matrix, cxForm, ratio, instanceName, clipDepth, filters, blendMode, cacheAsBitmap ? 1 : 0, isVisible ? 1 : 0, backGroundColor, clipActions, null, hasImage); } + /** + * Gets character tag. + * @return + */ public CharacterTag getCharacter() { if (characterId == -1) { @@ -173,6 +285,10 @@ public class DepthState { return swf.getCharacter(characterId); } + /** + * Hashcode. + * @return + */ @Override public int hashCode() { int hash = 7; @@ -196,6 +312,11 @@ public class DepthState { return hash; } + /** + * Equals. + * @param obj + * @return + */ @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java index 4c374c2a0..920294bf6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java @@ -36,49 +36,103 @@ import java.util.Set; import java.util.TreeMap; /** - * + * Single frame of a timeline. * @author JPEXS */ public class Frame implements TreeItem, Exportable { /** - * Zero based frame index + * Zero based frame index. */ public final int frame; + /** + * Map of depth to DepthState. + */ public TreeMap layers = new TreeMap<>(); + /** + * Background color. + */ public RGB backgroundColor = new RGBA(0, 0, 0, 0); + /** + * Timeline. + */ public final Timeline timeline; + /** + * List of soundIds. + */ public List sounds = new ArrayList<>(); + /** + * List of sound classes. + */ public List soundClasses = new ArrayList<>(); + /** + * List of sound infos. + */ public List soundInfos = new ArrayList<>(); + /** + * List of DoAction tags. + */ public List actions = new ArrayList<>(); + /** + * List of ASMSource containers. + */ public List actionContainers = new ArrayList<>(); + /** + * Inner nested tags in this frame. + * @see ShowFrameTag.isNestedTagType + */ public List innerTags = new ArrayList<>(); + /** + * All inner tags in this frame. + */ public List allInnerTags = new ArrayList<>(); - public ShowFrameTag showFrameTag = null; // can be null for the last frame + /** + * ShowFrame tag for this frame. + * Can be null for the last frame. + */ + public ShowFrameTag showFrameTag = null; + /** + * Whether layers changed. + */ public boolean layersChanged; + /** + * List of frame labels. + */ public List labels = new ArrayList<>(); + /** + * List of name anchors. + */ public List namedAnchors = new ArrayList<>(); + /** + * Constructs Frame. + * @param timeline Timeline + * @param frame Zero-based frame index + */ public Frame(Timeline timeline, int frame) { this.timeline = timeline; this.frame = frame; } + /** + * Constructs Frame. + * @param obj Source frame + * @param frame New zero-based frame index + */ public Frame(Frame obj, int frame) { this.frame = frame; layers = new TreeMap<>(); @@ -90,11 +144,19 @@ public class Frame implements TreeItem, Exportable { //Do not copy sounds } + /** + * Gets openable. + * @return + */ @Override public Openable getOpenable() { return timeline.swf; } + /** + * ToString + * @return + */ @Override public String toString() { String name = "frame " + (frame + 1); @@ -110,11 +172,20 @@ public class Frame implements TreeItem, Exportable { return name; } + /** + * Gets export file name. + * @return + */ @Override public String getExportFileName() { return "frame_" + (frame + 1); } + /** + * Equals. + * @param obj + * @return + */ @Override public boolean equals(Object obj) { if (obj instanceof Frame) { @@ -125,11 +196,19 @@ public class Frame implements TreeItem, Exportable { return false; } + /** + * HashCode. + * @return + */ @Override public int hashCode() { return timeline.hashCode() ^ Integer.hashCode(frame); } + /** + * Checks whether some of "all inner frames" are moified. + * @return + */ public boolean isAllInnerTagsModified() { for (Tag t : allInnerTags) { if (t.isModified() && !t.isReadOnly()) { @@ -139,6 +218,10 @@ public class Frame implements TreeItem, Exportable { return false; } + /** + * Gets modified flag. + * @return + */ @Override public boolean isModified() { for (Tag t : innerTags) { @@ -162,6 +245,10 @@ public class Frame implements TreeItem, Exportable { return false; } + /** + * Get needed characters for this frame. + * @param needed Result + */ public void getNeededCharacters(Set needed) { for (Tag t : innerTags) { if (t instanceof PlaceObjectTypeTag) { @@ -174,6 +261,10 @@ public class Frame implements TreeItem, Exportable { } } + /** + * Get needed characters for this frame to deepest level. + * @param needed Result + */ public void getNeededCharactersDeep(Set needed) { for (Tag t : innerTags) { if (t instanceof PlaceObjectTypeTag) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/FrameScript.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/FrameScript.java index 48358a6cf..b56c9a0ae 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/FrameScript.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/FrameScript.java @@ -22,39 +22,70 @@ import com.jpexs.decompiler.flash.treeitems.Openable; import com.jpexs.decompiler.flash.treeitems.TreeItem; /** - * + * A frame that contains script * @author JPEXS */ public class FrameScript implements TreeItem, Exportable { + /** + * SWF. + */ private final SWF swf; + /** + * Frame. + */ private final Frame frame; + /** + * Constructs FrameScript. + * @param swf SWF + * @param frame Frame + */ public FrameScript(SWF swf, Frame frame) { this.swf = swf; this.frame = frame; } + /** + * Gets Frame. + * @return + */ public Frame getFrame() { return frame; } + /** + * Gets openable. + * @return + */ @Override public Openable getOpenable() { return swf; } + /** + * ToString. + * @return + */ @Override public String toString() { return frame.toString(); } + /** + * Gets export filename. + * @return + */ @Override public String getExportFileName() { return frame.getExportFileName(); } + /** + * Gets modified flag. + * @return + */ @Override public boolean isModified() { return frame.isModified(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Scene.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Scene.java index ee67accc6..006e0feb5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Scene.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Scene.java @@ -22,16 +22,38 @@ import com.jpexs.decompiler.flash.treeitems.TreeItem; import java.util.Objects; /** - * + * Scene object. * @author JPEXS */ public class Scene implements TreeItem { + /** + * SWF. + */ private SWF swf; + + /** + * Start frame (zero-ased). + */ public int startFrame; + + /** + * End frame (zero-based). + */ public int endFrame; + + /** + * Name. + */ public String name; + /** + * Constructs Scene. + * @param swf SWF + * @param startFrame Start frame (zero-based) + * @param endFrame End frame (zero-based) + * @param name Name + */ public Scene(SWF swf, int startFrame, int endFrame, String name) { this.swf = swf; this.startFrame = startFrame; @@ -39,10 +61,19 @@ public class Scene implements TreeItem { this.name = name; } + /** + * Gets number of frames in this scene. + * @return + */ public int getSceneFrameCount() { return endFrame - startFrame + 1; } + /** + * Gets SceneFrame at index + * @param sceneFrameIndex Index at range 0 to sceneFrameCount - 1 + * @return + */ public SceneFrame getSceneFrame(int sceneFrameIndex) { if (sceneFrameIndex >= getSceneFrameCount()) { throw new IndexOutOfBoundsException("Invalid sceneframe index"); @@ -50,16 +81,28 @@ public class Scene implements TreeItem { return new SceneFrame(swf, this, startFrame + sceneFrameIndex); } + /** + * Gets openable. + * @return + */ @Override public Openable getOpenable() { return swf; } + /** + * Gets modified flag. + * @return + */ @Override public boolean isModified() { return false; //?? } + /** + * HashCode. + * @return + */ @Override public int hashCode() { int hash = 7; @@ -68,6 +111,11 @@ public class Scene implements TreeItem { return hash; } + /** + * Equals. + * @param obj + * @return + */ @Override public boolean equals(Object obj) { if (this == obj) { @@ -86,6 +134,10 @@ public class Scene implements TreeItem { return Objects.equals(this.swf, other.swf); } + /** + * ToString. + * @return + */ @Override public String toString() { return name; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/SceneFrame.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/SceneFrame.java index 917f296f6..75c597506 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/SceneFrame.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/SceneFrame.java @@ -22,44 +22,85 @@ import com.jpexs.decompiler.flash.treeitems.TreeItem; import java.util.Objects; /** - * + * A frame in a Scene object. * @author JPEXS */ public class SceneFrame implements TreeItem { + /** + * SWF. + */ private final SWF swf; + + /** + * Scene. + */ private final Scene scene; + + /** + * Real frame index - from main SWF time line. + */ private final int realFrameIndex; + /** + * Constructs SceneFrame. + * @param swf SWF + * @param scene Scene + * @param realFrameIndex Real frame index - from main SWF time line + */ public SceneFrame(SWF swf, Scene scene, int realFrameIndex) { this.swf = swf; this.scene = scene; this.realFrameIndex = realFrameIndex; } + /** + * Gets scene frame index. + * @return + */ public int getSceneFrameIndex() { return realFrameIndex - scene.startFrame; } + /** + * Gets frame. + * @return + */ public Frame getFrame() { return swf.getTimeline().getFrame(realFrameIndex); } + /** + * ToString. + * @return + */ @Override public String toString() { return "scene frame " + (getSceneFrameIndex() + 1); } + /** + * Gets openable. + * @return + */ @Override public Openable getOpenable() { return swf; } + /** + * Gets modified flag. + * @return + */ @Override public boolean isModified() { return getFrame().isModified(); } + /** + * HashCode. + * @return + */ @Override public int hashCode() { int hash = 5; @@ -68,6 +109,11 @@ public class SceneFrame implements TreeItem { return hash; } + /** + * Equals. + * @param obj + * @return + */ @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/SoundStreamFrameRange.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/SoundStreamFrameRange.java index b5f15f83d..fb9e80ae1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/SoundStreamFrameRange.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/SoundStreamFrameRange.java @@ -28,51 +28,98 @@ import java.util.ArrayList; import java.util.List; /** - * + * SoundStream blocks across frame range. * @author JPEXS */ public class SoundStreamFrameRange implements TreeItem, SoundTag { + /** + * Start frame (zero-based). + */ public int startFrame; + + /** + * End frame (zero-based). + */ public int endFrame; + + /** + * Sound blocks. + */ public List blocks = new ArrayList<>(); + /** + * Sound stream head. + */ private final SoundStreamHeadTypeTag head; + /** + * Constructs SoundStreamFrameRange + * @param head Sound stream head + */ public SoundStreamFrameRange(SoundStreamHeadTypeTag head) { this.head = head; } + /** + * Gets openable. + * @return + */ @Override public Openable getOpenable() { return head.getOpenable(); } + /** + * Gets modified flag + * @return + */ @Override public boolean isModified() { return false; } + /** + * Gets sound export format. + * @return + */ @Override public SoundExportFormat getExportFormat() { return head.getExportFormat(); } + /** + * Checks whether import is supported. + * @return + */ @Override public boolean importSupported() { return false; //?? } + /** + * Gets sound rate. + * @return + */ @Override public int getSoundRate() { return head.getSoundRate(); } + /** + * Gets sound type. + * True = stereo, false = mono. + * @return + */ @Override public boolean getSoundType() { return head.getSoundType(); } + /** + * Gets raw sound data. + * @return + */ @Override public List getRawSoundData() { List ret = new ArrayList<>(); @@ -87,85 +134,156 @@ public class SoundStreamFrameRange implements TreeItem, SoundTag { return ret; } + /** + * Gets sound format id. + * @return + */ @Override public int getSoundFormatId() { return head.getSoundFormatId(); } + /** + * Gets total sound sample count. + * @return + */ @Override public long getTotalSoundSampleCount() { return blocks.size() * head.getSoundSampleCount(); } + /** + * Gets sound size. + * True = 16 bit, false = 8 bit. + * @return + */ @Override public boolean getSoundSize() { return head.getSoundSize(); } + /** + * Gets character export filename. + * @return + */ @Override public String getCharacterExportFileName() { return head.getCharacterExportFileName() + "_" + (startFrame + 1) + "-" + (endFrame + 1); } + /** + * Gets name. + * @return + */ @Override public String getName() { return "SoundStreamBlocks"; } + /** + * Gets sound format. + * @return + */ @Override public SoundFormat getSoundFormat() { return head.getSoundFormat(); } + /** + * Sets sound size. + * True = 16 bit, false = 8 bit + * @param soundSize + */ @Override public void setSoundSize(boolean soundSize) { //? } + /** + * Sets sound type. + * True = stereo, false = mono + * @param soundType + */ @Override public void setSoundType(boolean soundType) { //? } + /** + * Sets sound sample count. + * @param soundSampleCount + */ @Override public void setSoundSampleCount(long soundSampleCount) { //? } + /** + * Sets sound compression. + * @param soundCompression + */ @Override public void setSoundCompression(int soundCompression) { //? } + /** + * Sets sound rate. + * @param soundRate + */ @Override public void setSoundRate(int soundRate) { //? } + /** + * Gets character id. + * @return + */ @Override public int getCharacterId() { return head.getCharacterId(); } + /** + * Gets sound stream head. + * @return + */ public SoundStreamHeadTypeTag getHead() { return head; } + /** + * ToString. + * @return + */ @Override public String toString() { return "SoundStreamBlocks (frame " + (startFrame + 1) + " - " + (endFrame + 1) + ")"; } + /** + * Checks whether the sound is readonly. + * @return + */ @Override public boolean isReadOnly() { return head.isReadOnly(); } + /** + * Gets FLA export name. + * @return + */ @Override public String getFlaExportName() { return head.getFlaExportName() + "_" + (startFrame + 1) + "-" + (endFrame + 1); } + /** + * Gets initial latency. + * @return + */ @Override public int getInitialLatency() { return 0; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/SvgClip.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/SvgClip.java index 5143a496b..c6b6d0b1a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/SvgClip.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/SvgClip.java @@ -17,15 +17,26 @@ package com.jpexs.decompiler.flash.timeline; /** - * + * SVG clipping region * @author JPEXS */ public class SvgClip { + /** + * Shape. + */ public String shape; + /** + * Depth. + */ public int depth; + /** + * Constructs SvgClip. + * @param shape Shape + * @param depth Depth + */ public SvgClip(String shape, int depth) { this.shape = shape; this.depth = depth; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TagScript.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TagScript.java index ccb86e96c..26a5c3639 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TagScript.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TagScript.java @@ -25,46 +25,86 @@ import java.util.List; import java.util.Objects; /** - * + * A tag containing script. * @author JPEXS */ public class TagScript implements TreeItem, Exportable { + /** + * SWF. + */ private final SWF swf; + /** + * Tag. + */ private final Tag tag; + /** + * Frames + */ private final List frames; + /** + * Constructs TagScript. + * @param swf SWF + * @param tag Tag + * @param frames Frames + */ public TagScript(SWF swf, Tag tag, List frames) { this.swf = swf; this.tag = tag; this.frames = frames; } + /** + * Gets tag. + * @return + */ public Tag getTag() { return tag; } + /** + * Gets frames. + * @return + */ public List getFrames() { return frames; } + /** + * Gets openable. + * @return + */ @Override public Openable getOpenable() { return swf; } + /** + * ToString. + * @return + */ @Override public String toString() { return tag.toString(); } + /** + * Gets export filename. + * @return + */ @Override public String getExportFileName() { return tag.getExportFileName(); } + /** + * Equals. + * @param obj + * @return + */ @Override public boolean equals(Object obj) { if (obj instanceof TagScript) { @@ -74,11 +114,19 @@ public class TagScript implements TreeItem, Exportable { return false; } + /** + * HashCode. + * @return + */ @Override public int hashCode() { return tag.hashCode(); } + /** + * Gets modified flag. + * @return + */ @Override public boolean isModified() { for (TreeItem f : frames) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenDetector.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenDetector.java index 2dab6c364..8622f9769 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenDetector.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenDetector.java @@ -21,8 +21,8 @@ import java.util.Arrays; import java.util.List; /** - * - * NOT WORKING STUB!!! FIXME + * An attemp to detect tweens. + * FIXME!! NOT WORKING STUB!!! * * @author JPEXS */ diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenRange.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenRange.java index 5208b1e91..482b81bb8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenRange.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/TweenRange.java @@ -17,13 +17,19 @@ package com.jpexs.decompiler.flash.timeline; /** - * + * Range of tween. * @author JPEXS */ public class TweenRange { + /** + * Start frame (zero-based). + */ public int startPosition; + /** + * End frame (zero-based). + */ public int endPosition; public TweenRange(int startPosition, int endPosition) {