Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lbalazscs committed Apr 10, 2022
1 parent cebf139 commit 0e402c9
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/ChannelToTransparency.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ int getChannelValue(int rgb) {
}

@Override
public void randomize() {
public void randomizeSettings() {
// no settings
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/pixelitor/filters/Colorize.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.Serial;

import static pixelitor.filters.gui.ColorParam.TransparencyPolicy.NO_TRANSPARENCY;
import static pixelitor.gui.GUIText.BRIGHTNESS;
Expand All @@ -36,6 +37,9 @@
public class Colorize extends ParametrizedFilter {
public static final String NAME = i18n("colorize");

@Serial
private static final long serialVersionUID = 7036946857972080432L;

private final RangeParam brightnessParam = new RangeParam(
BRIGHTNESS, -100, 0, 100);
private final ColorParam colorParam = new ColorParam(
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/ParametrizedFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected void showAffectedArea() {
}

@Override
public void randomize() {
public void randomizeSettings() {
paramSet.randomize();
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/pixelitor/filters/PoissonDiskTester.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.Serial;
import java.util.SplittableRandom;

import static java.awt.RenderingHints.KEY_ANTIALIASING;
Expand All @@ -39,6 +40,9 @@
public class PoissonDiskTester extends ParametrizedFilter {
public static final String NAME = "Poisson Disk Sampling";

@Serial
private static final long serialVersionUID = -6684473485597318552L;

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);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/RandomFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected BufferedImage transform(BufferedImage src, BufferedImage dest) {
}

@Override
public void randomize() {
public void randomizeSettings() {
throw new UnsupportedOperationException("this should not be called");
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/convolve/Convolve.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public FilterGUI createGUI(Drawable dr, boolean reset) {
}

@Override
public void randomize() {
public void randomizeSettings() {
kernelMatrix = createRandomKernelMatrix(matrixOrder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public BufferedImage transform(BufferedImage src, BufferedImage dest) {
}

@Override
public void randomize() {
public void randomizeSettings() {
// not supported yet
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/gui/FilterWithGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected FilterWithGUI() {
*/
public abstract FilterGUI createGUI(Drawable dr, boolean reset);

public abstract void randomize();
public abstract void randomizeSettings();

private JMenuBar getMenuBar() {
boolean addPresets = canHaveUserPresets() || hasBuiltinPresets();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/levels/Levels.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public BufferedImage transform(BufferedImage src, BufferedImage dest) {
}

@Override
public void randomize() {
public void randomizeSettings() {
int inputDark = Rnd.nextInt(255);
int inputLight = Rnd.nextInt(255);
int outputDark = Rnd.nextInt(255);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/painters/TextFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public FilterGUI createGUI(Drawable dr, boolean reset) {
}

@Override
public void randomize() {
public void randomizeSettings() {
settings.randomize();
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/pixelitor/filters/painters/TextSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ public boolean hasWatermark() {
return watermark;
}

public void setWatermark(boolean watermark) {
this.watermark = watermark;
}

public double getRotation() {
return rotation;
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/pixelitor/utils/debug/Debug.java
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,15 @@ private static void addSmartFilter(Composition comp, Filter filter) {
TextSettings settings = new TextSettings();
settings.randomize();
settings.setText(filter.getName());
settings.setWatermark(false);
TextLayer textLayer = new TextLayer(comp, "", settings);
textLayer.updateLayerName();

SmartObject smartObject = new SmartObject(textLayer);
smartObject.setOpacity(0.2f, false);
new Composition.LayerAdder(comp).add(smartObject);
if (filter instanceof FilterWithGUI guiFilter) {
guiFilter.randomize();
guiFilter.randomizeSettings();
smartObject.startPreviewing();
filter.startOn(smartObject, PREVIEWING);
smartObject.onFilterDialogAccepted(filter.getName());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/utils/test/RandomGUITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ private static void randomFilter() {
long runCountBefore = Filter.runCount;

if (filter instanceof FilterWithGUI guiFilter) {
guiFilter.randomize();
guiFilter.randomizeSettings();
dr.startPreviewing();

try {
Expand Down

0 comments on commit 0e402c9

Please sign in to comment.