@Override public void updateRegion(Region region) { outerRect = new Rectangle(innerRect.x - width, innerRect.y - width, innerRect.width + (2 * width), innerRect.height + (2 * width)); region.add(outerRect); region.subtract(innerRect); }
@Override public void updateRegion(Region region) { outerRect = new Rectangle(innerRect.x - width, innerRect.y - width, innerRect.width + (2 * width), innerRect.height + (2 * width)); region.add(outerRect); region.subtract(innerRect); }
/** * Subtracts the given rectangle from the collection of polygons * the receiver maintains to describe its area. * * @param rect the rectangle to subtract from the receiver * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the argument is null</li> * <li>ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative</li> * </ul> * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> * * @since 3.0 */ public void subtract(Rectangle rect) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); subtract (rect.x, rect.y, rect.width, rect.height); }
@Override public void renderStep(AnimationEngine engine) { if (shellRegion != null) { shellRegion.dispose(); shellRegion = new Region(getAnimationShell().getDisplay()); } // Iterate across the set of start/end rects Iterator currentRects = getCurrentRects(engine.amount()).iterator(); while (currentRects.hasNext()) { Rectangle curRect = (Rectangle) currentRects.next(); Rectangle rect = Geometry.toControl(getAnimationShell(), curRect); shellRegion.add(rect); rect.x += LINE_WIDTH; rect.y += LINE_WIDTH; rect.width = Math.max(0, rect.width - 2 * LINE_WIDTH); rect.height = Math.max(0, rect.height - 2 * LINE_WIDTH); shellRegion.subtract(rect); } getAnimationShell().setRegion(shellRegion); getAnimationShell().getDisplay().update(); }
/** * Subtracts the given rectangle from the collection of polygons * the receiver maintains to describe its area. * * @param x the x coordinate of the rectangle * @param y the y coordinate of the rectangle * @param width the width coordinate of the rectangle * @param height the height coordinate of the rectangle * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative</li> * </ul> * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> * * @since 3.1 */ public void subtract(int x, int y, int width, int height) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); subtract(new Rectangle(x, y, width, height)); }
/** * Subtracts the given rectangle from the collection of polygons * the receiver maintains to describe its area. * * @param x the x coordinate of the rectangle * @param y the y coordinate of the rectangle * @param width the width coordinate of the rectangle * @param height the height coordinate of the rectangle * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative</li> * </ul> * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> * * @since 3.1 */ public void subtract(int x, int y, int width, int height) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); subtract(new Rectangle(x, y, width, height)); }
/** * Subtracts the given rectangle from the collection of polygons * the receiver maintains to describe its area. * * @param x the x coordinate of the rectangle * @param y the y coordinate of the rectangle * @param width the width coordinate of the rectangle * @param height the height coordinate of the rectangle * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative</li> * </ul> * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> * * @since 3.1 */ public void subtract(int x, int y, int width, int height) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); subtract(new Rectangle(x, y, width, height)); }
public void setDragHost(Shell hostingShell, int xOffset, int yOffset) { dragHost = hostingShell; offsetX = xOffset; offsetY = yOffset; dragHostBounds = null; if (dragHost == null) return; // Punch a 'hole' where the cursor is using a region Region rgn = dragHost.getRegion(); // if (rgn != null && !rgn.isDisposed()) // rgn.dispose(); // rgn = new Region(display); Rectangle bounds = dragHost.getBounds(); rgn.add(0, 0, bounds.width, bounds.height); rgn.subtract(offsetX, offsetY, 1, 1); dragHost.setRegion(rgn); initialHostSize = dragHost.getSize(); // Do an initial 'track' Point curLoc = dragHost.getDisplay().getCursorLocation(); dragHost.setLocation(curLoc.x - offsetX, curLoc.y - offsetY); dragHost.layout(true); }
public void setDragHost(Shell hostingShell, int xOffset, int yOffset) { dragHost = hostingShell; offsetX = xOffset; offsetY = yOffset; dragHostBounds = null; if (dragHost == null) { return; } // Punch a 'hole' where the cursor is using a region Region rgn = dragHost.getRegion(); // if (rgn != null && !rgn.isDisposed()) // rgn.dispose(); // rgn = new Region(display); Rectangle bounds = dragHost.getBounds(); rgn.add(0, 0, bounds.width, bounds.height); rgn.subtract(offsetX, offsetY, 1, 1); dragHost.setRegion(rgn); initialHostSize = dragHost.getSize(); // Do an initial 'track' Point curLoc = dragHost.getDisplay().getCursorLocation(); dragHost.setLocation(curLoc.x - offsetX, curLoc.y - offsetY); dragHost.layout(true); }
private void defineRegion() { Region rgn = new Region(); for (Rectangle r : rects) { rgn.add(r); rgn.subtract(r.x + 2, r.y + 2, r.width - 4, r.height - 4); } if (feedbackShell.getRegion() != null && !feedbackShell.getRegion().isDisposed()) feedbackShell.getRegion().dispose(); feedbackShell.setRegion(rgn); feedbackShell.redraw(); display.update(); }
public void update() { final Display display = Display.getCurrent(); if (display == null) return; reset(); cursorPos = display.getCursorLocation(); if (dragHost != null && !dragHost.isDisposed() && dragHost.getVisible()) { if (dragHostBounds == null) { // First move the dragHost so that its 'hole' is where the mouse is dragHost.setLocation(cursorPos.x - offsetX, cursorPos.y - offsetY); } else { // Move the 'hole' to where the cursor is Point cursorLoc = display.getCursorLocation(); cursorLoc = display.map(null, dragHost, cursorLoc); Region rgn = dragHost.getRegion(); Rectangle bounds = dragHost.getBounds(); rgn.add(0, 0, bounds.width, bounds.height); rgn.subtract(cursorLoc.x, cursorLoc.y, 1, 1); } } curCtrl = display.getCursorControl(); if (curCtrl == null) return; curElement = getModelElement(curCtrl); setItemInfo(); }
public void setDragHostBounds(Rectangle displayRect) { if (dragHost == null) { return; } dragHostBounds = displayRect; // Re-attach the drag host to the cursor if (dragHostBounds == null) { dragHost.setSize(initialHostSize); setDragHost(dragHost, offsetX, offsetY); return; } // dragHost.setVisible(false); dragHost.setAlpha(200); dragHost.setBounds(dragHostBounds); // punch a 'hole' where the cursor *is* Point cursorLoc = display.getCursorLocation(); cursorLoc = display.map(null, dragHost, cursorLoc); Region rgn = dragHost.getRegion(); Rectangle bounds = dragHost.getBounds(); rgn.add(0, 0, bounds.width, bounds.height); rgn.subtract(cursorLoc.x, cursorLoc.y, 1, 1); display.update(); }
public void setDragHostBounds(Rectangle displayRect) { if (dragHost == null) return; dragHostBounds = displayRect; // Re-attach the drag host to the cursor if (dragHostBounds == null) { dragHost.setSize(initialHostSize); setDragHost(dragHost, offsetX, offsetY); return; } // dragHost.setVisible(false); dragHost.setAlpha(200); dragHost.setBounds(dragHostBounds); // punch a 'hole' where the cursor *is* Point cursorLoc = display.getCursorLocation(); cursorLoc = display.map(null, dragHost, cursorLoc); Region rgn = dragHost.getRegion(); Rectangle bounds = dragHost.getBounds(); rgn.add(0, 0, bounds.width, bounds.height); rgn.subtract(cursorLoc.x, cursorLoc.y, 1, 1); display.update(); }
rgn.add(outerBounds); Rectangle innerBounds = new Rectangle(x, y, frameRect.width, frameRect.height); rgn.subtract(innerBounds); } else { Rectangle itemBounds = new Rectangle(x, y, frameRect.width, frameRect.height);
Rectangle bounds = dragHost.getBounds(); rgn.add(0, 0, bounds.width, bounds.height); rgn.subtract(cursorLoc.x, cursorLoc.y, 1, 1);
private void defineRegion() { Region rgn = new Region(); for (Rectangle r : rects) { rgn.add(r); rgn.subtract(r.x + 2, r.y + 2, r.width - 4, r.height - 4); } // Workaround: Some window managers draw a drop shadow even if the shell // is set to NO_TRIM. By making the shell contain a component in the // bottom-right of its parent shell, SWT won't resize it and any extra // shadows will end up being drawn on top of the shadows for the parent // shell rather than in the middle of the workbench window. Composite parent = feedbackShell.getParent(); if (parent instanceof Shell) { Shell parentShell = (Shell) parent; Rectangle bounds = parentShell.getBounds(); rgn.add(bounds.width - 1, bounds.height - 1, 1, 1); } if (feedbackShell.getRegion() != null && !feedbackShell.getRegion().isDisposed()) { feedbackShell.getRegion().dispose(); } feedbackShell.setRegion(rgn); feedbackShell.redraw(); display.update(); }
rgn.add(outerBounds); Rectangle innerBounds = new Rectangle(x, y, frameRect.width, frameRect.height); rgn.subtract(innerBounds); } else { Rectangle itemBounds = new Rectangle(x, y, frameRect.width, frameRect.height);
simpleCurveClose[index++] = bounds.width; simpleCurveClose[index++] = bounds.height; r.subtract(simpleCurveClose); Region clipping = new Region(); gc.getClipping(clipping);
invertedSelection.subtract(inside); gc.setClipping(invertedSelection); gc.fillRectangle(canvas.getClientArea());
case 3: region1.subtract(region2); break; case 4: