Skip to content

Commit

Permalink
updated maven build (but it's still wonky), more feedback on automate…
Browse files Browse the repository at this point in the history
…d filter progress
  • Loading branch information
kamil-sita committed Nov 25, 2018
1 parent a3d02c8 commit 0ddde75
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 16 deletions.
39 changes: 37 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
<artifactId>pdfbox</artifactId>
<version>2.0.12</version>
</dependency>

<dependency>
<groupId>pl.ksitarski.simplekmeans</groupId>
<artifactId>sample</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/simple_kmeans.jar</systemPath>
</dependency>
</dependencies>

<build>
Expand All @@ -29,6 +37,34 @@
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<!-- put your configurations here -->
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>

<resources>
Expand All @@ -38,12 +74,11 @@
<includes>
<include>**/*.fxml</include>
<include>**/*.css</include>
<include>**/*.MF</include>
</includes>
</resource>
</resources>
</build>




</project>
2 changes: 1 addition & 1 deletion src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}


Expand Down
Binary file added src/main/resources/simple_kmeans.jar
Binary file not shown.

0 comments on commit 0ddde75

Please sign in to comment.