Uses 3981K of libraries. Click here for Pure Java version (10136L/74K/276K).
!7 p-substance { if (l(args) != 0) new Viewer().showFile(new File(join(" ", args))); else inputFilePath("Image to view", voidfunc(File file) { new Viewer().showFile(file) }); } sclass Viewer { ImageSurface is; File file; void showFile(final File file) { assertTrue("File not found: " + absolutePath(file), file.exists()); this.file = file; bool first = is == null; is = showImage_centered(is, file.getName(), loadBufferedImage(file)); awt { is.zoomToWindow(); } if (first) { registerLeftKey(getFrame(is), r { nextFile(-1) }); registerRightKey(getFrame(is), r { nextFile(1) }); registerMinusKeys(is, r { is.zoomOut(1.5) }); registerPlusKeys(is, r { is.zoomIn(1.5) }); registerKey(is, KeyEvent.VK_A, "A", r { is.setZoom(1.0) }); registerKey(is, KeyEvent.VK_W, "W", r { is.zoomToWindow() }); hideConsole(); } } void nextFile(int offset) { L<File> files = asList(listFilesOnly(file.getParentFile())); int i = indexOfPred(files, func(File f) { eq(f.getName(), file.getName()) }); showFile(get(files, mod(i+offset, l(files)))); } }
Began life as a copy of #1006685
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007760 |
Snippet name: | Local Image Viewer 2 (fits image in window by default) |
Eternal ID of this version: | #1007760/3 |
Text MD5: | 5169ab8763f71bc2c98acdbe7e492367 |
Transpilation MD5: | 8f3b318abdbb256b944ca459ab3733d5 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-06-03 01:09:09 |
Source code size: | 1172 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 773 / 2544 |
Version history: | 2 change(s) |
Referenced in: | [show references] |