Uses 108K of libraries. Click here for Pure Java version (9058L/65K).
1  | // onColor is called with null value when mouse moves outside of image surface  | 
2  | svoid imageSurfaceColorPicker(ImageSurface is, VF1<RGB> onColor) {
 | 
3  | if (is == null || onColor == null) ret;  | 
4  |   swing {
 | 
5  |     MouseAdapter ma = new MouseAdapter {
 | 
6  |       public void mouseMoved(MouseEvent e) { pick(e); }
 | 
7  |       public void mouseEntered(MouseEvent e) { pick(e); }
 | 
8  |       public void mouseExited(MouseEvent e) { pick(null); }
 | 
9  | |
10  |       void pick(MouseEvent e) {
 | 
11  | if (e == null) callF(onColor, (RGB) null);  | 
12  | else callF(onColor, bufferedImage_getRGB(is.getImage(), is.pointFromEvent(e)));  | 
13  | }  | 
14  | };  | 
15  | is.addMouseMotionListener(ma);  | 
16  | is.addMouseListener(ma);  | 
17  | }  | 
18  | }  | 
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1024564 | 
| Snippet name: | imageSurfaceColorPicker | 
| Eternal ID of this version: | #1024564/4 | 
| Text MD5: | 69ff8d5247413dc46aefa9060ceca58b | 
| Transpilation MD5: | a3dd21e019c980ee367671645f1dc831 | 
| Author: | stefan | 
| Category: | javax / image analysis | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2019-08-18 14:52:56 | 
| Source code size: | 692 bytes / 18 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 465 / 586 | 
| Version history: | 3 change(s) | 
| Referenced in: | [show references] |