diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/Filtering.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/Filtering.java index fc2beb748..2d0fa8551 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/Filtering.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/Filtering.java @@ -419,49 +419,46 @@ public class Filtering { gg.fill(RECTANGLE_512_1); int[] gradientPixels = getRGB(gradient); - BufferedImage shadowInner = null; - BufferedImage hilightInner = null; - { - BufferedImage hilightIm = dropShadow(src, 0, 0, angle, distance, Color.red, true, iterations, strength, true, true); - BufferedImage shadowIm = dropShadow(src, 0, 0, angle + 180, distance, Color.blue, true, iterations, strength, true, true); - BufferedImage h2 = new BufferedImage(width, height, src.getType()); - BufferedImage s2 = new BufferedImage(width, height, src.getType()); - Graphics2D hc = h2.createGraphics(); - Graphics2D sc = s2.createGraphics(); - hc.drawImage(hilightIm, 0, 0, null); - hc.setComposite(AlphaComposite.DstOut); - hc.drawImage(shadowIm, 0, 0, null); + BufferedImage shadowInner; + BufferedImage hilightInner; + + BufferedImage hilightImInner = dropShadow(src, 0, 0, angle, distance, Color.red, true, iterations, strength, true, true); + BufferedImage shadowImInner = dropShadow(src, 0, 0, angle + 180, distance, Color.blue, true, iterations, strength, true, true); + BufferedImage h2Inner = new BufferedImage(width, height, src.getType()); + BufferedImage s2Inner = new BufferedImage(width, height, src.getType()); + Graphics2D hcInner = h2Inner.createGraphics(); + Graphics2D scInner = s2Inner.createGraphics(); + hcInner.drawImage(hilightImInner, 0, 0, null); + hcInner.setComposite(AlphaComposite.DstOut); + hcInner.drawImage(shadowImInner, 0, 0, null); - sc.drawImage(shadowIm, 0, 0, null); - sc.setComposite(AlphaComposite.DstOut); - sc.drawImage(hilightIm, 0, 0, null); - shadowInner = s2; - hilightInner = h2; - } + scInner.drawImage(shadowImInner, 0, 0, null); + scInner.setComposite(AlphaComposite.DstOut); + scInner.drawImage(hilightImInner, 0, 0, null); + shadowInner = s2Inner; + hilightInner = h2Inner; - BufferedImage shadowOuter = null; - BufferedImage hilightOuter = null; + BufferedImage shadowOuter; + BufferedImage hilightOuter; - { - BufferedImage hilightIm = dropShadow(src, 0, 0, angle + 180, distance, Color.red, false, iterations, strength, true, true); - BufferedImage shadowIm = dropShadow(src, 0, 0, angle, distance, Color.blue, false, iterations, strength, true, true); - BufferedImage h2 = new BufferedImage(width, height, src.getType()); - BufferedImage s2 = new BufferedImage(width, height, src.getType()); - Graphics2D hc = h2.createGraphics(); - Graphics2D sc = s2.createGraphics(); - hc.drawImage(hilightIm, 0, 0, null); - hc.setComposite(AlphaComposite.DstOut); - hc.drawImage(shadowIm, 0, 0, null); + BufferedImage hilightImOuter = dropShadow(src, 0, 0, angle + 180, distance, Color.red, false, iterations, strength, true, true); + BufferedImage shadowImOuter = dropShadow(src, 0, 0, angle, distance, Color.blue, false, iterations, strength, true, true); + BufferedImage h2Outer = new BufferedImage(width, height, src.getType()); + BufferedImage s2Outer = new BufferedImage(width, height, src.getType()); + Graphics2D hcOuter = h2Outer.createGraphics(); + Graphics2D scOuter = s2Outer.createGraphics(); + hcOuter.drawImage(hilightImOuter, 0, 0, null); + hcOuter.setComposite(AlphaComposite.DstOut); + hcOuter.drawImage(shadowImOuter, 0, 0, null); - sc.drawImage(shadowIm, 0, 0, null); - sc.setComposite(AlphaComposite.DstOut); - sc.drawImage(hilightIm, 0, 0, null); - shadowOuter = s2; - hilightOuter = h2; - } + scOuter.drawImage(shadowImOuter, 0, 0, null); + scOuter.setComposite(AlphaComposite.DstOut); + scOuter.drawImage(hilightImOuter, 0, 0, null); + shadowOuter = s2Outer; + hilightOuter = h2Outer; - BufferedImage hilightIm = null; - BufferedImage shadowIm = null; + BufferedImage hilightIm; + BufferedImage shadowIm; hilightIm = hilightInner; shadowIm = shadowInner; Graphics2D hc = hilightIm.createGraphics(); diff --git a/src/com/jpexs/decompiler/flash/easygui/FiltersTreeTable.java b/src/com/jpexs/decompiler/flash/easygui/FiltersTreeTable.java index a3a667b4a..412e13e2b 100644 --- a/src/com/jpexs/decompiler/flash/easygui/FiltersTreeTable.java +++ b/src/com/jpexs/decompiler/flash/easygui/FiltersTreeTable.java @@ -229,12 +229,12 @@ public class FiltersTreeTable extends JTreeTable { int filterIndex = root.getIndex(node); FiltersTreeTableModel model = (FiltersTreeTableModel) getTree().getModel(); model.removeFilter(filterIndex); - + //Select previous filter filterIndex--; if (filterIndex < 0) { filterIndex = 0; - } + } fireFilterChanged(); if (filterIndex < root.getChildCount()) { Timer timer = new Timer(); @@ -244,10 +244,10 @@ public class FiltersTreeTable extends JTreeTable { @Override public void run() { if (root.getChildCount() > fFilterIndex) { - getTree().setSelectionPath(new TreePath(new Object[] {root, root.getChildAt(fFilterIndex)})); - } - } - }, 50); + getTree().setSelectionPath(new TreePath(new Object[]{root, root.getChildAt(fFilterIndex)})); + } + } + }, 50); } } } @@ -261,13 +261,13 @@ public class FiltersTreeTable extends JTreeTable { getColumnModel().getColumn(1).setCellEditor(new FiltersValueCellEditor(this)); getColumnModel().getColumn(1).setCellRenderer(new FiltersTableCellRenderer()); } - + public void setFilters(List filters) { if (Objects.equals(getFilters(), filters)) { return; } setTreeTableModel(new FiltersTreeTableModel(filters)); - + TreeModel ttm = getTree().getModel(); Object root = ttm.getRoot(); int childCount = ttm.getChildCount(root); @@ -444,7 +444,7 @@ public class FiltersTreeTable extends JTreeTable { if (value instanceof FilterValue) { FilterValue filterValue = (FilterValue) value; String units = ""; - switch(filterValue.filterField.field.getName()) { + switch (filterValue.filterField.field.getName()) { case "angle": units = " \u00B0"; //degrees break; @@ -453,9 +453,9 @@ public class FiltersTreeTable extends JTreeTable { case "distance": units = " px"; } - label.setText(value.toString() + units); + label.setText(value.toString() + units); Object fieldValue = filterValue.getValue(); - if (fieldValue != null) { + if (fieldValue != null) { if ("gradientColors".equals(filterValue.filterField.field.getName())) { component = new GradientEditor(filterValue.filterField.filter); } @@ -616,8 +616,7 @@ public class FiltersTreeTable extends JTreeTable { if (value.getClass() == Double.class || value.getClass() == Float.class || value.getClass() == float.class - || value.getClass() == double.class - ) { + || value.getClass() == double.class) { return EcmaScript.toString(value); } return "" + value; @@ -658,7 +657,7 @@ public class FiltersTreeTable extends JTreeTable { } this.filters = new ArrayList<>(); - + for (FILTER filter : filters) { addFilter(filter); } diff --git a/src/com/jpexs/decompiler/flash/easygui/properties/GradientEditor.java b/src/com/jpexs/decompiler/flash/easygui/properties/GradientEditor.java index f1bc18e10..a0671415d 100644 --- a/src/com/jpexs/decompiler/flash/easygui/properties/GradientEditor.java +++ b/src/com/jpexs/decompiler/flash/easygui/properties/GradientEditor.java @@ -81,7 +81,7 @@ public class GradientEditor extends JPanel implements PropertyEditor { } } - public GradientEditor(FILTER filter) { + public GradientEditor(FILTER filter) { this.filter = filter; setLayout(new BorderLayout()); JPanel miniGradientPanel = new JPanel() { @@ -116,7 +116,7 @@ public class GradientEditor extends JPanel implements PropertyEditor { dialog.pack(); Window window = SwingUtilities.getWindowAncestor(GradientEditor.this); - + dialog.setLocationRelativeTo(window); Point loc = SwingUtilities.convertPoint(miniGradientPanel, 0, 0, window); if (loc.x + dialog.getWidth() > window.getWidth()) { @@ -126,7 +126,7 @@ public class GradientEditor extends JPanel implements PropertyEditor { loc.y -= loc.y + dialog.getHeight() - window.getHeight(); } SwingUtilities.convertPointToScreen(loc, window); - + dialog.setLocation(loc); dialog.addWindowListener(new WindowAdapter() { @Override @@ -356,12 +356,11 @@ public class GradientEditor extends JPanel implements PropertyEditor { return; } if (dragIndex > -1) { - + if (isFixedZeroAlphaIndex(dragIndex)) { return; } - - + draggedOut = colors.size() > 2 && e.getY() > getHeight(); synchronized (GradientEditorPanel.this) { @@ -418,13 +417,12 @@ public class GradientEditor extends JPanel implements PropertyEditor { if (filter instanceof GRADIENTGLOWFILTER && index == 0 && colors.get(0).getAlpha() == 0) { return true; } - if (filter instanceof GRADIENTBEVELFILTER && ratios.get(index) == 128f/255f && colors.get(index).getAlpha() == 0) { + if (filter instanceof GRADIENTBEVELFILTER && ratios.get(index) == 128f / 255f && colors.get(index).getAlpha() == 0) { return true; } return false; } - - + private List getColorRects() { List rects = new ArrayList<>();