public Region get(int part) { return Region.create(getRectangle(getRect(), part)); }
/** * check if current region contains given point * * @param point Point * @return true/false */ public boolean contains(Location point) { return getRect().contains(point.x, point.y); }
/** * create a region that is the intersection of the given regions * * @param ir the region to intersect with like AWT Rectangle API * @return the new region */ public Region intersection(Region ir) { Rectangle r = getRect().intersection(ir.getRect()); return Region.create(r.x, r.y, r.width, r.height, scr); }
/** * create a ScreenImage with given region on this screen * * @param reg The Region to be captured * @return the image of the region */ @Override public ScreenImage capture(Region reg) { return capture(reg.getRect()); }
@Override public void update(EventSubject es) { Graphics2D g = ((OverlayTransparentWindow) es).getJPanelGraphics(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); drawRayPolygon(g, current, target.getRect()); } /*
public SxSpotlight(Region region){ super(); this.region = region; if (region != null) setActualBounds(region.getRect()); setShape(RECTANGLE); }
/** * create a region enlarged w pixels on left and right side and h pixels at top and bottom * * @param w pixels horizontally * @param h pixels vertically * @return the new region */ public Region grow(int w, int h) { Rectangle r = getRect(); r.grow(w, h); return Region.create(r.x, r.y, r.width, r.height, scr); }
public SxAnchor(Region region) { super(); if (region != null) { this.region = region; setActualBounds(region.getRect()); } setForeground(Color.black); }
public SxClickable(Region region) { this.region = region; if (region != null) { this.setActualBounds(region.getRect()); this.setActualLocation(region.x, region.y); } }
@Override public void updateComponent() { setActualBounds(getTarget().getRect()); }
@Override public void globalMouseMoved(int x, int y) { current = new Point(x, y); repaint(); if (target.getRect().contains(current)) { setVisible(false); dispose(); listener.transitionOccurred(this); } } }
@Override public void updateComponent() { setActualBounds(targetRegion.getRect()); setForeground(colorFront); super.setLocationRelative(Layout.OVER); }
/** * extend the region, so it contains the given point<br>but only the part inside the current screen * * @param loc the point to include * @return the region itself */ public Region add(Location loc) { Rectangle rect = getRect(); rect.add(loc.x, loc.y); setRect(rect); initScreen(null); return this; } //</editor-fold>
/** * create a ScreenImage with given coordinates on this screen. * * @param x x-coordinate of the region to be captured * @param y y-coordinate of the region to be captured * @param w width of the region to be captured * @param h height of the region to be captured * @return the image of the region */ @Override public ScreenImage capture(int x, int y, int w, int h) { Rectangle rect = newRegion(new Location(x, y), w, h).getRect(); return capture(rect); }
@Override public void updateComponent() { setActualBounds(getTarget().getRect()); setForeground(colorFront); super.setLocationRelative(Layout.OVER); }
private void init(Region region) { try { robot = new Robot(); } catch (AWTException e1) { e1.printStackTrace(); } content = getJPanel(); _region = region; Rectangle rect = _region.getRect(); content.setPreferredSize(rect.getSize()); add(content); setBounds(rect); getRootPane().putClientProperty("Window.shadow", Boolean.FALSE); ((JPanel) getContentPane()).setDoubleBuffered(true); setVisible(false); setFocusableWindowState(false); }