private void drawScreenFrame(Graphics2D g2d, int scrId) { if (!isLocalScreen) { return; } 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); }
/** * resets this region (usually a Screen object) to the coordinates of the containing screen * <p> * Because of the wanted side effect for the containing screen, this should only be used with screen objects. For * Region objects use setRect() instead. */ public void setROI() { setROI(getScreen().getBounds()); }
/** * create a region left of the left side with same height and given width<br> * negative width creates the left part with width inside the region use grow() to include the current region <br> * * @param width pixels * @return the new region */ public Region left(int width) { int _x; if (width < 0) { _x = x; } else { _x = x - width; } return Region.create(getScreen().getBounds().intersection(new Rectangle(_x, y, Math.abs(width), h)), scr); }
/** * create a region above the top side with same width and given height<br> * negative height creates the top part with height inside the region use grow() to include the current region * * @param height pixels * @return the new region */ public Region above(int height) { int _y; if (height < 0) { _y = y; } else { _y = y - height; } return Region.create(getScreen().getBounds().intersection(new Rectangle(x, _y, w, Math.abs(height))), scr); }
void drawMessage(Graphics2D g2d) { if (promptMsg == null) { return; } g2d.setFont(fontMsg); g2d.setColor(new Color(1f, 1f, 1f, 1)); int sw = g2d.getFontMetrics().stringWidth(promptMsg); int sh = g2d.getFontMetrics().getMaxAscent(); Rectangle ubound = scrOCP.getBounds(); for (int i = 0; i < Screen.getNumberScreens(); i++) { if (!Screen.getScreen(i).hasPrompt()) { continue; } Rectangle bound = Screen.getBounds(i); int cx = bound.x + (bound.width - sw) / 2 - ubound.x; int cy = bound.y + (bound.height - sh) / 2 - ubound.y; g2d.drawString(promptMsg, cx, cy); } }
/** * new region with same offset to current screen's top left on given screen * * @param screen new parent screen * @return new region */ public Region copyTo(IScreen screen) { Location o = new Location(getScreen().getBounds().getLocation()); Location n = new Location(screen.getBounds().getLocation()); return Region.create(n.x + x - o.x, n.y + y - o.y, w, h, screen); }
/** * New point with same offset to current screen's top left on given screen * * @param screen new parent screen * @return new location */ public Location copyTo(IScreen screen) { IScreen s = getScreen(); s = (s == null ? Screen.getPrimaryScreen() : s); Location o = new Location(s.getBounds().getLocation()); Location n = new Location(screen.getBounds().getLocation()); return new Location(n.x + x - o.x, n.y + y - o.y); }
scr_img_darker = scr_img; scr_img_type = scr_img.getType(); scr_img_rect = new Rectangle(scrOCP.getBounds()); promptMsg = msg; if (isLocalScreen) {