Libraryless. Click here for Pure Java version (7593L/51K/165K).
!752 concepts. !include #1005393 // Marked Screenshot Classes static ImageSurface imageSurface; static JButton btnMark; static JFrame frame; static BufferedImage img; static BWImage bwImage; static Screenshot screenshot; static JTextField tfDesc; svoid makeScreenshot { img = shootScreen2(); screenshot = new Screenshot(img); bwImage = new BWImage(img); } p { concepts(); screenshot = last(list(Screenshot)); if (screenshot != null) { // keep working with last screenshot img = loadImage2(screenshot.pngFile()); bwImage = new BWImage(img); } else // make new one makeScreenshot(); imageSurface = new ImageSurface(img) { public void setSelection(Rectangle r) { super.setSelection(r); btnMark.setEnabled(r != null); } }; JPanel buttons = jcenteredline( jMinWidth(300, onEnter(tfDesc = new JTextField, "mark")), btnMark = jbutton("Mark", "mark"), jbutton("Shoot again", r { hideFrame(frame); swingLater(5000, r { makeScreenshot(); imageSurface.setImage(img); makeFrameVisible(imageSurface); maximizeFrame(imageSurface); }); }) ); frame = showMaximizedFrame(centerAndSouth( new JScrollPane(imageSurface), buttons)); } svoid mark { Rectangle r = imageSurface.getSelection(); if (r == null) ret; S desc = tfDesc.getText().trim(); cnew(MarkedClip, +screenshot, positionInScreenshot := new Rect(r), img := bwImage.clip(r), description := desc); showAnimation("#1005392", quote(desc), 1); print("Marked clip! " + quote(desc) + " (" + r + ")"); tfDesc.selectAll(); tfDesc.requestFocus(); }
Began life as a copy of #1004147
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005389 |
Snippet name: | Mark Screenshot Sections [works] |
Eternal ID of this version: | #1005389/1 |
Text MD5: | 62a7b9486064bae34b516756f6e75331 |
Transpilation MD5: | fa334adf45028f08e337625f77abd7a7 |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-11-26 01:40:04 |
Source code size: | 1730 bytes / 71 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 561 / 1903 |
Referenced in: | [show references] |