diff --git a/pom.xml b/pom.xml
index d084689..85d71d4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,6 +15,14 @@
pdfbox
2.0.12
+
+
+ pl.ksitarski.simplekmeans
+ sample
+ 1.0
+ system
+ ${project.basedir}/src/main/resources/simple_kmeans.jar
+
@@ -29,6 +37,34 @@
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.1.0
+
+
+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.1
+
+
+
+
+
+ package
+
+ shade
+
+
+
+
+
@@ -38,12 +74,11 @@
**/*.fxml
**/*.css
+ **/*.MF
-
-
\ No newline at end of file
diff --git a/src/main/java/Main.java b/src/main/java/Main.java
index a9eaef9..53c64f3 100644
--- a/src/main/java/Main.java
+++ b/src/main/java/Main.java
@@ -14,7 +14,7 @@ public static void main(String[] args) {
public void start(Stage stage) throws Exception{
var res = getClass().getResource("sections/main/mainView.fxml");
Parent root = FXMLLoader.load(res);
- stage.setTitle("XIS pre-alpha");
+ stage.setTitle("XIS 0.2");
stage.setScene(new Scene (root, 1280, 800));
stage.setMinHeight(480);
stage.setMinWidth(800);
diff --git a/src/main/java/sections/automatedfilter/AutomatedFilterController.java b/src/main/java/sections/automatedfilter/AutomatedFilterController.java
index eed64cb..fe605b3 100644
--- a/src/main/java/sections/automatedfilter/AutomatedFilterController.java
+++ b/src/main/java/sections/automatedfilter/AutomatedFilterController.java
@@ -82,26 +82,31 @@ void loadFile(ActionEvent event) {
@FXML
void previewPress(ActionEvent event) {
+ UserFeedback.reportProgress("Previewing page...");
int page = PdfIO.getNumberOfPages(openPdf);
page = (int) (page * 0.1);
try {
page = Integer.parseInt(previewPage.getText());
- BufferedImage inputImage = null;
- if (page == lastPage) {
- inputImage = lastImage;
- } else {
- inputImage = PdfIO.getPdfAsImage(openPdf, page);
- lastImage = inputImage;
- }
- BufferedImage finalInputImage = inputImage; //"variable should be effectively final"
- new Thread(() -> {
- var output = HighPassFilterConverter.convert(finalInputImage, 5, scaleBrightness.isSelected(), brightnessSlider.getValue()/100.0, higherQuality.isSelected());
- Platform.runLater(() -> setNewImage(output));
- }).start();
-
} catch (Exception e) {
//
}
+ //variables below are necessary as a workaround for lambda
+ final BufferedImage[] inputImage = new BufferedImage[1];
+ int finalPage = page;
+
+ new Thread(() -> {
+ UserFeedback.reportProgress("Loading image...");
+ if (finalPage == lastPage) {
+ inputImage[0] = lastImage;
+ } else {
+ inputImage[0] = PdfIO.getPdfAsImage(openPdf, finalPage);
+ lastImage = inputImage[0];
+ }
+ UserFeedback.reportProgress("Filtering image...");
+ var output = HighPassFilterConverter.convert(inputImage[0], 5, scaleBrightness.isSelected(), brightnessSlider.getValue()/100.0, higherQuality.isSelected());
+ Platform.runLater(() -> setNewImage(output));
+ UserFeedback.reportProgress("Generated preview.");
+ }).start();
}
diff --git a/src/main/resources/simple_kmeans.jar b/src/main/resources/simple_kmeans.jar
new file mode 100644
index 0000000..5995b31
Binary files /dev/null and b/src/main/resources/simple_kmeans.jar differ