Skip to content

Commit

Permalink
Fixed export saving bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tiggerbiggo committed Oct 18, 2018
1 parent 954b66c commit 0b0c8f6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ target/
imgs/
*.prim
*.jar
*.bat
*.bat
*.zip
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
public class FileManager {

public static void writeGif(BufferedImage[] imgSequence, int BufferedImageType,
int timeBetweenFramesMS, boolean loop, String filename) {
int timeBetweenFramesMS, boolean loop, File file) {
try {
try (ImageOutputStream output = new FileImageOutputStream(fromRelative(filename + ".gif"))) {
try (ImageOutputStream output = new FileImageOutputStream(file)) {
GifSequenceWriter writer = new GifSequenceWriter(output, BufferedImageType,
timeBetweenFramesMS, loop);
for (BufferedImage B : imgSequence) {
Expand All @@ -40,8 +40,8 @@ public static void writeGif(BufferedImage[] imgSequence, int BufferedImageType,
}
}

public static void writeGif(BufferedImage[] imgSequence, String filename) {
writeGif(imgSequence, BufferedImage.TYPE_INT_RGB, 0, true, filename);
public static void writeGif(BufferedImage[] imgSequence, File file) {
writeGif(imgSequence, BufferedImage.TYPE_INT_RGB, 0, true, file);
}

public static byte[] writeByteArray(BufferedImage img) {
Expand Down
10 changes: 8 additions & 2 deletions PrimaView/src/main/java/sample/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,14 @@ private void onBtnPreview(ActionEvent e) {
private void onBtnSave(ActionEvent e) {
try {
FileManager.writeGif(
nodePane.render(spnWidth.getValue(), spnHeight.getValue(), 60),
FileManager.showSaveDialogue(ViewMain.getMainStage(), "exports/", FileManager.GIF).toString());
nodePane.render(
spnWidth.getValue(),
spnHeight.getValue(),
60),
FileManager.showSaveDialogue(
ViewMain.getMainStage(),
"exports/",
FileManager.GIF));
} catch (IOException ex) {
ex.printStackTrace();
}
Expand Down
1 change: 0 additions & 1 deletion PrimaView/src/main/java/sample/NodeSerializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ public static NodePane parseNodes(String toParse, ChangeListener listen){
input.link(output);
currentLine++;
}

return pane;
}

Expand Down

0 comments on commit 0b0c8f6

Please sign in to comment.