Skip to content

Commit

Permalink
small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
lbalazscs committed Jan 12, 2025
1 parent 4beea2d commit b365989
Show file tree
Hide file tree
Showing 52 changed files with 278 additions and 286 deletions.
6 changes: 3 additions & 3 deletions src/main/java/pixelitor/filters/BorderMask.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -51,8 +51,8 @@ public class BorderMask extends ParametrizedFilter {
new String[]{"North", "East", "South", "West"}, 0, 10, 500, true);
private final RangeParam roundnessParam = new RangeParam("Roundness", 0, 20, 500);
private final AngleParam angleParam = new AngleParam("Rotate", 0);
private final BooleanParam invertParam = new BooleanParam("Invert", false);
private final BooleanParam transparencyParam = new BooleanParam("Render Transparency", false);
private final BooleanParam invertParam = new BooleanParam("Invert");
private final BooleanParam transparencyParam = new BooleanParam("Render Transparency");

public BorderMask() {
super(false);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pixelitor/filters/BumpMap.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -32,7 +32,7 @@ public class BumpMap extends ParametrizedFilter {
public static final String NAME = "Bump Map";

private final SelectImageParam imageParam = new SelectImageParam("Bump Map");
private final BooleanParam tileParam = new BooleanParam("Tile", false);
private final BooleanParam tileParam = new BooleanParam("Tile");
private final AngleParam lightDirection = new AngleParam(
"Light Direction", 0);
private final RangeParam depth = new RangeParam(
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/pixelitor/filters/Canny.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -48,10 +48,8 @@ public class Canny extends ParametrizedFilter {
"Gaussian Kernel Width", 2, 16, 50);
private final RangeParam gaussianKernelRadius = new RangeParam(
"Gaussian Kernel Radius", 0, 2, 10);
private final BooleanParam contrastNormalized = new BooleanParam(
"Contrast Normalized", false);
private final BooleanParam invert = new BooleanParam(
"Invert", false);
private final BooleanParam contrastNormalized = new BooleanParam("Contrast Normalized");
private final BooleanParam invert = new BooleanParam("Invert");

public Canny() {
super(true);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pixelitor/filters/ChannelToTransparency.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -51,7 +51,7 @@ public class ChannelToTransparency extends ParametrizedFilter {
new Item("Green", GREEN),
new Item("Blue", BLUE)
});
private final BooleanParam invertParam = new BooleanParam("Invert", false);
private final BooleanParam invertParam = new BooleanParam("Invert");
private final BooleanParam keepParam = new BooleanParam("Keep Existing Transparency", true);

public ChannelToTransparency() {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/pixelitor/filters/ChaosGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public class ChaosGame extends ParametrizedFilter {
new Item("Last but One", COLORS_LAST_BUT_ONE),
new Item("Last but Two", COLORS_LAST_BUT_TWO),
}, IGNORE_RANDOMIZE);
private final BooleanParam centerJump = new BooleanParam("Jump to Center", false);
private final BooleanParam midpointJump = new BooleanParam("Jump to Midpoints", false);
private final BooleanParam restrict = new BooleanParam("No Vertex Repetition", false);
private final BooleanParam centerJump = new BooleanParam("Jump to Center");
private final BooleanParam midpointJump = new BooleanParam("Jump to Midpoints");
private final BooleanParam restrict = new BooleanParam("No Vertex Repetition");
private final BooleanParam showPoly = new BooleanParam("Show Polygon", false, IGNORE_RANDOMIZE);

public ChaosGame() {
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/pixelitor/filters/CurveFilter.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -90,25 +90,25 @@ public abstract class CurveFilter extends ParametrizedFilter {
new Item("Transparent", FG_TRANSPARENT),
}, IGNORE_RANDOMIZE);

private final BooleanParam waterMark = new BooleanParam("Watermarking", false);
private final BooleanParam waterMark = new BooleanParam("Watermarking");
protected final ImagePositionParam center = new ImagePositionParam("Center");
private final GroupedRangeParam scale = new GroupedRangeParam("Scale (%)", 1, 100, 500);
private final AngleParam rotate = new AngleParam("Rotate", 0);
private final EnumParam<NonlinTransform> nonlinType = NonlinTransform.asParam();
private final RangeParam nonlinTuning = new RangeParam("Distortion Tuning", -100, 0, 100);
private final EnumParam<NonlinTransform> distortType = NonlinTransform.asParam();
private final RangeParam distortAmount = NonlinTransform.createAmountParam();

private transient Shape exportedShape;

protected CurveFilter() {
super(false);

nonlinType.setupEnableOtherIf(nonlinTuning, NonlinTransform::hasTuning);
distortType.setupEnableOtherIf(distortAmount, NonlinTransform::hasAmount);

setParams(
background,
foreground,
waterMark,
new DialogParam("Transform", nonlinType, nonlinTuning, center, rotate, scale),
new DialogParam("Transform", distortType, distortAmount, center, rotate, scale),
strokeParam.withStrokeWidth(2),
effectsParam
).withAction(new FilterButtonModel("Export SVG...", this::exportSVG,
Expand Down Expand Up @@ -151,9 +151,9 @@ public BufferedImage transform(BufferedImage src, BufferedImage dest) {
return dest;
}

NonlinTransform nonlin = nonlinType.getSelected();
NonlinTransform nonlin = distortType.getSelected();
if (nonlin != NONE) {
double amount = nonlinTuning.getValueAsDouble();
double amount = distortAmount.getValueAsDouble();
Point2D pivotPoint = center.getAbsolutePoint(src);
shape = nonlin.transform(shape, pivotPoint, amount, srcWidth, srcHeight);
}
Expand Down Expand Up @@ -357,6 +357,6 @@ public Path2D getPath() {
}

protected boolean hasNonlinDistort() {
return nonlinType.getSelected() != NONE;
return distortType.getSelected() != NONE;
}
}
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/DisplacementMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class DisplacementMap extends ParametrizedFilter {
public static final String NAME = "Displacement Map";

private final SelectImageParam imageParam = new SelectImageParam("Displacement Map");
private final BooleanParam tileParam = new BooleanParam("Tile", false);
private final BooleanParam tileParam = new BooleanParam("Tile");
private final RangeParam amount = new RangeParam(
"Amount", 0, 10, 100);
private final AngleParam angle = new AngleParam("Angle", 0);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pixelitor/filters/ExtractChannel.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -54,7 +54,7 @@ public class ExtractChannel extends ParametrizedFilter {
new Item("Blue", BLUE_CHANNEL),
new Item("Remove Blue", REMOVE_BLUE_CHANNEL),
});
private final BooleanParam bwParam = new BooleanParam("Black and White", false);
private final BooleanParam bwParam = new BooleanParam("Black and White");

public ExtractChannel() {
super(true);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pixelitor/filters/Flashlight.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -51,7 +51,7 @@ public class Flashlight extends ParametrizedFilter {
new Item("Background Color", Impl.BG_TOOL_BG),
new Item("Transparent", Impl.BG_TRANSPARENT),
}, IGNORE_RANDOMIZE);
private final BooleanParam invert = new BooleanParam("Invert", false);
private final BooleanParam invert = new BooleanParam("Invert");

private Impl filter;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/FlowField.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public boolean requiresColorField() {

private final RangeParam numParticlesParam = new RangeParam("Particle Count", 1, 1000, 20000, true, BORDER, IGNORE_RANDOMIZE);
private final StrokeParam strokeParam = new StrokeParam("Stroke");
private final BooleanParam antiAliasParam = new BooleanParam("Use Antialiasing", false);
private final BooleanParam antiAliasParam = new BooleanParam("Use Antialiasing");
private final ColorParam backgroundColorParam = new ColorParam("Background Color", new Color(0, 0, 0, 1.0f), FREE_TRANSPARENCY);
private final ColorParam particleColorParam = new ColorParam("Particle Color", new Color(1, 1, 1, 0.12f), FREE_TRANSPARENCY);
private final EnumParam<ColorSource> initialColorsParam = new EnumParam<>("Initialize Colors", ColorSource.class);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/LittlePlanet.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class LittlePlanet extends ParametrizedFilter {
private final AngleParam rotateResult = new AngleParam("Rotate Result", 90, INTUITIVE_DEGREES);
private final RangeParam zoom = new RangeParam(ZOOM + " (%)", 1, 100, 501);
private final RangeParam innerZoom = new RangeParam("Inner Zoom (%)", 30, 100, 170);
private final BooleanParam invert = new BooleanParam("Invert", false);
private final BooleanParam invert = new BooleanParam("Invert");
private final IntChoiceParam edgeAction = IntChoiceParam.forEdgeAction(true);
private final IntChoiceParam interpolation = IntChoiceParam.forInterpolation();

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/Magnify.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class Magnify extends ParametrizedFilter {
private final RangeParam softness = new RangeParam("Softness", 0, 100, 1000);
private final ImagePositionParam center = new ImagePositionParam("Center");
private final IntChoiceParam shape = BlurredShape.getChoices();
private final BooleanParam invert = new BooleanParam("Invert", false);
private final BooleanParam invert = new BooleanParam("Invert");
private final IntChoiceParam edgeAction = IntChoiceParam.forEdgeAction();
private final IntChoiceParam interpolation = IntChoiceParam.forInterpolation();

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pixelitor/filters/Marble.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -64,7 +64,7 @@ public class Marble extends ParametrizedFilter {
});

private final IntChoiceParam waveType = IntChoiceParam.forWaveType();
private final BooleanParam smoothDetails = new BooleanParam("Smoother Details", false);
private final BooleanParam smoothDetails = new BooleanParam("Smoother Details");

private final GradientParam gradient = new GradientParam("Colors",
new float[]{0.0f, 0.5f, 1.0f},
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pixelitor/filters/ParamTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -82,7 +82,7 @@ public static FilterParam[] getTestParams() {
new AngleParam("AngleParam", 0),
new ElevationAngleParam("ElevationAngleParam", 0),
new BlendingModeParam(BlendingMode.values()),
new BooleanParam("BooleanParam", false),
new BooleanParam("BooleanParam"),
new TextParam("TextParam", "default value", true),
new LogZoomParam("Zoom", 200, 200, 1000),
};
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pixelitor/filters/PoissonDiskTester.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -44,7 +44,7 @@ public class PoissonDiskTester extends ParametrizedFilter {

private final RangeParam distance = new RangeParam("Distance", 10, 20, 300);
private final RangeParam k = new RangeParam("k", 1, 30, 100);
private final BooleanParam improved = new BooleanParam("Improved", false);
private final BooleanParam improved = new BooleanParam("Improved");
private final BooleanParam debugGrid = new BooleanParam("Debug Grid", false, IGNORE_RANDOMIZE);

private final ColorListParam colors = new ColorListParam("Colors",
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/pixelitor/filters/Rose.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -53,21 +53,21 @@ public class Rose extends ParametrizedFilter {
private final ColorParam fgColor = new ColorParam("Foreground Color", WHITE, USER_ONLY_TRANSPARENCY);
private final GroupedRangeParam scale = new GroupedRangeParam("Scale (%)", 1, 100, 500);
private final AngleParam rotate = new AngleParam("Rotate", 0);
private final EnumParam<NonlinTransform> nonlinType = NonlinTransform.asParam();
private final RangeParam nonlinTuning = new RangeParam("Distortion Tuning", -100, 0, 100);
private final EnumParam<NonlinTransform> distortType = NonlinTransform.asParam();
private final RangeParam distortAmount = NonlinTransform.createAmountParam();

public Rose() {
super(false);

nonlinType.setupEnableOtherIf(nonlinTuning, NonlinTransform::hasTuning);
distortType.setupEnableOtherIf(distortAmount, NonlinTransform::hasAmount);

setParams(
nParam,
dParam,
bgColor,
fgColor,
new DialogParam("Transform",
nonlinType, nonlinTuning, center, rotate, scale)
distortType, distortAmount, center, rotate, scale)
);

helpURL = "https://en.wikipedia.org/wiki/Rose_(mathematics)";
Expand Down Expand Up @@ -110,9 +110,9 @@ public BufferedImage transform(BufferedImage src, BufferedImage dest) {
}
path.closePath();

NonlinTransform nonlin = nonlinType.getSelected();
NonlinTransform nonlin = distortType.getSelected();
if (nonlin != NONE) {
double amount = nonlinTuning.getValueAsDouble();
double amount = distortAmount.getValueAsDouble();
Point2D pivotPoint = new Point2D.Double(cx, cy);
path = nonlin.transform(path, pivotPoint, amount, width, height);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pixelitor/filters/SlippingTiles.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -107,7 +107,7 @@ boolean isSecondSideFalling() {
}

private final RangeParam centerTileSizeParam = new RangeParam("Center Tile Width", 1, 50, 99);
private final BooleanParam isCenterTileSizeAutomaticallyCalculatedParam = new BooleanParam("Auto-Adjust Width", false);
private final BooleanParam isCenterTileSizeAutomaticallyCalculatedParam = new BooleanParam("Auto-Adjust Width");
private final RangeParam numberOfTilesParam = new RangeParam("Number of Tiles", 1, 4, 20);
private final EnumParam<Distributor> distributionParam = new EnumParam<>("Distribution", Distributor.class);
private final RangeParam slipDisplacementParam = new RangeParam("Slip Length", 1, 50, 99);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/pixelitor/filters/Spiral.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -51,8 +51,8 @@ public class Spiral extends CurveFilter {
new Item("Polygon", TYPE_POLYGON)
});
private final RangeParam sidesParam = new RangeParam("Polygon Sides", 3, 4, 10);
private final BooleanParam symmetry = new BooleanParam("Symmetric", false);
private final BooleanParam log = new BooleanParam("Logarithmic", false);
private final BooleanParam symmetry = new BooleanParam("Symmetric");
private final BooleanParam log = new BooleanParam("Logarithmic");
private final BooleanParam scale = new BooleanParam("Scale", true);

public Spiral() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/XYZTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class XYZTest extends ParametrizedFilter {
private final RangeParam x = new RangeParam("X", -20, 0, 20);
private final RangeParam y = new RangeParam("Y", -20, 0, 20);
private final RangeParam z = new RangeParam("Z", -20, 0, 20);
private final BooleanParam linRGB = new BooleanParam("Linearize", false);
private final BooleanParam linRGB = new BooleanParam("Linearize");

// private static final ColorSpace XYZ_CS = ColorSpace.getInstance(ColorSpace.CS_CIEXYZ);

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pixelitor/filters/gmic/BoxFitting.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -33,7 +33,7 @@ public class BoxFitting extends GMICFilter {
private final RangeParam maxSize = new RangeParam("Maximal Size", 1, 50, 100);
private final RangeParam density = new RangeParam("Initial Density", 0, 25, 100);
private final RangeParam minSpacing = new RangeParam("Minimal Spacing", 1, 1, 100);
private final BooleanParam transparency = new BooleanParam("Transparency", false);
private final BooleanParam transparency = new BooleanParam("Transparency");

public BoxFitting() {
maxSize.ensureHigherValueThan(minSize);
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/pixelitor/filters/gui/BooleanParam.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -41,6 +41,10 @@ public class BooleanParam extends AbstractFilterParam {
private final boolean addResetButton;
private List<ItemListener> pendingItemListeners;

public BooleanParam(String name) {
this(name, false, ALLOW_RANDOMIZE);
}

public BooleanParam(String name, boolean defaultValue) {
this(name, defaultValue, ALLOW_RANDOMIZE);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pixelitor/filters/gui/StrokeParam.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand Down Expand Up @@ -47,7 +47,7 @@ public class StrokeParam extends AbstractFilterParam {
private final EnumParam<StrokeJoin> strokeJoinParam = StrokeJoin.asParam();
private final EnumParam<StrokeType> strokeTypeParam = StrokeType.asParam();
private final EnumParam<ShapeType> shapeTypeParam = ShapeType.asParam();
private final BooleanParam dashedParam = new BooleanParam("Dashed", false);
private final BooleanParam dashedParam = new BooleanParam("Dashed");

private ResetButton resetButton;
private JComponent previewer;
Expand Down
Loading

0 comments on commit b365989

Please sign in to comment.