show frame number during play

FlashPlayer - show controls for DefineSprite display
Goto frame on click
This commit is contained in:
Jindra Petřík
2014-11-17 11:33:26 +01:00
parent 69c3ec8474
commit bff3520bee
12 changed files with 277 additions and 34 deletions

View File

@@ -288,4 +288,22 @@ public final class Matrix implements Cloneable {
public double getTotalScaleY() {
return Math.sqrt(rotateSkew1 * rotateSkew1 + scaleY * scaleY);
}
private int fromFloat(double f){
return (int)(f * (1 << 16));
}
public MATRIX toMATRIX(){
MATRIX result = new MATRIX();
result.translateX = (int)translateX;
result.translateY = (int)translateY;
result.hasRotate = true;
result.hasScale = true;
result.scaleX = fromFloat(scaleX);
result.scaleY = fromFloat(scaleY);
result.rotateSkew0 = fromFloat(rotateSkew0);
result.rotateSkew1 = fromFloat(rotateSkew1);
return result;
}
}

View File

@@ -409,4 +409,15 @@ public class PlaceObject2Tag extends CharacterIdTag implements Container, PlaceO
return null;
}
}
@Override
public void writeTagWithMatrix(SWFOutputStream sos, MATRIX m) throws IOException {
MATRIX old=matrix;
matrix = m;
boolean mod=isModified();
setModified(true);
super.writeTag(sos);
setModified(mod);
matrix = old;
}
}

View File

@@ -538,4 +538,15 @@ public class PlaceObject3Tag extends CharacterIdTag implements Container, PlaceO
return null;
}
}
@Override
public void writeTagWithMatrix(SWFOutputStream sos, MATRIX m) throws IOException {
MATRIX old=matrix;
matrix = m;
boolean mod=isModified();
setModified(true);
super.writeTag(sos);
setModified(mod);
matrix = old;
}
}

View File

@@ -541,4 +541,15 @@ public class PlaceObject4Tag extends CharacterIdTag implements Container, PlaceO
return null;
}
}
@Override
public void writeTagWithMatrix(SWFOutputStream sos, MATRIX m) throws IOException {
MATRIX old=matrix;
matrix = m;
boolean mod=isModified();
setModified(true);
super.writeTag(sos);
setModified(mod);
matrix = old;
}
}

View File

@@ -218,4 +218,17 @@ public class PlaceObjectTag extends CharacterIdTag implements PlaceObjectTypeTag
public CLIPACTIONS getClipActions() {
return null;
}
@Override
public void writeTagWithMatrix(SWFOutputStream sos, MATRIX m) throws IOException {
MATRIX old=matrix;
matrix = m;
boolean mod=isModified();
setModified(true);
super.writeTag(sos);
setModified(mod);
matrix = old;
}
}

View File

@@ -12,14 +12,17 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.tags.base;
import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.CLIPACTIONS;
import com.jpexs.decompiler.flash.types.ColorTransform;
import com.jpexs.decompiler.flash.types.MATRIX;
import com.jpexs.decompiler.flash.types.RGBA;
import com.jpexs.decompiler.flash.types.filters.FILTER;
import java.io.IOException;
import java.util.List;
/**
@@ -61,4 +64,6 @@ public interface PlaceObjectTypeTag {
public int getRatio();
public CLIPACTIONS getClipActions();
public void writeTagWithMatrix(SWFOutputStream sos,MATRIX m) throws IOException;
}

View File

@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.exporters.commonshape.Matrix;
import com.jpexs.decompiler.flash.types.annotations.Calculated;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
@@ -107,6 +108,8 @@ public class MATRIX implements Serializable {
return "[MATRIX scale:" + getScaleXFloat() + "," + getScaleYFloat() + ", rotate:" + getRotateSkew0Float() + "," + getRotateSkew1Float() + ", translate:" + translateX + "," + translateY + "]";
}
private float toFloat(int i) {
return ((float) i) / (1 << 16);
}
@@ -160,21 +163,7 @@ public class MATRIX implements Serializable {
public int getScaleY() {
return (hasScale ? (scaleY) : (1 << 16));
}
public MATRIX merge(MATRIX m) {
MATRIX ret = new MATRIX();
ret.translateX = m.translateX + this.translateX;
ret.translateY = m.translateY + this.translateY;
ret.scaleX = (m.hasScale ? m.scaleX : 1) * (this.hasScale ? this.scaleX : 1);
ret.scaleY = (m.hasScale ? m.scaleY : 1) * (this.hasScale ? this.scaleY : 1);
ret.rotateSkew0 = m.rotateSkew0 + this.rotateSkew0;
ret.rotateSkew1 = m.rotateSkew1 + this.rotateSkew1;
ret.hasScale = true;
ret.hasRotate = true;
return ret;
}
public boolean isEmpty() {
return (translateX == 0) && (translateY == 0) && (!hasRotate) && (!hasScale);
}