public ScreenImage getSelection() { if (canceled) { return null; } BufferedImage cropImg = cropSelection(); if (cropImg == null) { return null; } rectSelection.x += scrOCP.getX(); rectSelection.y += scrOCP.getY(); ScreenImage ret = new ScreenImage(rectSelection, cropImg); return ret; }
private void captureScreen(IScreen scr) { ScreenImage simg = scr.capture(); scr_img = simg.getImage(); darker_factor = 0.6f; RescaleOp op = new RescaleOp(darker_factor, 0, null); scr_img_darker = op.filter(scr_img, null); }
@Override public void paint(Graphics g) { if (scr_img != null) { Graphics2D g2dWin = (Graphics2D) g; if (bi == null) { bi = new BufferedImage(scrOCP.getW(), scrOCP.getH(), BufferedImage.TYPE_INT_RGB); } Graphics2D bfG2 = bi.createGraphics(); bfG2.drawImage(scr_img_darker, 0, 0, this); drawMessage(bfG2); drawSelection(bfG2); g2dWin.drawImage(bi, 0, 0, this); setVisible(true); } else { setVisible(false); } }
private void drawScreenFrame(Graphics2D g2d, int scrId) { g2d.setColor(screenFrameColor); g2d.setStroke(strokeScreenFrame); if (screenFrame == null) { screenFrame = Screen.getBounds(scrId); Rectangle ubound = scrOCP.getBounds(); screenFrame.x -= ubound.x; screenFrame.y -= ubound.y; int sw = (int) (strokeScreenFrame.getLineWidth() / 2); screenFrame.x += sw; screenFrame.y += sw; screenFrame.width -= sw * 2; screenFrame.height -= sw * 2; } g2d.draw(screenFrame); }
public void prompt(String msg) { captureScreen(scrOCP); Rectangle rect = new Rectangle(scrOCP.getBounds()); this.setBounds(rect); promptMsg = msg; Debug.log( 4, "CapturePrompt: [%d,%d (%d, %d)] %s", rect.x, rect.y, rect.width, rect.height, promptMsg); this.setVisible(true); if (!Settings.isJava7()) { if (Settings.isMac()) { SysUtil.getOSUtil().bringWindowToFront(this, false); } } this.requestFocus(); }