mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-02 20:04:37 +00:00
Fixed #1818 GFX: Importing XML
This commit is contained in:
@@ -95,6 +95,15 @@ import com.jpexs.decompiler.flash.types.filters.DROPSHADOWFILTER;
|
||||
import com.jpexs.decompiler.flash.types.filters.GLOWFILTER;
|
||||
import com.jpexs.decompiler.flash.types.filters.GRADIENTBEVELFILTER;
|
||||
import com.jpexs.decompiler.flash.types.filters.GRADIENTGLOWFILTER;
|
||||
import com.jpexs.decompiler.flash.types.gfx.ContourType;
|
||||
import com.jpexs.decompiler.flash.types.gfx.EdgeType;
|
||||
import com.jpexs.decompiler.flash.types.gfx.FONTINFO;
|
||||
import com.jpexs.decompiler.flash.types.gfx.FontType;
|
||||
import com.jpexs.decompiler.flash.types.gfx.GLYPHIDX;
|
||||
import com.jpexs.decompiler.flash.types.gfx.GlyphInfoType;
|
||||
import com.jpexs.decompiler.flash.types.gfx.GlyphType;
|
||||
import com.jpexs.decompiler.flash.types.gfx.KerningPairType;
|
||||
import com.jpexs.decompiler.flash.types.gfx.TEXGLYPH;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.CurvedEdgeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.EndShapeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
|
||||
@@ -168,7 +177,11 @@ public class SwfXmlImporter {
|
||||
AVM2ConstantPool.class, Decimal.class, Namespace.class, NamespaceSet.class, Multiname.class, MethodInfo.class, MetadataInfo.class,
|
||||
ValueKind.class, InstanceInfo.class, Traits.class, TraitClass.class, TraitFunction.class,
|
||||
TraitMethodGetterSetter.class, TraitSlotConst.class, ClassInfo.class, ScriptInfo.class, MethodBody.class,
|
||||
ABCException.class, ABCVersion.class, Amf3Value.class};
|
||||
ABCException.class, ABCVersion.class, Amf3Value.class,
|
||||
//GFX:
|
||||
ContourType.class, EdgeType.class, FONTINFO.class, FontType.class, GLYPHIDX.class,
|
||||
GlyphInfoType.class, GlyphType.class, KerningPairType.class, TEXGLYPH.class
|
||||
};
|
||||
|
||||
for (Class cls2 : knownObjects) {
|
||||
if (!ReflectionTools.canInstantiateDefaultConstructor(cls2)) {
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
* 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.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
@@ -71,6 +73,11 @@ public class DefineExternalGradient extends Tag {
|
||||
readData(sis, data, 0, false, false, false);
|
||||
}
|
||||
|
||||
public DefineExternalGradient(SWF swf) {
|
||||
super(swf, ID, NAME, null);
|
||||
fileName = "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
gradientId = sis.readUI16("gradientId");
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.tags.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.helpers.ImageHelper;
|
||||
@@ -93,6 +94,17 @@ public class DefineExternalImage extends ImageTag {
|
||||
readData(sis, data, 0, false, false, false);
|
||||
}
|
||||
|
||||
public DefineExternalImage(SWF swf) {
|
||||
super(swf, ID, NAME, null);
|
||||
exportName = "";
|
||||
fileName = "";
|
||||
targetWidth = 1;
|
||||
targetHeight = 1;
|
||||
createFailedImage();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
characterID = sis.readUI16("characterID");
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.tags.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.helpers.ImageHelper;
|
||||
@@ -68,7 +69,7 @@ public class DefineExternalImage2 extends ImageTag {
|
||||
|
||||
@HideInRawEdit
|
||||
private SerializableImage serImage;
|
||||
|
||||
|
||||
/**
|
||||
* Gets data bytes
|
||||
*
|
||||
@@ -101,6 +102,15 @@ public class DefineExternalImage2 extends ImageTag {
|
||||
readData(sis, data, 0, false, false, false);
|
||||
}
|
||||
|
||||
public DefineExternalImage2(SWF swf) {
|
||||
super(swf, ID, NAME, null);
|
||||
exportName = "";
|
||||
fileName = "";
|
||||
targetWidth = 1;
|
||||
targetHeight = 1;
|
||||
createFailedImage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
characterID = sis.readUI16("characterID") | 0x8000;
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
* 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.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
@@ -81,6 +83,12 @@ public class DefineExternalSound extends Tag {
|
||||
super(sis.getSwf(), ID, NAME, data);
|
||||
readData(sis, data, 0, false, false, false);
|
||||
}
|
||||
|
||||
public DefineExternalSound(SWF swf) {
|
||||
super(swf, ID, NAME, null);
|
||||
exportName = "";
|
||||
fileName = "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
* 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.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
@@ -82,6 +84,13 @@ public class DefineExternalStreamSound extends Tag {
|
||||
readData(sis, data, 0, false, false, false);
|
||||
}
|
||||
|
||||
public DefineExternalStreamSound(SWF swf) {
|
||||
super(swf, ID, NAME, null);
|
||||
fileName = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
soundFormat = sis.readUI16("soundFormat");
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
* 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.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
@@ -59,6 +61,13 @@ public class DefineGradientMap extends Tag {
|
||||
readData(sis, data, 0, false, false, false);
|
||||
}
|
||||
|
||||
public DefineGradientMap(SWF swf) {
|
||||
super(swf, ID, NAME, null);
|
||||
indices = new int[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
int numGradients = sis.readUI16("numGradients");
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.tags.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.helpers.ImageHelper;
|
||||
@@ -88,6 +89,18 @@ public class DefineSubImage extends ImageTag {
|
||||
readData(sis, data, 0, false, false, false);
|
||||
}
|
||||
|
||||
public DefineSubImage(SWF swf) {
|
||||
super(swf, ID, NAME, null);
|
||||
characterID = swf.getNextCharacterId();
|
||||
x1 = 0;
|
||||
x2 = 1;
|
||||
y1 = 0;
|
||||
y2 = 1;
|
||||
createFailedImage();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
characterID = sis.readUI16("characterID");
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
* 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.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
@@ -93,6 +95,13 @@ public class ExporterInfo extends Tag {
|
||||
readData(sis, data, 0, false, false, false);
|
||||
}
|
||||
|
||||
public ExporterInfo(SWF swf) {
|
||||
super(swf, ID, NAME, null);
|
||||
swfName = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
this.version = sis.readUI16("version");
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
* 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.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
@@ -97,6 +99,13 @@ public class FontTextureInfo extends Tag {
|
||||
readData(sis, data, 0, false, false, false);
|
||||
}
|
||||
|
||||
public FontTextureInfo(SWF swf) {
|
||||
super(swf, ID, NAME, null);
|
||||
fileName = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
textureID = sis.readUI32("textureID");
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* 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.types.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.CurvedEdgeRecord;
|
||||
@@ -74,6 +75,10 @@ public class ContourType implements Serializable {
|
||||
edges = edgesList.toArray(new EdgeType[edgesList.size()]);
|
||||
}
|
||||
|
||||
public ContourType() {
|
||||
edges = new EdgeType[0];
|
||||
}
|
||||
|
||||
public ContourType(GFxInputStream sis, long fontOffset) throws IOException {
|
||||
moveToX = sis.readSI15("moveToX");
|
||||
moveToY = sis.readSI15("moveToY");
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* 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.types.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.CurvedEdgeRecord;
|
||||
@@ -70,6 +71,10 @@ public class EdgeType implements Serializable {
|
||||
private static final int Edge_Quad = 3;
|
||||
|
||||
public int[] data;
|
||||
|
||||
public EdgeType() {
|
||||
data = new int[] {Edge_Line, 0, 0};
|
||||
}
|
||||
|
||||
public EdgeType(boolean vertical, int v) {
|
||||
data = new int[]{vertical ? Edge_VLine : Edge_HLine, v};
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* 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.types.gfx;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -28,6 +29,10 @@ public class FONTINFO implements Serializable {
|
||||
|
||||
public GLYPHIDX[] glyphIndices;
|
||||
|
||||
public FONTINFO() {
|
||||
glyphIndices = new GLYPHIDX[0];
|
||||
}
|
||||
|
||||
public FONTINFO(int fontId, int numGlyphs, GLYPHIDX[] glyphIndices) {
|
||||
this.fontId = fontId;
|
||||
this.glyphIndices = glyphIndices;
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* 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.types.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.types.SHAPE;
|
||||
@@ -56,7 +57,7 @@ public class FontType implements Serializable {
|
||||
kerning = new ArrayList<>();
|
||||
glyphs = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
public FontType(GFxInputStream sis) throws IOException {
|
||||
long offset = sis.getPos();
|
||||
fontName = sis.readString("fontName");
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* 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.types.gfx;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -28,6 +29,9 @@ public class GLYPHIDX implements Serializable {
|
||||
|
||||
public int indexInTexture;
|
||||
|
||||
public GLYPHIDX() {
|
||||
}
|
||||
|
||||
public GLYPHIDX(int indexInFont, int indexInTexture) {
|
||||
this.indexInFont = indexInFont;
|
||||
this.indexInTexture = indexInTexture;
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* 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.types.gfx;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -30,6 +31,9 @@ public class GlyphInfoType implements Serializable {
|
||||
|
||||
public long globalOffset;
|
||||
|
||||
public GlyphInfoType() {
|
||||
}
|
||||
|
||||
public GlyphInfoType(int glyphCode, int advance, int glyphPos) {
|
||||
this.glyphCode = glyphCode;
|
||||
this.advanceX = advance;
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* 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.types.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
@@ -35,6 +36,15 @@ public class GlyphType implements Serializable {
|
||||
|
||||
public ContourType[] contours;
|
||||
|
||||
public GlyphType() {
|
||||
contours = new ContourType[0];
|
||||
boundingBox = new int[4];
|
||||
boundingBox[2] = 1; //xmax
|
||||
boundingBox[3] = 1; //ymax
|
||||
}
|
||||
|
||||
|
||||
|
||||
public GlyphType(List<SHAPERECORD> records) {
|
||||
RECT bounds = SHAPERECORD.getBounds(records);
|
||||
boundingBox = new int[4];
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* 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.types.gfx;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -30,6 +31,11 @@ public class KerningPairType implements Serializable {
|
||||
|
||||
public int advance;
|
||||
|
||||
public KerningPairType() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public KerningPairType(int char1, int char2, int advance) {
|
||||
this.char1 = char1;
|
||||
this.char2 = char2;
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* 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.types.gfx;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -36,6 +37,9 @@ public class TEXGLYPH implements Serializable {
|
||||
|
||||
public float uvOriginY;
|
||||
|
||||
public TEXGLYPH() {
|
||||
}
|
||||
|
||||
public TEXGLYPH(float uvBoundsLeft, float uvBoundsTop, float uvBoundsRight, float uvBoundsBottom, float uvOriginX, float uvOriginY) {
|
||||
this.uvBoundsLeft = uvBoundsLeft;
|
||||
this.uvBoundsTop = uvBoundsTop;
|
||||
|
||||
Reference in New Issue
Block a user