diff --git a/src/com/jpexs/decompiler/flash/tags/gfx/FontTextureInfo.java b/src/com/jpexs/decompiler/flash/tags/gfx/FontTextureInfo.java
index 56a55e670..12615d85f 100644
--- a/src/com/jpexs/decompiler/flash/tags/gfx/FontTextureInfo.java
+++ b/src/com/jpexs/decompiler/flash/tags/gfx/FontTextureInfo.java
@@ -106,7 +106,6 @@ public class FontTextureInfo extends Tag {
for (int i = 0; i < numTexGlyphs; i++) {
texGlyphs[i] = new TEXGLYPH(new GFxInputStream(mis));
}
- // todo: honfika: add GFx data to dump view
sis.skipBytes(mis.getPos());
int numFonts = sis.readUI16("numFonts");
fonts = new FONTINFO[numFonts];
@@ -114,7 +113,6 @@ public class FontTextureInfo extends Tag {
for (int i = 0; i < numFonts; i++) {
fonts[i] = new FONTINFO(new GFxInputStream(sis.getBaseStream()));
}
- // todo: honfika: add GFx data to dump view
sis.skipBytes(mis.getPos());
}
}
diff --git a/src/com/jpexs/decompiler/flash/types/gfx/ContourType.java b/src/com/jpexs/decompiler/flash/types/gfx/ContourType.java
index 4dbe2e2fb..d557348f4 100644
--- a/src/com/jpexs/decompiler/flash/types/gfx/ContourType.java
+++ b/src/com/jpexs/decompiler/flash/types/gfx/ContourType.java
@@ -1,132 +1,132 @@
-/*
- * Copyright (C) 2010-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 .
- */
-package com.jpexs.decompiler.flash.types.gfx;
-
-import com.jpexs.decompiler.flash.types.shaperecords.CurvedEdgeRecord;
-import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
-import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
-import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * @author JPEXS
- */
-public class ContourType implements Serializable {
-
- public int moveToX;
- public int moveToY;
- public EdgeType[] edges;
- public boolean isReference;
- public long reference;
-
- public ContourType(List records) {
- int i = 0;
- int divider = 20;
- for (; i < records.size(); i++) {
- if (records.get(i) instanceof StyleChangeRecord) {
- StyleChangeRecord scr = (StyleChangeRecord) records.get(i);
- if (scr.stateMoveTo) {
- moveToX = scr.moveDeltaX / divider;
- moveToY = scr.moveDeltaY / divider;
- break;
- }
- }
- }
- List edgesList = new ArrayList<>();
- for (; i < records.size(); i++) {
- SHAPERECORD rec = records.get(i);
- if (rec instanceof StraightEdgeRecord) {
- StraightEdgeRecord ser = (StraightEdgeRecord) rec;
- if (ser.generalLineFlag) {
- edgesList.add(new EdgeType(ser.deltaX / divider, ser.deltaY / divider));
- } else if (ser.vertLineFlag) {
- edgesList.add(new EdgeType(true, ser.deltaY / divider));
- } else {
- edgesList.add(new EdgeType(false, ser.deltaX / divider));
- }
- } else if (rec instanceof CurvedEdgeRecord) {
- CurvedEdgeRecord cer = (CurvedEdgeRecord) rec;
- edgesList.add(new EdgeType(cer.controlDeltaX / divider, cer.controlDeltaY / divider, cer.anchorDeltaX / divider, cer.anchorDeltaY / divider));
- }
- }
- edges = edgesList.toArray(new EdgeType[edgesList.size()]);
- }
-
- public ContourType(GFxInputStream sis) throws IOException {
- moveToX = sis.readSI15();
- moveToY = sis.readSI15();
- long numEdgesRef = sis.readUI30();
- isReference = (numEdgesRef & 1) == 1;
- numEdgesRef >>= 1;
- long oldPos = sis.getPos();
- if (isReference) {
- sis.setPos(numEdgesRef);
- numEdgesRef = sis.readUI30();
- numEdgesRef >>= 1;
- }
-
- edges = new EdgeType[(int) numEdgesRef];
- for (int i = 0; i < edges.length; i++) {
- edges[i] = new EdgeType(sis);
- }
- if (isReference) {
- sis.setPos(oldPos);
- }
-
- }
-
- public List toSHAPERECORDS() {
- int multiplier = 1;
- List recs = new ArrayList<>();
- StyleChangeRecord src = new StyleChangeRecord();
- src.stateMoveTo = true;
- src.moveDeltaX = moveToX * multiplier;
- src.moveDeltaY = moveToY * multiplier;
- src.calculateBits();
- recs.add(src);
- for (EdgeType e : edges) {
- recs.add(e.toSHAPERECORD());
- }
- int x = src.moveDeltaX;
- int y = src.moveDeltaY;
- for (SHAPERECORD rec : recs) {
- x = rec.changeX(x);
- y = rec.changeY(y);
- }
- StraightEdgeRecord closeSer = new StraightEdgeRecord();
- closeSer.generalLineFlag = true;
- closeSer.deltaX = (src.moveDeltaX - x);
- closeSer.deltaY = (src.moveDeltaY - y);
- closeSer.calculateBits();
- recs.add(closeSer);
-
- return recs;
- }
-
- public void write(GFxOutputStream sos) throws IOException {
- sos.writeSI15(moveToX);
- sos.writeSI15(moveToY);
- sos.writeUI30(edges.length << 1);
- for (int i = 0; i < edges.length; i++) {
- edges[i].write(sos);
- }
- }
-}
+/*
+ * Copyright (C) 2010-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 .
+ */
+package com.jpexs.decompiler.flash.types.gfx;
+
+import com.jpexs.decompiler.flash.types.shaperecords.CurvedEdgeRecord;
+import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
+import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
+import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class ContourType implements Serializable {
+
+ public int moveToX;
+ public int moveToY;
+ public EdgeType[] edges;
+ public boolean isReference;
+ public long reference;
+
+ public ContourType(List records) {
+ int i = 0;
+ int divider = 20;
+ for (; i < records.size(); i++) {
+ if (records.get(i) instanceof StyleChangeRecord) {
+ StyleChangeRecord scr = (StyleChangeRecord) records.get(i);
+ if (scr.stateMoveTo) {
+ moveToX = scr.moveDeltaX / divider;
+ moveToY = scr.moveDeltaY / divider;
+ break;
+ }
+ }
+ }
+ List edgesList = new ArrayList<>();
+ for (; i < records.size(); i++) {
+ SHAPERECORD rec = records.get(i);
+ if (rec instanceof StraightEdgeRecord) {
+ StraightEdgeRecord ser = (StraightEdgeRecord) rec;
+ if (ser.generalLineFlag) {
+ edgesList.add(new EdgeType(ser.deltaX / divider, ser.deltaY / divider));
+ } else if (ser.vertLineFlag) {
+ edgesList.add(new EdgeType(true, ser.deltaY / divider));
+ } else {
+ edgesList.add(new EdgeType(false, ser.deltaX / divider));
+ }
+ } else if (rec instanceof CurvedEdgeRecord) {
+ CurvedEdgeRecord cer = (CurvedEdgeRecord) rec;
+ edgesList.add(new EdgeType(cer.controlDeltaX / divider, cer.controlDeltaY / divider, cer.anchorDeltaX / divider, cer.anchorDeltaY / divider));
+ }
+ }
+ edges = edgesList.toArray(new EdgeType[edgesList.size()]);
+ }
+
+ public ContourType(GFxInputStream sis) throws IOException {
+ moveToX = sis.readSI15("moveToX");
+ moveToY = sis.readSI15("moveToY");
+ long numEdgesRef = sis.readUI30("numEdgesRef");
+ isReference = (numEdgesRef & 1) == 1;
+ numEdgesRef >>= 1;
+ long oldPos = sis.getPos();
+ if (isReference) {
+ sis.setPos(numEdgesRef);
+ numEdgesRef = sis.readUI30("numEdgesRef");
+ numEdgesRef >>= 1;
+ }
+
+ edges = new EdgeType[(int) numEdgesRef];
+ for (int i = 0; i < edges.length; i++) {
+ edges[i] = new EdgeType(sis);
+ }
+ if (isReference) {
+ sis.setPos(oldPos);
+ }
+
+ }
+
+ public List toSHAPERECORDS() {
+ int multiplier = 1;
+ List recs = new ArrayList<>();
+ StyleChangeRecord src = new StyleChangeRecord();
+ src.stateMoveTo = true;
+ src.moveDeltaX = moveToX * multiplier;
+ src.moveDeltaY = moveToY * multiplier;
+ src.calculateBits();
+ recs.add(src);
+ for (EdgeType e : edges) {
+ recs.add(e.toSHAPERECORD());
+ }
+ int x = src.moveDeltaX;
+ int y = src.moveDeltaY;
+ for (SHAPERECORD rec : recs) {
+ x = rec.changeX(x);
+ y = rec.changeY(y);
+ }
+ StraightEdgeRecord closeSer = new StraightEdgeRecord();
+ closeSer.generalLineFlag = true;
+ closeSer.deltaX = (src.moveDeltaX - x);
+ closeSer.deltaY = (src.moveDeltaY - y);
+ closeSer.calculateBits();
+ recs.add(closeSer);
+
+ return recs;
+ }
+
+ public void write(GFxOutputStream sos) throws IOException {
+ sos.writeSI15(moveToX);
+ sos.writeSI15(moveToY);
+ sos.writeUI30(edges.length << 1);
+ for (int i = 0; i < edges.length; i++) {
+ edges[i].write(sos);
+ }
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java b/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java
index 95eb26dd6..77d14c7aa 100644
--- a/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java
+++ b/src/com/jpexs/decompiler/flash/types/gfx/EdgeType.java
@@ -1,459 +1,459 @@
-/*
- * Copyright (C) 2010-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 .
- */
-package com.jpexs.decompiler.flash.types.gfx;
-
-import com.jpexs.decompiler.flash.types.shaperecords.CurvedEdgeRecord;
-import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
-import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * @author JPEXS
- */
-public class EdgeType implements Serializable {
-
- private static final int sizes[] = new int[]{1, 2, 1, 2, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 9};
- private static final int Edge_H12 = 0; // 2 bytes
- private static final int Edge_H20 = 1; // 3 bytes
- private static final int Edge_V12 = 2; // 2 bytes
- private static final int Edge_V20 = 3; // 3 bytes
- private static final int Edge_L6 = 4; // 2 bytes
- private static final int Edge_L10 = 5; // 3 bytes
- private static final int Edge_L14 = 6; // 4 bytes
- private static final int Edge_L18 = 7; // 5 bytes
- private static final int Edge_C5 = 8; // 3 bytes
- private static final int Edge_C7 = 9; // 4 bytes
- private static final int Edge_C9 = 10; // 5 bytes
- private static final int Edge_C11 = 11; // 6 bytes
- private static final int Edge_C13 = 12; // 7 bytes
- private static final int Edge_C15 = 13; // 8 bytes
- private static final int Edge_C17 = 14; // 9 bytes
- private static final int Edge_C19 = 15; // 10 bytes
- private static final int Edge_HLine = 0;
- private static final int Edge_VLine = 1;
- private static final int Edge_Line = 2;
- private static final int Edge_Quad = 3;
- public int data[];
- public byte raw[];
-
- public EdgeType(boolean vertical, int v) {
- data = new int[]{vertical ? Edge_VLine : Edge_HLine, v};
- calcRaw();
- }
-
- public EdgeType(int x, int y) {
- data = new int[]{Edge_Line, x, y};
- calcRaw();
- }
-
- public EdgeType(int cx, int cy, int ax, int ay) {
- data = new int[]{Edge_Quad, cx, cy, ax, ay};
- calcRaw();
- }
-
- private void calcRaw() {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- GFxOutputStream sos = new GFxOutputStream(baos);
- try {
- write(sos);
- } catch (IOException ex) {
- Logger.getLogger(EdgeType.class.getName()).log(Level.SEVERE, null, ex);
- }
- raw = baos.toByteArray();
- }
-
- @Override
- public String toString() {
- String ret = "[Edge " + (raw[0] & 0xf) + " data:";
- for (int i = 0; i < data.length; i++) {
- if (i > 0) {
- ret += ", ";
- }
- ret += "" + data[i];
- }
- ret += " raw: 0x";
- for (int i = 0; i < raw.length; i++) {
- if (i > 0) {
- ret += "";
- }
- String h = Integer.toHexString(raw[i] & 0xff);
- if (h.length() < 2) {
- h = "0" + h;
- }
- ret += "" + h;
- }
- ret += "]";
- return ret;
- }
-
- public EdgeType(GFxInputStream sis) throws IOException {
- data = readEdge(sis);
- /*if((raw[0]&0xf) == Edge_V20){
- data[1] = 0;
- }
- if((raw[0]&0xf) == Edge_C17){
- //System.out.println("========== 17 : "+toString()) ;
- data[1] = 0;
- data[2] = 0;
- data[3] = 0;
- data[4] = 0;
- }*/
- }
-
- private byte[] readRawEdge(GFxInputStream sis) throws IOException {
- int firstByte = sis.readUI8();
- int nb = sizes[firstByte & 0xF];
- byte ret[] = new byte[1 + nb];
- ret[0] = (byte) firstByte;
- int i;
- for (i = 0; i < nb; i++) {
- ret[i + 1] = (byte) sis.readUI8();
- }
-
- return ret;
- }
-
- private static int SInt8(int val) {
- /*boolean sign = (val & 0x80) == 0x80;
- val = val & 0x7F;
- if (sign) {
- val = -val;
- }
- return val;*/
- return (byte) val;
- }
-
- public SHAPERECORD toSHAPERECORD() {
- int multiplier = 1;
- StraightEdgeRecord ser;
- CurvedEdgeRecord cer;
- switch (data[0]) {
- case Edge_HLine:
- ser = new StraightEdgeRecord();
- ser.generalLineFlag = false;
- ser.deltaX = data[1] * multiplier;
- ser.calculateBits();
- return ser;
- case Edge_VLine:
- ser = new StraightEdgeRecord();
- ser.generalLineFlag = false;
- ser.vertLineFlag = true;
- ser.deltaY = data[1] * multiplier;
- ser.calculateBits();
- return ser;
- case Edge_Line:
- ser = new StraightEdgeRecord();
- ser.generalLineFlag = true;
- ser.deltaX = data[1] * multiplier;
- ser.deltaY = data[2] * multiplier;
- ser.calculateBits();
- return ser;
- case Edge_Quad:
- cer = new CurvedEdgeRecord();
- cer.controlDeltaX = data[1] * multiplier;
- cer.controlDeltaY = data[2] * multiplier;
- cer.anchorDeltaX = data[3] * multiplier;
- cer.anchorDeltaY = data[4] * multiplier;
- cer.calculateBits();
- return cer;
- }
- return null;
- }
-
- private int[] readEdge(GFxInputStream sis) throws IOException {
- raw = readRawEdge(sis);
- int data[] = new int[5];
-
- switch (raw[0] & 0xF) {
- case Edge_H12:
- data[0] = Edge_HLine;
- data[1] = ((raw[0] & 0xff) >> 4) | (SInt8(raw[1] & 0xff) << 4);
- break;
-
- case Edge_H20:
- data[0] = Edge_HLine;
- data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8(raw[2] & 0xff) << 12);
- break;
-
- case Edge_V12:
- data[0] = Edge_VLine;
- data[1] = ((raw[0] & 0xff) >> 4) | (SInt8(raw[1] & 0xff) << 4);
- break;
-
- case Edge_V20:
- data[0] = Edge_VLine;
- data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8(raw[2] & 0xff) << 12);
- break;
-
- case Edge_L6:
- data[0] = Edge_Line;
- data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 6) >> 2);
- data[2] = SInt8(raw[1] & 0xff) >> 2;
- break;
-
- case Edge_L10:
- data[0] = Edge_Line;
- data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 2) << 2);
- data[2] = ((raw[1] & 0xff) >> 6) | (SInt8((raw[2] & 0xff)) << 2);
- break;
-
- case Edge_L14:
- data[0] = Edge_Line;
- data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 6) << 6);
- data[2] = ((raw[2] & 0xff) >> 2) | (SInt8((raw[3] & 0xff)) << 6);
- break;
-
- case Edge_L18:
- data[0] = Edge_Line;
- data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 2) << 10);
- data[2] = ((raw[2] & 0xff) >> 6) | ((raw[3] & 0xff) << 2) | (SInt8((raw[4] & 0xff)) << 10);
- break;
-
- case Edge_C5:
- data[0] = Edge_Quad;
- data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 7) >> 3);
- data[2] = SInt8((raw[1] & 0xff) << 2) >> 3;
- data[3] = ((raw[1] & 0xff) >> 6) | (SInt8((raw[2] & 0xff) << 5) >> 3);
- data[4] = SInt8((raw[2] & 0xff)) >> 3;
- break;
-
- case Edge_C7:
- data[0] = Edge_Quad;
- data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 5) >> 1);
- data[2] = ((raw[1] & 0xff) >> 3) | (SInt8((raw[2] & 0xff) << 6) >> 1);
- data[3] = ((raw[2] & 0xff) >> 2) | (SInt8((raw[3] & 0xff) << 7) >> 1);
- data[4] = SInt8(raw[3]) >> 1;
- break;
-
- case Edge_C9:
- data[0] = Edge_Quad;
- data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 3) << 1);
- data[2] = ((raw[1] & 0xff) >> 5) | (SInt8((raw[2] & 0xff) << 2) << 1);
- data[3] = ((raw[2] & 0xff) >> 6) | (SInt8((raw[3] & 0xff) << 1) << 1);
- data[4] = ((raw[3] & 0xff) >> 7) | (SInt8(raw[4] & 0xff) << 1);
- break;
-
- case Edge_C11:
- data[0] = Edge_Quad;
- data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 1) << 3);
- data[2] = (raw[1] >> 7) | ((raw[2] & 0xff) << 1) | (SInt8((raw[3] & 0xff) << 6) << 3);
- data[3] = ((raw[3] & 0xff) >> 2) | (SInt8((raw[4] & 0xff) << 3) << 3);
- data[4] = ((raw[4] & 0xff) >> 5) | (SInt8(raw[5] & 0xff) << 3);
- break;
-
- case Edge_C13:
- data[0] = Edge_Quad;
- data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 7) << 5);
- data[2] = ((raw[2] & 0xff) >> 1) | (SInt8((raw[3] & 0xff) << 2) << 5);
- data[3] = ((raw[3] & 0xff) >> 6) | ((raw[4] & 0xff) << 2) | (SInt8((raw[5] & 0xff) << 5) << 5);
- data[4] = ((raw[5] & 0xff) >> 3) | (SInt8(raw[6] & 0xff) << 5);
- break;
-
- case Edge_C15:
- data[0] = Edge_Quad;
- data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 5) << 7);
- data[2] = ((raw[2] & 0xff) >> 3) | ((raw[3] & 0xff) << 5) | (SInt8((raw[4] & 0xff) << 6) << 7);
- data[3] = ((raw[4] & 0xff) >> 2) | ((raw[5] & 0xff) << 6) | (SInt8((raw[6] & 0xff) << 7) << 7);
- data[4] = ((raw[6] & 0xff) >> 1) | (SInt8((raw[7] & 0xff)) << 7);
- break;
-
- case Edge_C17:
- data[0] = Edge_Quad;
- data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 3) << 9);
- data[2] = ((raw[2] & 0xff) >> 5) | ((raw[3] & 0xff) << 3) | (SInt8((raw[4] & 0xff) << 2) << 9);
- data[3] = ((raw[4] & 0xff) >> 6) | ((raw[5] & 0xff) << 2) | (SInt8((raw[6] & 0xff) << 1) << 9);
- data[4] = ((raw[6] & 0xff) >> 7) | ((raw[7] & 0xff) << 1) | (SInt8(raw[8] & 0xff) << 9);
- break;
-
- case Edge_C19:
- data[0] = Edge_Quad;
- data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8(raw[2] << 1) << 11);
- data[2] = ((raw[2] & 0xff) >> 7) | ((raw[3] & 0xff) << 1) | ((raw[4] & 0xff) << 9) | (SInt8(raw[5] << 6) << 11);
- data[3] = ((raw[5] & 0xff) >> 2) | ((raw[6] & 0xff) << 6) | (SInt8(raw[7] << 3) << 11);
- data[4] = ((raw[7] & 0xff) >> 5) | ((raw[8] & 0xff) << 3) | (SInt8(raw[9]) << 11);
- break;
- }
- return data;
- }
-
- public void write(GFxOutputStream sos) throws IOException {
- int x;
- int y;
- int m1 = 1;
- int m2 = 3;
- int m3 = 7;
- int m4 = 0xF;
- int m5 = 0x1F;
- int m6 = 0x3F;
- int m7 = 0x7F;
- switch (data[0]) {
- case Edge_HLine:
- x = data[1];
- if (x >= GFxOutputStream.MinSInt12 && x <= GFxOutputStream.MaxSInt12) {
- sos.writeUI8((x << 4) | Edge_H12);
- sos.writeUI8(x >> 4);
- return;
- }
- sos.writeUI8((x << 4) | Edge_H20);
- sos.writeUI8(x >> 4);
- sos.writeUI8(x >> 12);
- break;
- case Edge_VLine:
- y = data[1];
- if (y >= GFxOutputStream.MinSInt12 && y <= GFxOutputStream.MaxSInt12) {
- sos.writeUI8((y << 4) | Edge_V12);
- sos.writeUI8(y >> 4);
- return;
- }
- sos.writeUI8((y << 4) | Edge_V20);
- sos.writeUI8(y >> 4);
- sos.writeUI8(y >> 12);
- return;
- case Edge_Line:
- x = data[1];
- y = data[2];
- if (x >= GFxOutputStream.MinSInt6 && x <= GFxOutputStream.MaxSInt6 && y >= GFxOutputStream.MinSInt6 && y <= GFxOutputStream.MaxSInt6) {
- sos.writeUI8((x << 4) | Edge_L6);
- sos.writeUI8(((x >> 4) & m2) | (y << 2));
- return;
- }
- if (x >= GFxOutputStream.MinSInt10 && x <= GFxOutputStream.MaxSInt10 && y >= GFxOutputStream.MinSInt10 && y <= GFxOutputStream.MaxSInt10) {
- sos.writeUI8((x << 4) | Edge_L10);
- sos.writeUI8(((x >> 4) & m6) | (y << 6));
- sos.writeUI8(y >> 2);
- return;
- }
- if (x >= GFxOutputStream.MinSInt14 && x <= GFxOutputStream.MaxSInt14 && y >= GFxOutputStream.MinSInt14 && y <= GFxOutputStream.MaxSInt14) {
- sos.writeUI8((x << 4) | Edge_L14);
- sos.writeUI8(x >> 4);
- sos.writeUI8(((x >> 12) & m2) | (y << 2));
- sos.writeUI8(y >> 6);
- return;
- }
- sos.writeUI8((x << 4) | Edge_L18);
- sos.writeUI8(x >> 4);
- sos.writeUI8(((x >> 12) & m6) | (y << 6));
- sos.writeUI8(y >> 2);
- sos.writeUI8(y >> 10);
- return;
- case Edge_Quad:
- int cx = data[1];
- int cy = data[2];
- int ax = data[3];
- int ay = data[4];
- int minV = cx;
- int maxV = cx;
- if (cy < minV) {
- minV = cy;
- }
- if (cy > maxV) {
- maxV = cy;
- }
- if (ax < minV) {
- minV = ax;
- }
- if (ax > maxV) {
- maxV = ax;
- }
- if (ay < minV) {
- minV = ay;
- }
- if (ay > maxV) {
- maxV = ay;
- }
-
- if (minV >= GFxOutputStream.MinSInt5 && maxV <= GFxOutputStream.MaxSInt5) {
- sos.writeUI8(((cx << 4) | Edge_C5));
- sos.writeUI8((((cx >> 4) & m1) | ((cy << 1) & m6) | (ax << 6)));
- sos.writeUI8((((ax >> 2) & m3) | (ay << 3)));
- return;
- }
- if (minV >= GFxOutputStream.MinSInt7 && maxV <= GFxOutputStream.MaxSInt7) {
- sos.writeUI8(((cx << 4) | Edge_C7));
- sos.writeUI8((((cx >> 4) & m3) | (cy << 3)));
- sos.writeUI8((((cy >> 5) & m2) | (ax << 2)));
- sos.writeUI8((((ax >> 6) & m1) | (ay << 1)));
- return;
- }
- if (minV >= GFxOutputStream.MinSInt9 && maxV <= GFxOutputStream.MaxSInt9) {
- sos.writeUI8(((cx << 4) | Edge_C9));
- sos.writeUI8((((cx >> 4) & m5) | (cy << 5)));
- sos.writeUI8((((cy >> 3) & m6) | (ax << 6)));
- sos.writeUI8((((ax >> 2) & m7) | (ay << 7)));
- sos.writeUI8(((ay >> 1)));
- return;
- }
- if (minV >= GFxOutputStream.MinSInt11 && maxV <= GFxOutputStream.MaxSInt11) {
- sos.writeUI8(((cx << 4) | Edge_C11));
- sos.writeUI8((((cx >> 4) & m7) | (cy << 7)));
- sos.writeUI8(((cy >> 1)));
- sos.writeUI8((((cy >> 9) & m2) | (ax << 2)));
- sos.writeUI8((((ax >> 6) & m5) | (ay << 5)));
- sos.writeUI8(((ay >> 3)));
- return;
- }
- if (minV >= GFxOutputStream.MinSInt13 && maxV <= GFxOutputStream.MaxSInt13) {
- sos.writeUI8(((cx << 4) | Edge_C13));
- sos.writeUI8(((cx >> 4)));
- sos.writeUI8((((cx >> 12) & m1) | (cy << 1)));
- sos.writeUI8((((cy >> 7) & m6) | (ax << 6)));
- sos.writeUI8(((ax >> 2)));
- sos.writeUI8((((ax >> 10) & m3) | (ay << 3)));
- sos.writeUI8(((ay >> 5)));
- return;
- }
- if (minV >= GFxOutputStream.MinSInt15 && maxV <= GFxOutputStream.MaxSInt15) {
- sos.writeUI8(((cx << 4) | Edge_C15));
- sos.writeUI8(((cx >> 4)));
- sos.writeUI8((((cx >> 12) & m3) | (cy << 3)));
- sos.writeUI8(((cy >> 5)));
- sos.writeUI8((((cy >> 13) & m2) | (ax << 2)));
- sos.writeUI8(((ax >> 6)));
- sos.writeUI8((((ax >> 14) & m1) | (ay << 1)));
- sos.writeUI8(((ay >> 7)));
- return;
- }
- if (minV >= GFxOutputStream.MinSInt17 && maxV <= GFxOutputStream.MaxSInt17) {
- sos.writeUI8(((cx << 4) | Edge_C17));
- sos.writeUI8(((cx >> 4)));
- sos.writeUI8((((cx >> 12) & m5) | (cy << 5)));
- sos.writeUI8(((cy >> 3)));
- sos.writeUI8((((cy >> 11) & m6) | (ax << 6)));
- sos.writeUI8(((ax >> 2)));
- sos.writeUI8((((ax >> 10) & m7) | (ay << 7)));
- sos.writeUI8(((ay >> 1)));
- sos.writeUI8(((ay >> 9)));
- return;
- }
- sos.writeUI8(((cx << 4) | Edge_C19));
- sos.writeUI8(((cx >> 4)));
- sos.writeUI8((((cx >> 12) & m7) | (cy << 7)));
- sos.writeUI8(((cy >> 1)));
- sos.writeUI8(((cy >> 9)));
- sos.writeUI8((((cy >> 17) & m2) | (ax << 2)));
- sos.writeUI8(((ax >> 6)));
- sos.writeUI8((((ax >> 14) & m5) | (ay << 5)));
- sos.writeUI8(((ay >> 3)));
- sos.writeUI8(((ay >> 11)));
- }
- }
-}
+/*
+ * Copyright (C) 2010-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 .
+ */
+package com.jpexs.decompiler.flash.types.gfx;
+
+import com.jpexs.decompiler.flash.types.shaperecords.CurvedEdgeRecord;
+import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
+import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class EdgeType implements Serializable {
+
+ private static final int sizes[] = new int[]{1, 2, 1, 2, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8, 9};
+ private static final int Edge_H12 = 0; // 2 bytes
+ private static final int Edge_H20 = 1; // 3 bytes
+ private static final int Edge_V12 = 2; // 2 bytes
+ private static final int Edge_V20 = 3; // 3 bytes
+ private static final int Edge_L6 = 4; // 2 bytes
+ private static final int Edge_L10 = 5; // 3 bytes
+ private static final int Edge_L14 = 6; // 4 bytes
+ private static final int Edge_L18 = 7; // 5 bytes
+ private static final int Edge_C5 = 8; // 3 bytes
+ private static final int Edge_C7 = 9; // 4 bytes
+ private static final int Edge_C9 = 10; // 5 bytes
+ private static final int Edge_C11 = 11; // 6 bytes
+ private static final int Edge_C13 = 12; // 7 bytes
+ private static final int Edge_C15 = 13; // 8 bytes
+ private static final int Edge_C17 = 14; // 9 bytes
+ private static final int Edge_C19 = 15; // 10 bytes
+ private static final int Edge_HLine = 0;
+ private static final int Edge_VLine = 1;
+ private static final int Edge_Line = 2;
+ private static final int Edge_Quad = 3;
+ public int data[];
+ public byte raw[];
+
+ public EdgeType(boolean vertical, int v) {
+ data = new int[]{vertical ? Edge_VLine : Edge_HLine, v};
+ calcRaw();
+ }
+
+ public EdgeType(int x, int y) {
+ data = new int[]{Edge_Line, x, y};
+ calcRaw();
+ }
+
+ public EdgeType(int cx, int cy, int ax, int ay) {
+ data = new int[]{Edge_Quad, cx, cy, ax, ay};
+ calcRaw();
+ }
+
+ private void calcRaw() {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ GFxOutputStream sos = new GFxOutputStream(baos);
+ try {
+ write(sos);
+ } catch (IOException ex) {
+ Logger.getLogger(EdgeType.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ raw = baos.toByteArray();
+ }
+
+ @Override
+ public String toString() {
+ String ret = "[Edge " + (raw[0] & 0xf) + " data:";
+ for (int i = 0; i < data.length; i++) {
+ if (i > 0) {
+ ret += ", ";
+ }
+ ret += "" + data[i];
+ }
+ ret += " raw: 0x";
+ for (int i = 0; i < raw.length; i++) {
+ if (i > 0) {
+ ret += "";
+ }
+ String h = Integer.toHexString(raw[i] & 0xff);
+ if (h.length() < 2) {
+ h = "0" + h;
+ }
+ ret += "" + h;
+ }
+ ret += "]";
+ return ret;
+ }
+
+ public EdgeType(GFxInputStream sis) throws IOException {
+ data = readEdge(sis);
+ /*if((raw[0]&0xf) == Edge_V20){
+ data[1] = 0;
+ }
+ if((raw[0]&0xf) == Edge_C17){
+ //System.out.println("========== 17 : "+toString()) ;
+ data[1] = 0;
+ data[2] = 0;
+ data[3] = 0;
+ data[4] = 0;
+ }*/
+ }
+
+ private byte[] readRawEdge(GFxInputStream sis) throws IOException {
+ int firstByte = sis.readUI8("firstByte");
+ int nb = sizes[firstByte & 0xF];
+ byte ret[] = new byte[1 + nb];
+ ret[0] = (byte) firstByte;
+ int i;
+ for (i = 0; i < nb; i++) {
+ ret[i + 1] = (byte) sis.readUI8("byte");
+ }
+
+ return ret;
+ }
+
+ private static int SInt8(int val) {
+ /*boolean sign = (val & 0x80) == 0x80;
+ val = val & 0x7F;
+ if (sign) {
+ val = -val;
+ }
+ return val;*/
+ return (byte) val;
+ }
+
+ public SHAPERECORD toSHAPERECORD() {
+ int multiplier = 1;
+ StraightEdgeRecord ser;
+ CurvedEdgeRecord cer;
+ switch (data[0]) {
+ case Edge_HLine:
+ ser = new StraightEdgeRecord();
+ ser.generalLineFlag = false;
+ ser.deltaX = data[1] * multiplier;
+ ser.calculateBits();
+ return ser;
+ case Edge_VLine:
+ ser = new StraightEdgeRecord();
+ ser.generalLineFlag = false;
+ ser.vertLineFlag = true;
+ ser.deltaY = data[1] * multiplier;
+ ser.calculateBits();
+ return ser;
+ case Edge_Line:
+ ser = new StraightEdgeRecord();
+ ser.generalLineFlag = true;
+ ser.deltaX = data[1] * multiplier;
+ ser.deltaY = data[2] * multiplier;
+ ser.calculateBits();
+ return ser;
+ case Edge_Quad:
+ cer = new CurvedEdgeRecord();
+ cer.controlDeltaX = data[1] * multiplier;
+ cer.controlDeltaY = data[2] * multiplier;
+ cer.anchorDeltaX = data[3] * multiplier;
+ cer.anchorDeltaY = data[4] * multiplier;
+ cer.calculateBits();
+ return cer;
+ }
+ return null;
+ }
+
+ private int[] readEdge(GFxInputStream sis) throws IOException {
+ raw = readRawEdge(sis);
+ int data[] = new int[5];
+
+ switch (raw[0] & 0xF) {
+ case Edge_H12:
+ data[0] = Edge_HLine;
+ data[1] = ((raw[0] & 0xff) >> 4) | (SInt8(raw[1] & 0xff) << 4);
+ break;
+
+ case Edge_H20:
+ data[0] = Edge_HLine;
+ data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8(raw[2] & 0xff) << 12);
+ break;
+
+ case Edge_V12:
+ data[0] = Edge_VLine;
+ data[1] = ((raw[0] & 0xff) >> 4) | (SInt8(raw[1] & 0xff) << 4);
+ break;
+
+ case Edge_V20:
+ data[0] = Edge_VLine;
+ data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8(raw[2] & 0xff) << 12);
+ break;
+
+ case Edge_L6:
+ data[0] = Edge_Line;
+ data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 6) >> 2);
+ data[2] = SInt8(raw[1] & 0xff) >> 2;
+ break;
+
+ case Edge_L10:
+ data[0] = Edge_Line;
+ data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 2) << 2);
+ data[2] = ((raw[1] & 0xff) >> 6) | (SInt8((raw[2] & 0xff)) << 2);
+ break;
+
+ case Edge_L14:
+ data[0] = Edge_Line;
+ data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 6) << 6);
+ data[2] = ((raw[2] & 0xff) >> 2) | (SInt8((raw[3] & 0xff)) << 6);
+ break;
+
+ case Edge_L18:
+ data[0] = Edge_Line;
+ data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 2) << 10);
+ data[2] = ((raw[2] & 0xff) >> 6) | ((raw[3] & 0xff) << 2) | (SInt8((raw[4] & 0xff)) << 10);
+ break;
+
+ case Edge_C5:
+ data[0] = Edge_Quad;
+ data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 7) >> 3);
+ data[2] = SInt8((raw[1] & 0xff) << 2) >> 3;
+ data[3] = ((raw[1] & 0xff) >> 6) | (SInt8((raw[2] & 0xff) << 5) >> 3);
+ data[4] = SInt8((raw[2] & 0xff)) >> 3;
+ break;
+
+ case Edge_C7:
+ data[0] = Edge_Quad;
+ data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 5) >> 1);
+ data[2] = ((raw[1] & 0xff) >> 3) | (SInt8((raw[2] & 0xff) << 6) >> 1);
+ data[3] = ((raw[2] & 0xff) >> 2) | (SInt8((raw[3] & 0xff) << 7) >> 1);
+ data[4] = SInt8(raw[3]) >> 1;
+ break;
+
+ case Edge_C9:
+ data[0] = Edge_Quad;
+ data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 3) << 1);
+ data[2] = ((raw[1] & 0xff) >> 5) | (SInt8((raw[2] & 0xff) << 2) << 1);
+ data[3] = ((raw[2] & 0xff) >> 6) | (SInt8((raw[3] & 0xff) << 1) << 1);
+ data[4] = ((raw[3] & 0xff) >> 7) | (SInt8(raw[4] & 0xff) << 1);
+ break;
+
+ case Edge_C11:
+ data[0] = Edge_Quad;
+ data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 1) << 3);
+ data[2] = (raw[1] >> 7) | ((raw[2] & 0xff) << 1) | (SInt8((raw[3] & 0xff) << 6) << 3);
+ data[3] = ((raw[3] & 0xff) >> 2) | (SInt8((raw[4] & 0xff) << 3) << 3);
+ data[4] = ((raw[4] & 0xff) >> 5) | (SInt8(raw[5] & 0xff) << 3);
+ break;
+
+ case Edge_C13:
+ data[0] = Edge_Quad;
+ data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 7) << 5);
+ data[2] = ((raw[2] & 0xff) >> 1) | (SInt8((raw[3] & 0xff) << 2) << 5);
+ data[3] = ((raw[3] & 0xff) >> 6) | ((raw[4] & 0xff) << 2) | (SInt8((raw[5] & 0xff) << 5) << 5);
+ data[4] = ((raw[5] & 0xff) >> 3) | (SInt8(raw[6] & 0xff) << 5);
+ break;
+
+ case Edge_C15:
+ data[0] = Edge_Quad;
+ data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 5) << 7);
+ data[2] = ((raw[2] & 0xff) >> 3) | ((raw[3] & 0xff) << 5) | (SInt8((raw[4] & 0xff) << 6) << 7);
+ data[3] = ((raw[4] & 0xff) >> 2) | ((raw[5] & 0xff) << 6) | (SInt8((raw[6] & 0xff) << 7) << 7);
+ data[4] = ((raw[6] & 0xff) >> 1) | (SInt8((raw[7] & 0xff)) << 7);
+ break;
+
+ case Edge_C17:
+ data[0] = Edge_Quad;
+ data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 3) << 9);
+ data[2] = ((raw[2] & 0xff) >> 5) | ((raw[3] & 0xff) << 3) | (SInt8((raw[4] & 0xff) << 2) << 9);
+ data[3] = ((raw[4] & 0xff) >> 6) | ((raw[5] & 0xff) << 2) | (SInt8((raw[6] & 0xff) << 1) << 9);
+ data[4] = ((raw[6] & 0xff) >> 7) | ((raw[7] & 0xff) << 1) | (SInt8(raw[8] & 0xff) << 9);
+ break;
+
+ case Edge_C19:
+ data[0] = Edge_Quad;
+ data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8(raw[2] << 1) << 11);
+ data[2] = ((raw[2] & 0xff) >> 7) | ((raw[3] & 0xff) << 1) | ((raw[4] & 0xff) << 9) | (SInt8(raw[5] << 6) << 11);
+ data[3] = ((raw[5] & 0xff) >> 2) | ((raw[6] & 0xff) << 6) | (SInt8(raw[7] << 3) << 11);
+ data[4] = ((raw[7] & 0xff) >> 5) | ((raw[8] & 0xff) << 3) | (SInt8(raw[9]) << 11);
+ break;
+ }
+ return data;
+ }
+
+ public void write(GFxOutputStream sos) throws IOException {
+ int x;
+ int y;
+ int m1 = 1;
+ int m2 = 3;
+ int m3 = 7;
+ int m4 = 0xF;
+ int m5 = 0x1F;
+ int m6 = 0x3F;
+ int m7 = 0x7F;
+ switch (data[0]) {
+ case Edge_HLine:
+ x = data[1];
+ if (x >= GFxOutputStream.MinSInt12 && x <= GFxOutputStream.MaxSInt12) {
+ sos.writeUI8((x << 4) | Edge_H12);
+ sos.writeUI8(x >> 4);
+ return;
+ }
+ sos.writeUI8((x << 4) | Edge_H20);
+ sos.writeUI8(x >> 4);
+ sos.writeUI8(x >> 12);
+ break;
+ case Edge_VLine:
+ y = data[1];
+ if (y >= GFxOutputStream.MinSInt12 && y <= GFxOutputStream.MaxSInt12) {
+ sos.writeUI8((y << 4) | Edge_V12);
+ sos.writeUI8(y >> 4);
+ return;
+ }
+ sos.writeUI8((y << 4) | Edge_V20);
+ sos.writeUI8(y >> 4);
+ sos.writeUI8(y >> 12);
+ return;
+ case Edge_Line:
+ x = data[1];
+ y = data[2];
+ if (x >= GFxOutputStream.MinSInt6 && x <= GFxOutputStream.MaxSInt6 && y >= GFxOutputStream.MinSInt6 && y <= GFxOutputStream.MaxSInt6) {
+ sos.writeUI8((x << 4) | Edge_L6);
+ sos.writeUI8(((x >> 4) & m2) | (y << 2));
+ return;
+ }
+ if (x >= GFxOutputStream.MinSInt10 && x <= GFxOutputStream.MaxSInt10 && y >= GFxOutputStream.MinSInt10 && y <= GFxOutputStream.MaxSInt10) {
+ sos.writeUI8((x << 4) | Edge_L10);
+ sos.writeUI8(((x >> 4) & m6) | (y << 6));
+ sos.writeUI8(y >> 2);
+ return;
+ }
+ if (x >= GFxOutputStream.MinSInt14 && x <= GFxOutputStream.MaxSInt14 && y >= GFxOutputStream.MinSInt14 && y <= GFxOutputStream.MaxSInt14) {
+ sos.writeUI8((x << 4) | Edge_L14);
+ sos.writeUI8(x >> 4);
+ sos.writeUI8(((x >> 12) & m2) | (y << 2));
+ sos.writeUI8(y >> 6);
+ return;
+ }
+ sos.writeUI8((x << 4) | Edge_L18);
+ sos.writeUI8(x >> 4);
+ sos.writeUI8(((x >> 12) & m6) | (y << 6));
+ sos.writeUI8(y >> 2);
+ sos.writeUI8(y >> 10);
+ return;
+ case Edge_Quad:
+ int cx = data[1];
+ int cy = data[2];
+ int ax = data[3];
+ int ay = data[4];
+ int minV = cx;
+ int maxV = cx;
+ if (cy < minV) {
+ minV = cy;
+ }
+ if (cy > maxV) {
+ maxV = cy;
+ }
+ if (ax < minV) {
+ minV = ax;
+ }
+ if (ax > maxV) {
+ maxV = ax;
+ }
+ if (ay < minV) {
+ minV = ay;
+ }
+ if (ay > maxV) {
+ maxV = ay;
+ }
+
+ if (minV >= GFxOutputStream.MinSInt5 && maxV <= GFxOutputStream.MaxSInt5) {
+ sos.writeUI8(((cx << 4) | Edge_C5));
+ sos.writeUI8((((cx >> 4) & m1) | ((cy << 1) & m6) | (ax << 6)));
+ sos.writeUI8((((ax >> 2) & m3) | (ay << 3)));
+ return;
+ }
+ if (minV >= GFxOutputStream.MinSInt7 && maxV <= GFxOutputStream.MaxSInt7) {
+ sos.writeUI8(((cx << 4) | Edge_C7));
+ sos.writeUI8((((cx >> 4) & m3) | (cy << 3)));
+ sos.writeUI8((((cy >> 5) & m2) | (ax << 2)));
+ sos.writeUI8((((ax >> 6) & m1) | (ay << 1)));
+ return;
+ }
+ if (minV >= GFxOutputStream.MinSInt9 && maxV <= GFxOutputStream.MaxSInt9) {
+ sos.writeUI8(((cx << 4) | Edge_C9));
+ sos.writeUI8((((cx >> 4) & m5) | (cy << 5)));
+ sos.writeUI8((((cy >> 3) & m6) | (ax << 6)));
+ sos.writeUI8((((ax >> 2) & m7) | (ay << 7)));
+ sos.writeUI8(((ay >> 1)));
+ return;
+ }
+ if (minV >= GFxOutputStream.MinSInt11 && maxV <= GFxOutputStream.MaxSInt11) {
+ sos.writeUI8(((cx << 4) | Edge_C11));
+ sos.writeUI8((((cx >> 4) & m7) | (cy << 7)));
+ sos.writeUI8(((cy >> 1)));
+ sos.writeUI8((((cy >> 9) & m2) | (ax << 2)));
+ sos.writeUI8((((ax >> 6) & m5) | (ay << 5)));
+ sos.writeUI8(((ay >> 3)));
+ return;
+ }
+ if (minV >= GFxOutputStream.MinSInt13 && maxV <= GFxOutputStream.MaxSInt13) {
+ sos.writeUI8(((cx << 4) | Edge_C13));
+ sos.writeUI8(((cx >> 4)));
+ sos.writeUI8((((cx >> 12) & m1) | (cy << 1)));
+ sos.writeUI8((((cy >> 7) & m6) | (ax << 6)));
+ sos.writeUI8(((ax >> 2)));
+ sos.writeUI8((((ax >> 10) & m3) | (ay << 3)));
+ sos.writeUI8(((ay >> 5)));
+ return;
+ }
+ if (minV >= GFxOutputStream.MinSInt15 && maxV <= GFxOutputStream.MaxSInt15) {
+ sos.writeUI8(((cx << 4) | Edge_C15));
+ sos.writeUI8(((cx >> 4)));
+ sos.writeUI8((((cx >> 12) & m3) | (cy << 3)));
+ sos.writeUI8(((cy >> 5)));
+ sos.writeUI8((((cy >> 13) & m2) | (ax << 2)));
+ sos.writeUI8(((ax >> 6)));
+ sos.writeUI8((((ax >> 14) & m1) | (ay << 1)));
+ sos.writeUI8(((ay >> 7)));
+ return;
+ }
+ if (minV >= GFxOutputStream.MinSInt17 && maxV <= GFxOutputStream.MaxSInt17) {
+ sos.writeUI8(((cx << 4) | Edge_C17));
+ sos.writeUI8(((cx >> 4)));
+ sos.writeUI8((((cx >> 12) & m5) | (cy << 5)));
+ sos.writeUI8(((cy >> 3)));
+ sos.writeUI8((((cy >> 11) & m6) | (ax << 6)));
+ sos.writeUI8(((ax >> 2)));
+ sos.writeUI8((((ax >> 10) & m7) | (ay << 7)));
+ sos.writeUI8(((ay >> 1)));
+ sos.writeUI8(((ay >> 9)));
+ return;
+ }
+ sos.writeUI8(((cx << 4) | Edge_C19));
+ sos.writeUI8(((cx >> 4)));
+ sos.writeUI8((((cx >> 12) & m7) | (cy << 7)));
+ sos.writeUI8(((cy >> 1)));
+ sos.writeUI8(((cy >> 9)));
+ sos.writeUI8((((cy >> 17) & m2) | (ax << 2)));
+ sos.writeUI8(((ax >> 6)));
+ sos.writeUI8((((ax >> 14) & m5) | (ay << 5)));
+ sos.writeUI8(((ay >> 3)));
+ sos.writeUI8(((ay >> 11)));
+ }
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/types/gfx/FONTINFO.java b/src/com/jpexs/decompiler/flash/types/gfx/FONTINFO.java
index 428a31afe..1b3cca497 100644
--- a/src/com/jpexs/decompiler/flash/types/gfx/FONTINFO.java
+++ b/src/com/jpexs/decompiler/flash/types/gfx/FONTINFO.java
@@ -1,52 +1,52 @@
-/*
- * Copyright (C) 2010-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 .
- */
-package com.jpexs.decompiler.flash.types.gfx;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- *
- * @author JPEXS
- */
-public class FONTINFO implements Serializable {
-
- public int fontId;
- public GLYPHIDX glyphIndices[];
-
- public FONTINFO(int fontId, int numGlyphs, GLYPHIDX[] glyphIndices) {
- this.fontId = fontId;
- this.glyphIndices = glyphIndices;
- }
-
- public FONTINFO(GFxInputStream sis) throws IOException {
- fontId = sis.readUI16();
- int numGlyphs = sis.readUI16();
- glyphIndices = new GLYPHIDX[numGlyphs];
- for (int i = 0; i < numGlyphs; i++) {
- glyphIndices[i] = new GLYPHIDX(sis);
- }
- }
-
- public void write(GFxOutputStream sos) throws IOException {
- sos.writeUI16(fontId);
- sos.writeUI16(glyphIndices.length);
- for (int i = 0; i < glyphIndices.length; i++) {
- glyphIndices[i].write(sos);
- }
- }
-}
+/*
+ * Copyright (C) 2010-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 .
+ */
+package com.jpexs.decompiler.flash.types.gfx;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class FONTINFO implements Serializable {
+
+ public int fontId;
+ public GLYPHIDX glyphIndices[];
+
+ public FONTINFO(int fontId, int numGlyphs, GLYPHIDX[] glyphIndices) {
+ this.fontId = fontId;
+ this.glyphIndices = glyphIndices;
+ }
+
+ public FONTINFO(GFxInputStream sis) throws IOException {
+ fontId = sis.readUI16("fontId");
+ int numGlyphs = sis.readUI16("numGlyphs");
+ glyphIndices = new GLYPHIDX[numGlyphs];
+ for (int i = 0; i < numGlyphs; i++) {
+ glyphIndices[i] = new GLYPHIDX(sis);
+ }
+ }
+
+ public void write(GFxOutputStream sos) throws IOException {
+ sos.writeUI16(fontId);
+ sos.writeUI16(glyphIndices.length);
+ for (int i = 0; i < glyphIndices.length; i++) {
+ glyphIndices[i].write(sos);
+ }
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/types/gfx/FontType.java b/src/com/jpexs/decompiler/flash/types/gfx/FontType.java
index da02fb68c..456faa088 100644
--- a/src/com/jpexs/decompiler/flash/types/gfx/FontType.java
+++ b/src/com/jpexs/decompiler/flash/types/gfx/FontType.java
@@ -42,14 +42,14 @@ public class FontType implements Serializable {
public List kerning;
public FontType(GFxInputStream sis) throws IOException {
- fontName = sis.readString();
- flags = sis.readUI16();
- nominalSize = sis.readUI16();
- ascent = sis.readSI16();
- descent = sis.readSI16();
- leading = sis.readSI16();
- long numGlyphs = sis.readUI32();
- long glyphBytesLen = sis.readUI32();
+ fontName = sis.readString("fontName");
+ flags = sis.readUI16("flags");
+ nominalSize = sis.readUI16("nominalSize");
+ ascent = sis.readSI16("ascent");
+ descent = sis.readSI16("descent");
+ leading = sis.readSI16("leading");
+ long numGlyphs = sis.readUI32("numGlyphs");
+ long glyphBytesLen = sis.readUI32("glyphBytesLen");
byte glyphBytes[] = new byte[(int) glyphBytesLen];
sis.read(glyphBytes);
glyphInfo = new ArrayList<>();
@@ -57,7 +57,7 @@ public class FontType implements Serializable {
glyphInfo.add(new GlyphInfoType(sis));
}
- long kerningTableSize = sis.readUI30();
+ long kerningTableSize = sis.readUI30("kerningTableSize");
kerning = new ArrayList<>();
for (int i = 0; i < kerningTableSize; i++) {
kerning.add(new KerningPairType(sis));
diff --git a/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java b/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java
index 15f574feb..f5cc2d463 100644
--- a/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java
+++ b/src/com/jpexs/decompiler/flash/types/gfx/GFxInputStream.java
@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.types.gfx;
+import com.jpexs.decompiler.flash.dumpview.DumpInfo;
import com.jpexs.helpers.MemoryInputStream;
import com.jpexs.helpers.utf8.Utf8Helper;
import java.io.ByteArrayOutputStream;
@@ -29,11 +30,36 @@ public class GFxInputStream {
private final MemoryInputStream is;
private static final int MaxUInt7 = (1 << 7) - 1;
+ public DumpInfo dumpInfo;
public GFxInputStream(MemoryInputStream is) {
this.is = is;
}
+ public DumpInfo newDumpLevel(String name, String type) {
+ if (dumpInfo != null) {
+ long startByte = is.getPos();
+ DumpInfo di = new DumpInfo(name, type, null, startByte, 0, 0, 0);
+ di.parent = dumpInfo;
+ dumpInfo.getChildInfos().add(di);
+ dumpInfo = di;
+ }
+
+ return dumpInfo;
+ }
+
+ public void endDumpLevel() {
+ endDumpLevel(null);
+ }
+
+ public void endDumpLevel(Object value) {
+ if (dumpInfo != null) {
+ dumpInfo.lengthBytes = is.getPos() - dumpInfo.startByte;
+ dumpInfo.previewValue = value;
+ dumpInfo = dumpInfo.parent;
+ }
+ }
+
public int available() throws IOException {
return is.available();
}
@@ -46,16 +72,22 @@ public class GFxInputStream {
return is.getPos();
}
- public int read() throws IOException {
+ private int read() throws IOException {
return is.read();
}
- public int readUI8() throws IOException {
- return read();
+ public int readUI8(String name) throws IOException {
+ newDumpLevel(name, "UI8");
+ int ret = read();
+ endDumpLevel(ret);
+ return ret;
}
- public int readUI16() throws IOException {
- return read() + (read() << 8);
+ public int readUI16(String name) throws IOException {
+ newDumpLevel(name, "UI8");
+ int ret = read() + (read() << 8);
+ endDumpLevel(ret);
+ return ret;
}
/**
@@ -64,81 +96,109 @@ public class GFxInputStream {
* @return SI16 value
* @throws IOException
*/
- public int readSI16() throws IOException {
+ public int readSI16(String name) throws IOException {
+ newDumpLevel(name, "SI16");
int uval = read() + (read() << 8);
if (uval >= 0x8000) {
- return -(((~uval) & 0xffff) + 1);
- } else {
- return uval;
+ uval = -(((~uval) & 0xffff) + 1);
}
+ endDumpLevel(uval);
+ return uval;
}
- public long readUI32() throws IOException {
- return (read() + (read() << 8) + (read() << 16) + (read() << 24)) & 0xffffffff;
+ private long readUI32Internal() throws IOException {
+ long ret = (read() + (read() << 8) + (read() << 16) + (read() << 24)) & 0xffffffff;
+ return ret;
}
- public long readUI30() throws IOException {
+ public long readUI32(String name) throws IOException {
+ newDumpLevel(name, "UI32");
+ long ret = readUI32Internal();
+ endDumpLevel(ret);
+ return ret;
+ }
+
+ public long readUI30(String name) throws IOException {
+ newDumpLevel(name, "UI30");
long v;
- int tb = readUI8();
+ int tb = read();
long t = tb;
switch (tb & 3) {
case 0:
v = t >> 2;
+ endDumpLevel(v);
return v;
case 1:
t >>= 2;
- v = t | (readUI8() << 6);
+ v = t | (read() << 6);
+ endDumpLevel(v);
return v;
case 2:
t >>= 2;
- t |= (readUI8() << 6);
- v = t | (readUI8() << 14);
+ t |= (read() << 6);
+ v = t | (read() << 14);
+ endDumpLevel(v);
return v;
}
t >>= 2;
- t |= (readUI8() << 6);
- t |= (readUI8() << 14);
- v = t | (readUI8() << 22);
+ t |= (read() << 6);
+ t |= (read() << 14);
+ v = t | (read() << 22);
+ endDumpLevel(v);
return v;
}
- public float readFLOAT() throws IOException {
- int val = (int) readUI32();
+ public float readFLOAT(String name) throws IOException {
+ newDumpLevel(name, "UI32");
+ int val = (int) readUI32Internal();
float ret = Float.intBitsToFloat(val);
+ endDumpLevel(ret);
return ret;
}
- public int readSI8() throws IOException {
- int uval = read();
- if (uval >= 0x80) {
- return -(((~uval) & 0xff) + 1);
- } else {
- return uval;
- }
+ public int readSI8(String name) throws IOException {
+ newDumpLevel(name, "SI8");
+ int uval = readSI8Internal();
+ endDumpLevel(uval);
+ return uval;
}
- public int readSI15() throws IOException {
- int t = readSI8();
+ private int readSI8Internal() throws IOException {
+ int uval = read();
+ if (uval >= 0x80) {
+ uval = -(((~uval) & 0xff) + 1);
+ }
+ return uval;
+ }
+
+ public int readSI15(String name) throws IOException {
+ newDumpLevel(name, "SI15");
+ int t = readSI8Internal();
int v;
if ((t & 1) == 0) {
v = t >> 1;
+ endDumpLevel(v);
return v;
}
t = ((t >> 1) & MaxUInt7);
- v = (t | (readSI8() << 7));
+ v = (t | (readSI8Internal() << 7));
+ endDumpLevel(v);
return v;
}
- public int readUI15() throws IOException {
- int t = readUI8();
+ public int readUI15(String name) throws IOException {
+ newDumpLevel(name, "UI15");
+ int t = read();
int v;
if ((t & 1) == 0) {
v = t >> 1;
+ endDumpLevel(v);
return v;
}
t = (t >> 1);
- v = (t | (readUI8() << 7));
+ v = (t | (read() << 7));
+ endDumpLevel(v);
return v;
}
@@ -149,14 +209,16 @@ public class GFxInputStream {
* @return Array of read bytes
* @throws IOException
*/
- public byte[] readBytes(long count) throws IOException {
+ public byte[] readBytes(long count, String name) throws IOException {
if (count <= 0) {
return new byte[0];
}
+ newDumpLevel(name, "bytes");
byte[] ret = new byte[(int) count];
for (int i = 0; i < count; i++) {
ret[i] = (byte) read();
}
+ endDumpLevel();
return ret;
}
@@ -170,13 +232,16 @@ public class GFxInputStream {
* @return String value
* @throws IOException
*/
- public String readString() throws IOException {
+ public String readString(String name) throws IOException {
+ newDumpLevel(name, "string");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int r;
while (true) {
- r = readUI8();
+ r = read();
if (r == 0) {
- return new String(baos.toByteArray(), Utf8Helper.charset);
+ String res = new String(baos.toByteArray(), Utf8Helper.charset);
+ endDumpLevel(res);
+ return res;
}
baos.write(r);
}
diff --git a/src/com/jpexs/decompiler/flash/types/gfx/GLYPHIDX.java b/src/com/jpexs/decompiler/flash/types/gfx/GLYPHIDX.java
index 6b6116a29..b031c97a0 100644
--- a/src/com/jpexs/decompiler/flash/types/gfx/GLYPHIDX.java
+++ b/src/com/jpexs/decompiler/flash/types/gfx/GLYPHIDX.java
@@ -1,45 +1,45 @@
-/*
- * Copyright (C) 2010-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 .
- */
-package com.jpexs.decompiler.flash.types.gfx;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- *
- * @author JPEXS
- */
-public class GLYPHIDX implements Serializable {
-
- public int indexInFont;
- public int indexInTexture;
-
- public GLYPHIDX(int indexInFont, int indexInTexture) {
- this.indexInFont = indexInFont;
- this.indexInTexture = indexInTexture;
- }
-
- public GLYPHIDX(GFxInputStream sis) throws IOException {
- this.indexInFont = sis.readUI16();
- this.indexInTexture = sis.readUI16();
- }
-
- public void write(GFxOutputStream sos) throws IOException {
- sos.writeUI16(indexInFont);
- sos.writeUI16(indexInTexture);
- }
-}
+/*
+ * Copyright (C) 2010-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 .
+ */
+package com.jpexs.decompiler.flash.types.gfx;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class GLYPHIDX implements Serializable {
+
+ public int indexInFont;
+ public int indexInTexture;
+
+ public GLYPHIDX(int indexInFont, int indexInTexture) {
+ this.indexInFont = indexInFont;
+ this.indexInTexture = indexInTexture;
+ }
+
+ public GLYPHIDX(GFxInputStream sis) throws IOException {
+ this.indexInFont = sis.readUI16("indexInFont");
+ this.indexInTexture = sis.readUI16("indexInTexture");
+ }
+
+ public void write(GFxOutputStream sos) throws IOException {
+ sos.writeUI16(indexInFont);
+ sos.writeUI16(indexInTexture);
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/types/gfx/GlyphInfoType.java b/src/com/jpexs/decompiler/flash/types/gfx/GlyphInfoType.java
index 7ec64d695..10b479b3f 100644
--- a/src/com/jpexs/decompiler/flash/types/gfx/GlyphInfoType.java
+++ b/src/com/jpexs/decompiler/flash/types/gfx/GlyphInfoType.java
@@ -1,49 +1,49 @@
-/*
- * Copyright (C) 2010-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 .
- */
-package com.jpexs.decompiler.flash.types.gfx;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- *
- * @author JPEXS
- */
-public class GlyphInfoType implements Serializable {
-
- public int glyphCode;
- public int advanceX;
- public long globalOffset;
-
- public GlyphInfoType(int glyphCode, int advance, int glyphPos) {
- this.glyphCode = glyphCode;
- this.advanceX = advance;
- this.globalOffset = glyphPos;
- }
-
- public GlyphInfoType(GFxInputStream sis) throws IOException {
- this.glyphCode = sis.readUI16();
- this.advanceX = sis.readSI16();
- this.globalOffset = sis.readUI32();
- }
-
- public void write(GFxOutputStream sos) throws IOException {
- sos.writeUI16(glyphCode);
- sos.writeSI16(advanceX);
- sos.writeUI32(globalOffset);
- }
-}
+/*
+ * Copyright (C) 2010-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 .
+ */
+package com.jpexs.decompiler.flash.types.gfx;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class GlyphInfoType implements Serializable {
+
+ public int glyphCode;
+ public int advanceX;
+ public long globalOffset;
+
+ public GlyphInfoType(int glyphCode, int advance, int glyphPos) {
+ this.glyphCode = glyphCode;
+ this.advanceX = advance;
+ this.globalOffset = glyphPos;
+ }
+
+ public GlyphInfoType(GFxInputStream sis) throws IOException {
+ this.glyphCode = sis.readUI16("glyphCode");
+ this.advanceX = sis.readSI16("advanceX");
+ this.globalOffset = sis.readUI32("globalOffset");
+ }
+
+ public void write(GFxOutputStream sos) throws IOException {
+ sos.writeUI16(glyphCode);
+ sos.writeSI16(advanceX);
+ sos.writeUI32(globalOffset);
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/types/gfx/GlyphType.java b/src/com/jpexs/decompiler/flash/types/gfx/GlyphType.java
index db566989e..8dfa3b5f7 100644
--- a/src/com/jpexs/decompiler/flash/types/gfx/GlyphType.java
+++ b/src/com/jpexs/decompiler/flash/types/gfx/GlyphType.java
@@ -1,104 +1,104 @@
-/*
- * Copyright (C) 2010-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 .
- */
-package com.jpexs.decompiler.flash.types.gfx;
-
-import com.jpexs.decompiler.flash.types.RECT;
-import com.jpexs.decompiler.flash.types.SHAPE;
-import com.jpexs.decompiler.flash.types.shaperecords.EndShapeRecord;
-import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
-import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * @author JPEXS
- */
-public class GlyphType implements Serializable {
-
- public int[] boundingBox;
- public ContourType[] contours;
-
- public GlyphType(List records) {
- RECT bounds = SHAPERECORD.getBounds(records);
- boundingBox = new int[4];
- boundingBox[0] = bounds.Xmin;
- boundingBox[1] = bounds.Ymin;
- boundingBox[2] = bounds.Xmax;
- boundingBox[3] = bounds.Ymax;
- List cont = new ArrayList<>();
- List contoursList = new ArrayList<>();
- for (int i = 0; i < records.size(); i++) {
- SHAPERECORD r = records.get(i);
- if ((r instanceof StyleChangeRecord) && ((StyleChangeRecord) r).stateMoveTo) {
- if (!cont.isEmpty()) {
- contoursList.add(new ContourType(cont));
- cont.clear();
- }
- }
- cont.add(r);
- }
- if (!cont.isEmpty()) {
- contoursList.add(new ContourType(cont));
- cont.clear();
- }
- contours = contoursList.toArray(new ContourType[contoursList.size()]);
- }
-
- public GlyphType(GFxInputStream sis) throws IOException {
- boundingBox = new int[4];
- for (int i = 0; i < 4; i++) {
- boundingBox[i] = sis.readSI15();
- }
- int numContours = sis.readUI15();
- contours = new ContourType[numContours];
- for (int i = 0; i < numContours; i++) {
- contours[i] = new ContourType(sis);
- }
- }
-
- public SHAPE toSHAPE() {
- SHAPE shp = new SHAPE();
- shp.numFillBits = 1;
- shp.numLineBits = 0;
- List recs = new ArrayList<>();
- StyleChangeRecord scr = new StyleChangeRecord();
- scr.fillStyle0 = 0;
- scr.fillStyle1 = 1;
- scr.stateFillStyle1 = true;
- scr.stateFillStyle0 = false;
- recs.add(scr);
- for (ContourType cnt : contours) {
- recs.addAll(cnt.toSHAPERECORDS());
- }
- recs.add(new EndShapeRecord());
- shp.shapeRecords = recs;
- return shp;
- }
-
- public void write(GFxOutputStream sos) throws IOException {
- for (int b : boundingBox) {
- sos.writeSI15(b);
- }
- sos.writeUI15(contours.length);
- for (ContourType cnt : contours) {
- cnt.write(sos);
- }
- }
-}
+/*
+ * Copyright (C) 2010-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 .
+ */
+package com.jpexs.decompiler.flash.types.gfx;
+
+import com.jpexs.decompiler.flash.types.RECT;
+import com.jpexs.decompiler.flash.types.SHAPE;
+import com.jpexs.decompiler.flash.types.shaperecords.EndShapeRecord;
+import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
+import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class GlyphType implements Serializable {
+
+ public int[] boundingBox;
+ public ContourType[] contours;
+
+ public GlyphType(List records) {
+ RECT bounds = SHAPERECORD.getBounds(records);
+ boundingBox = new int[4];
+ boundingBox[0] = bounds.Xmin;
+ boundingBox[1] = bounds.Ymin;
+ boundingBox[2] = bounds.Xmax;
+ boundingBox[3] = bounds.Ymax;
+ List cont = new ArrayList<>();
+ List contoursList = new ArrayList<>();
+ for (int i = 0; i < records.size(); i++) {
+ SHAPERECORD r = records.get(i);
+ if ((r instanceof StyleChangeRecord) && ((StyleChangeRecord) r).stateMoveTo) {
+ if (!cont.isEmpty()) {
+ contoursList.add(new ContourType(cont));
+ cont.clear();
+ }
+ }
+ cont.add(r);
+ }
+ if (!cont.isEmpty()) {
+ contoursList.add(new ContourType(cont));
+ cont.clear();
+ }
+ contours = contoursList.toArray(new ContourType[contoursList.size()]);
+ }
+
+ public GlyphType(GFxInputStream sis) throws IOException {
+ boundingBox = new int[4];
+ for (int i = 0; i < 4; i++) {
+ boundingBox[i] = sis.readSI15("boundingBox");
+ }
+ int numContours = sis.readUI15("numContours");
+ contours = new ContourType[numContours];
+ for (int i = 0; i < numContours; i++) {
+ contours[i] = new ContourType(sis);
+ }
+ }
+
+ public SHAPE toSHAPE() {
+ SHAPE shp = new SHAPE();
+ shp.numFillBits = 1;
+ shp.numLineBits = 0;
+ List recs = new ArrayList<>();
+ StyleChangeRecord scr = new StyleChangeRecord();
+ scr.fillStyle0 = 0;
+ scr.fillStyle1 = 1;
+ scr.stateFillStyle1 = true;
+ scr.stateFillStyle0 = false;
+ recs.add(scr);
+ for (ContourType cnt : contours) {
+ recs.addAll(cnt.toSHAPERECORDS());
+ }
+ recs.add(new EndShapeRecord());
+ shp.shapeRecords = recs;
+ return shp;
+ }
+
+ public void write(GFxOutputStream sos) throws IOException {
+ for (int b : boundingBox) {
+ sos.writeSI15(b);
+ }
+ sos.writeUI15(contours.length);
+ for (ContourType cnt : contours) {
+ cnt.write(sos);
+ }
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/types/gfx/KerningPairType.java b/src/com/jpexs/decompiler/flash/types/gfx/KerningPairType.java
index 2c2ee7c6c..ffad24d35 100644
--- a/src/com/jpexs/decompiler/flash/types/gfx/KerningPairType.java
+++ b/src/com/jpexs/decompiler/flash/types/gfx/KerningPairType.java
@@ -1,49 +1,49 @@
-/*
- * Copyright (C) 2010-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 .
- */
-package com.jpexs.decompiler.flash.types.gfx;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- *
- * @author JPEXS
- */
-public class KerningPairType implements Serializable {
-
- public int char1;
- public int char2;
- public int advance;
-
- public KerningPairType(int char1, int char2, int advance) {
- this.char1 = char1;
- this.char2 = char2;
- this.advance = advance;
- }
-
- public KerningPairType(GFxInputStream sis) throws IOException {
- this.char1 = sis.readUI16();
- this.char2 = sis.readUI16();
- this.advance = sis.readSI16();
- }
-
- public void write(GFxOutputStream sos) throws IOException {
- sos.writeUI16(char1);
- sos.writeUI16(char2);
- sos.writeSI16(advance);
- }
-}
+/*
+ * Copyright (C) 2010-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 .
+ */
+package com.jpexs.decompiler.flash.types.gfx;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class KerningPairType implements Serializable {
+
+ public int char1;
+ public int char2;
+ public int advance;
+
+ public KerningPairType(int char1, int char2, int advance) {
+ this.char1 = char1;
+ this.char2 = char2;
+ this.advance = advance;
+ }
+
+ public KerningPairType(GFxInputStream sis) throws IOException {
+ this.char1 = sis.readUI16("char1");
+ this.char2 = sis.readUI16("char2");
+ this.advance = sis.readSI16("advance");
+ }
+
+ public void write(GFxOutputStream sos) throws IOException {
+ sos.writeUI16(char1);
+ sos.writeUI16(char2);
+ sos.writeSI16(advance);
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/types/gfx/TEXGLYPH.java b/src/com/jpexs/decompiler/flash/types/gfx/TEXGLYPH.java
index f30a2b78e..8b8befab8 100644
--- a/src/com/jpexs/decompiler/flash/types/gfx/TEXGLYPH.java
+++ b/src/com/jpexs/decompiler/flash/types/gfx/TEXGLYPH.java
@@ -1,61 +1,61 @@
-/*
- * Copyright (C) 2010-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 .
- */
-package com.jpexs.decompiler.flash.types.gfx;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- *
- * @author JPEXS
- */
-public class TEXGLYPH implements Serializable {
-
- public float uvBoundsLeft;
- public float uvBoundsTop;
- public float uvBoundsRight;
- public float uvBoundsBottom;
- public float uvOriginX;
- public float uvOriginY;
-
- public TEXGLYPH(float uvBoundsLeft, float uvBoundsTop, float uvBoundsRight, float uvBoundsBottom, float uvOriginX, float uvOriginY) {
- this.uvBoundsLeft = uvBoundsLeft;
- this.uvBoundsTop = uvBoundsTop;
- this.uvBoundsRight = uvBoundsRight;
- this.uvBoundsBottom = uvBoundsBottom;
- this.uvOriginX = uvOriginX;
- this.uvOriginY = uvOriginY;
- }
-
- public TEXGLYPH(GFxInputStream sis) throws IOException {
- this.uvBoundsLeft = sis.readFLOAT();
- this.uvBoundsTop = sis.readFLOAT();
- this.uvBoundsRight = sis.readFLOAT();
- this.uvBoundsBottom = sis.readFLOAT();
- this.uvOriginX = sis.readFLOAT();
- this.uvOriginY = sis.readFLOAT();
- }
-
- public void write(GFxOutputStream sos) throws IOException {
- sos.writeFLOAT(uvBoundsLeft);
- sos.writeFLOAT(uvBoundsTop);
- sos.writeFLOAT(uvBoundsRight);
- sos.writeFLOAT(uvBoundsBottom);
- sos.writeFLOAT(uvOriginX);
- sos.writeFLOAT(uvOriginY);
- }
-}
+/*
+ * Copyright (C) 2010-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 .
+ */
+package com.jpexs.decompiler.flash.types.gfx;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class TEXGLYPH implements Serializable {
+
+ public float uvBoundsLeft;
+ public float uvBoundsTop;
+ public float uvBoundsRight;
+ public float uvBoundsBottom;
+ public float uvOriginX;
+ public float uvOriginY;
+
+ public TEXGLYPH(float uvBoundsLeft, float uvBoundsTop, float uvBoundsRight, float uvBoundsBottom, float uvOriginX, float uvOriginY) {
+ this.uvBoundsLeft = uvBoundsLeft;
+ this.uvBoundsTop = uvBoundsTop;
+ this.uvBoundsRight = uvBoundsRight;
+ this.uvBoundsBottom = uvBoundsBottom;
+ this.uvOriginX = uvOriginX;
+ this.uvOriginY = uvOriginY;
+ }
+
+ public TEXGLYPH(GFxInputStream sis) throws IOException {
+ this.uvBoundsLeft = sis.readFLOAT("uvBoundsLeft");
+ this.uvBoundsTop = sis.readFLOAT("uvBoundsTop");
+ this.uvBoundsRight = sis.readFLOAT("uvBoundsRight");
+ this.uvBoundsBottom = sis.readFLOAT("uvBoundsBottom");
+ this.uvOriginX = sis.readFLOAT("uvOriginX");
+ this.uvOriginY = sis.readFLOAT("uvOriginY");
+ }
+
+ public void write(GFxOutputStream sos) throws IOException {
+ sos.writeFLOAT(uvBoundsLeft);
+ sos.writeFLOAT(uvBoundsTop);
+ sos.writeFLOAT(uvBoundsRight);
+ sos.writeFLOAT(uvBoundsBottom);
+ sos.writeFLOAT(uvOriginX);
+ sos.writeFLOAT(uvOriginY);
+ }
+}