mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 13:10:46 +00:00
Fixed Convolution matrix filter display and editing
This commit is contained in:
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.gui.generictageditors.Amf3ValueEditor;
|
||||
import com.jpexs.decompiler.flash.gui.generictageditors.BinaryDataEditor;
|
||||
import com.jpexs.decompiler.flash.gui.generictageditors.BooleanEditor;
|
||||
import com.jpexs.decompiler.flash.gui.generictageditors.ChangeListener;
|
||||
import com.jpexs.decompiler.flash.gui.generictageditors.ColorEditor;
|
||||
import com.jpexs.decompiler.flash.gui.generictageditors.EnumEditor;
|
||||
import com.jpexs.decompiler.flash.gui.generictageditors.FullSized;
|
||||
@@ -55,6 +56,7 @@ import com.jpexs.decompiler.flash.types.annotations.Table;
|
||||
import com.jpexs.decompiler.flash.types.annotations.UUID;
|
||||
import com.jpexs.decompiler.flash.types.annotations.parser.AnnotationParseException;
|
||||
import com.jpexs.decompiler.flash.types.annotations.parser.ConditionEvaluator;
|
||||
import com.jpexs.decompiler.flash.types.filters.CONVOLUTIONFILTER;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.ConcreteClasses;
|
||||
import com.jpexs.helpers.ReflectionTools;
|
||||
@@ -301,7 +303,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
for (int i = 0; i < fnode.fieldSet.size(); i++) {
|
||||
Field field = fnode.fieldSet.get(i);
|
||||
int index = fnode.index;
|
||||
Object obj = fnode.obj;
|
||||
final Object obj = fnode.obj;
|
||||
Class<?> type;
|
||||
boolean isByteArray = field.getType().equals(byte[].class);
|
||||
try {
|
||||
@@ -361,7 +363,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
editors = new ArrayList<>();
|
||||
}
|
||||
editors.add(editor);
|
||||
}
|
||||
}
|
||||
JPanel pan = new JPanel();
|
||||
FlowLayout fl = new FlowLayout(FlowLayout.LEFT, 0, 0);
|
||||
fl.setAlignOnBaseline(true);
|
||||
@@ -446,6 +448,24 @@ public class GenericTagTreePanel extends GenericTagPanel {
|
||||
try {
|
||||
editor.validateValue();
|
||||
if (editor.save()) {
|
||||
|
||||
if (editor.getObject() instanceof CONVOLUTIONFILTER) {
|
||||
String fname = editor.getFieldName();
|
||||
if ("matrixX".equals(fname) || "matrixY".equals(fname)) {
|
||||
CONVOLUTIONFILTER cf = (CONVOLUTIONFILTER) editor.getObject();
|
||||
if (cf.matrix.length != cf.matrixX * cf.matrixY) {
|
||||
float[] newmatrix = new float[cf.matrixX * cf.matrixY];
|
||||
int copycount = cf.matrix.length;
|
||||
if (copycount > cf.matrixX * cf.matrixY) {
|
||||
copycount = cf.matrixX * cf.matrixY;
|
||||
}
|
||||
System.arraycopy(cf.matrix, 0, newmatrix, 0, copycount);
|
||||
cf.matrix = newmatrix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
modified = true;
|
||||
}
|
||||
} catch (IllegalArgumentException iex) {
|
||||
|
||||
@@ -261,4 +261,8 @@ public class Amf3ValueEditor extends JPanel implements GenericTagEditor, FullSiz
|
||||
return Helper.escapeHTML(getChangedValue().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,4 +195,9 @@ public class BinaryDataEditor extends JPanel implements GenericTagEditor {
|
||||
public void added() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,4 +114,9 @@ public class BooleanEditor extends JCheckBox implements GenericTagEditor {
|
||||
public String getReadOnlyValue() {
|
||||
return getChangedValue().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,4 +280,9 @@ public class ColorEditor extends JPanel implements GenericTagEditor, ActionListe
|
||||
int h = System.identityHashCode(this);
|
||||
return "<cite style=\"background-color:rgb(" + color.getRed() + "," + color.getGreen() + "," + color.getBlue() + ");\"> </cite> " + getChangedValue().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,4 +155,9 @@ public class EnumEditor extends JComboBox<ComboBoxItem<Integer>> implements Gene
|
||||
public String getReadOnlyValue() {
|
||||
return getChangedValue().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,4 +41,6 @@ public interface GenericTagEditor {
|
||||
public String getReadOnlyValue();
|
||||
|
||||
public void validateValue();
|
||||
|
||||
public Object getObject();
|
||||
}
|
||||
|
||||
@@ -244,4 +244,9 @@ public class NumberEditor extends JSpinner implements GenericTagEditor {
|
||||
public String getReadOnlyValue() {
|
||||
return getChangedValue().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,4 +147,9 @@ public class StringEditor extends JTextArea implements GenericTagEditor {
|
||||
@Override
|
||||
public void validateValue() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,4 +161,9 @@ public class UUIDEditor extends JTextField implements GenericTagEditor {
|
||||
@Override
|
||||
public void validateValue() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user