Checkstyle fix

This commit is contained in:
Jindra Petřík
2025-05-11 02:26:50 +02:00
parent a0adfda43e
commit e508eee37b
3 changed files with 55 additions and 61 deletions

View File

@@ -419,49 +419,46 @@ public class Filtering {
gg.fill(RECTANGLE_512_1); gg.fill(RECTANGLE_512_1);
int[] gradientPixels = getRGB(gradient); int[] gradientPixels = getRGB(gradient);
BufferedImage shadowInner = null; BufferedImage shadowInner;
BufferedImage hilightInner = null; BufferedImage hilightInner;
{
BufferedImage hilightIm = dropShadow(src, 0, 0, angle, distance, Color.red, true, iterations, strength, true, true); BufferedImage hilightImInner = 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 shadowImInner = dropShadow(src, 0, 0, angle + 180, distance, Color.blue, true, iterations, strength, true, true);
BufferedImage h2 = new BufferedImage(width, height, src.getType()); BufferedImage h2Inner = new BufferedImage(width, height, src.getType());
BufferedImage s2 = new BufferedImage(width, height, src.getType()); BufferedImage s2Inner = new BufferedImage(width, height, src.getType());
Graphics2D hc = h2.createGraphics(); Graphics2D hcInner = h2Inner.createGraphics();
Graphics2D sc = s2.createGraphics(); Graphics2D scInner = s2Inner.createGraphics();
hc.drawImage(hilightIm, 0, 0, null); hcInner.drawImage(hilightImInner, 0, 0, null);
hc.setComposite(AlphaComposite.DstOut); hcInner.setComposite(AlphaComposite.DstOut);
hc.drawImage(shadowIm, 0, 0, null); hcInner.drawImage(shadowImInner, 0, 0, null);
sc.drawImage(shadowIm, 0, 0, null); scInner.drawImage(shadowImInner, 0, 0, null);
sc.setComposite(AlphaComposite.DstOut); scInner.setComposite(AlphaComposite.DstOut);
sc.drawImage(hilightIm, 0, 0, null); scInner.drawImage(hilightImInner, 0, 0, null);
shadowInner = s2; shadowInner = s2Inner;
hilightInner = h2; hilightInner = h2Inner;
}
BufferedImage shadowOuter = null; BufferedImage shadowOuter;
BufferedImage hilightOuter = null; BufferedImage hilightOuter;
{ BufferedImage hilightImOuter = dropShadow(src, 0, 0, angle + 180, distance, Color.red, false, iterations, strength, true, true);
BufferedImage hilightIm = 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 shadowIm = dropShadow(src, 0, 0, angle, distance, Color.blue, false, iterations, strength, true, true); BufferedImage h2Outer = new BufferedImage(width, height, src.getType());
BufferedImage h2 = new BufferedImage(width, height, src.getType()); BufferedImage s2Outer = new BufferedImage(width, height, src.getType());
BufferedImage s2 = new BufferedImage(width, height, src.getType()); Graphics2D hcOuter = h2Outer.createGraphics();
Graphics2D hc = h2.createGraphics(); Graphics2D scOuter = s2Outer.createGraphics();
Graphics2D sc = s2.createGraphics(); hcOuter.drawImage(hilightImOuter, 0, 0, null);
hc.drawImage(hilightIm, 0, 0, null); hcOuter.setComposite(AlphaComposite.DstOut);
hc.setComposite(AlphaComposite.DstOut); hcOuter.drawImage(shadowImOuter, 0, 0, null);
hc.drawImage(shadowIm, 0, 0, null);
sc.drawImage(shadowIm, 0, 0, null); scOuter.drawImage(shadowImOuter, 0, 0, null);
sc.setComposite(AlphaComposite.DstOut); scOuter.setComposite(AlphaComposite.DstOut);
sc.drawImage(hilightIm, 0, 0, null); scOuter.drawImage(hilightImOuter, 0, 0, null);
shadowOuter = s2; shadowOuter = s2Outer;
hilightOuter = h2; hilightOuter = h2Outer;
}
BufferedImage hilightIm = null; BufferedImage hilightIm;
BufferedImage shadowIm = null; BufferedImage shadowIm;
hilightIm = hilightInner; hilightIm = hilightInner;
shadowIm = shadowInner; shadowIm = shadowInner;
Graphics2D hc = hilightIm.createGraphics(); Graphics2D hc = hilightIm.createGraphics();

View File

@@ -229,12 +229,12 @@ public class FiltersTreeTable extends JTreeTable {
int filterIndex = root.getIndex(node); int filterIndex = root.getIndex(node);
FiltersTreeTableModel model = (FiltersTreeTableModel) getTree().getModel(); FiltersTreeTableModel model = (FiltersTreeTableModel) getTree().getModel();
model.removeFilter(filterIndex); model.removeFilter(filterIndex);
//Select previous filter //Select previous filter
filterIndex--; filterIndex--;
if (filterIndex < 0) { if (filterIndex < 0) {
filterIndex = 0; filterIndex = 0;
} }
fireFilterChanged(); fireFilterChanged();
if (filterIndex < root.getChildCount()) { if (filterIndex < root.getChildCount()) {
Timer timer = new Timer(); Timer timer = new Timer();
@@ -244,10 +244,10 @@ public class FiltersTreeTable extends JTreeTable {
@Override @Override
public void run() { public void run() {
if (root.getChildCount() > fFilterIndex) { if (root.getChildCount() > fFilterIndex) {
getTree().setSelectionPath(new TreePath(new Object[] {root, root.getChildAt(fFilterIndex)})); getTree().setSelectionPath(new TreePath(new Object[]{root, root.getChildAt(fFilterIndex)}));
} }
} }
}, 50); }, 50);
} }
} }
} }
@@ -261,13 +261,13 @@ public class FiltersTreeTable extends JTreeTable {
getColumnModel().getColumn(1).setCellEditor(new FiltersValueCellEditor(this)); getColumnModel().getColumn(1).setCellEditor(new FiltersValueCellEditor(this));
getColumnModel().getColumn(1).setCellRenderer(new FiltersTableCellRenderer()); getColumnModel().getColumn(1).setCellRenderer(new FiltersTableCellRenderer());
} }
public void setFilters(List<FILTER> filters) { public void setFilters(List<FILTER> filters) {
if (Objects.equals(getFilters(), filters)) { if (Objects.equals(getFilters(), filters)) {
return; return;
} }
setTreeTableModel(new FiltersTreeTableModel(filters)); setTreeTableModel(new FiltersTreeTableModel(filters));
TreeModel ttm = getTree().getModel(); TreeModel ttm = getTree().getModel();
Object root = ttm.getRoot(); Object root = ttm.getRoot();
int childCount = ttm.getChildCount(root); int childCount = ttm.getChildCount(root);
@@ -444,7 +444,7 @@ public class FiltersTreeTable extends JTreeTable {
if (value instanceof FilterValue) { if (value instanceof FilterValue) {
FilterValue filterValue = (FilterValue) value; FilterValue filterValue = (FilterValue) value;
String units = ""; String units = "";
switch(filterValue.filterField.field.getName()) { switch (filterValue.filterField.field.getName()) {
case "angle": case "angle":
units = " \u00B0"; //degrees units = " \u00B0"; //degrees
break; break;
@@ -453,9 +453,9 @@ public class FiltersTreeTable extends JTreeTable {
case "distance": case "distance":
units = " px"; units = " px";
} }
label.setText(value.toString() + units); label.setText(value.toString() + units);
Object fieldValue = filterValue.getValue(); Object fieldValue = filterValue.getValue();
if (fieldValue != null) { if (fieldValue != null) {
if ("gradientColors".equals(filterValue.filterField.field.getName())) { if ("gradientColors".equals(filterValue.filterField.field.getName())) {
component = new GradientEditor(filterValue.filterField.filter); component = new GradientEditor(filterValue.filterField.filter);
} }
@@ -616,8 +616,7 @@ public class FiltersTreeTable extends JTreeTable {
if (value.getClass() == Double.class if (value.getClass() == Double.class
|| value.getClass() == Float.class || value.getClass() == Float.class
|| value.getClass() == float.class || value.getClass() == float.class
|| value.getClass() == double.class || value.getClass() == double.class) {
) {
return EcmaScript.toString(value); return EcmaScript.toString(value);
} }
return "" + value; return "" + value;
@@ -658,7 +657,7 @@ public class FiltersTreeTable extends JTreeTable {
} }
this.filters = new ArrayList<>(); this.filters = new ArrayList<>();
for (FILTER filter : filters) { for (FILTER filter : filters) {
addFilter(filter); addFilter(filter);
} }

View File

@@ -81,7 +81,7 @@ public class GradientEditor extends JPanel implements PropertyEditor {
} }
} }
public GradientEditor(FILTER filter) { public GradientEditor(FILTER filter) {
this.filter = filter; this.filter = filter;
setLayout(new BorderLayout()); setLayout(new BorderLayout());
JPanel miniGradientPanel = new JPanel() { JPanel miniGradientPanel = new JPanel() {
@@ -116,7 +116,7 @@ public class GradientEditor extends JPanel implements PropertyEditor {
dialog.pack(); dialog.pack();
Window window = SwingUtilities.getWindowAncestor(GradientEditor.this); Window window = SwingUtilities.getWindowAncestor(GradientEditor.this);
dialog.setLocationRelativeTo(window); dialog.setLocationRelativeTo(window);
Point loc = SwingUtilities.convertPoint(miniGradientPanel, 0, 0, window); Point loc = SwingUtilities.convertPoint(miniGradientPanel, 0, 0, window);
if (loc.x + dialog.getWidth() > window.getWidth()) { 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(); loc.y -= loc.y + dialog.getHeight() - window.getHeight();
} }
SwingUtilities.convertPointToScreen(loc, window); SwingUtilities.convertPointToScreen(loc, window);
dialog.setLocation(loc); dialog.setLocation(loc);
dialog.addWindowListener(new WindowAdapter() { dialog.addWindowListener(new WindowAdapter() {
@Override @Override
@@ -356,12 +356,11 @@ public class GradientEditor extends JPanel implements PropertyEditor {
return; return;
} }
if (dragIndex > -1) { if (dragIndex > -1) {
if (isFixedZeroAlphaIndex(dragIndex)) { if (isFixedZeroAlphaIndex(dragIndex)) {
return; return;
} }
draggedOut = colors.size() > 2 && e.getY() > getHeight(); draggedOut = colors.size() > 2 && e.getY() > getHeight();
synchronized (GradientEditorPanel.this) { 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) { if (filter instanceof GRADIENTGLOWFILTER && index == 0 && colors.get(0).getAlpha() == 0) {
return true; 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 true;
} }
return false; return false;
} }
private List<Rectangle> getColorRects() { private List<Rectangle> getColorRects() {
List<Rectangle> rects = new ArrayList<>(); List<Rectangle> rects = new ArrayList<>();