/** * Sets the selection rectangle based on the initial selection start point previously set in {@link #startPoint} and * the end point passed as parameters to this method * <p> * The coordinates are based on the real image coordinates */ private void refreshCurrentSelection(int x, int y) { int startX = Math.min(startPoint.x, x); int startY = Math.min(startPoint.y, y); int width = Math.abs(startPoint.x - x); int height = Math.abs(startPoint.y - y); currentSelection = new Rectangle(startX, startY, width, height); // Decreases 1 pixel size from original image because Rectangle.intersect() consider them as right-bottom limit Rectangle imageBounds = workImage.getBounds(); imageBounds.width--; imageBounds.height--; currentSelection.intersect(imageBounds); }
/** * Redraw only rect. * * @param rect * the rectangle */ public void invalidate(Rectangle rect) { Rectangle r = getClientArea(); r.intersect(rect); redrawSpecial(new RedrawTarget(r)); }
/** * Crops the given bounds such that they lie completely on the closest monitor. * * @param bounds shell bounds to crop * @since 3.4 */ void cropToClosestMonitor(Rectangle bounds) { Rectangle monitorBounds= getClosestMonitor(fSubjectControl.getDisplay(), bounds).getClientArea(); bounds.intersect(monitorBounds); }
/** * Sets the clipping to the intersection of the current clip region and * the specified rectangle. * * @param x the x-coordinate. * @param y the y-coordinate. * @param width the width. * @param height the height. */ @Override public void clipRect(int x, int y, int width, int height) { org.eclipse.swt.graphics.Rectangle clip = this.gc.getClipping(); org.eclipse.swt.graphics.Rectangle r = new org.eclipse.swt.graphics.Rectangle(x, y, width, height); clip.intersect(r); this.gc.setClipping(clip); }
/** * Crops the given bounds such that they lie completely on the closest monitor. * * @param bounds shell bounds to crop * @since 3.4 */ void cropToClosestMonitor(Rectangle bounds) { Rectangle monitorBounds= Util.getClosestMonitor(fSubjectControl.getDisplay(), Geometry.centerPoint(bounds)).getClientArea(); bounds.intersect(monitorBounds); }
area.intersect(bounds); return area;
area.intersect(bounds); return area;
curScreen.intersect(dim); int area = curScreen.width*curScreen.height; if(area > topIntersectArea)
private void handleDrawRequest(GC gc, int x, int y, int w, int h) { int startLine= fTextWidget.getLineIndex(y); int endLine= fTextWidget.getLineIndex(y + h - 1); if (startLine <= endLine && startLine < fTextWidget.getLineCount()) { // avoid painting into the margins: Rectangle clipping= gc.getClipping(); Rectangle clientArea= fTextWidget.getClientArea(); int leftMargin= fTextWidget.getLeftMargin(); int rightMargin= fTextWidget.getRightMargin(); clientArea.x+= leftMargin; clientArea.width-= leftMargin + rightMargin; clipping.intersect(clientArea); gc.setClipping(clientArea); if (fIsAdvancedGraphicsPresent) { int alpha= gc.getAlpha(); gc.setAlpha(fAlpha); drawLineRange(gc, startLine, endLine, x, w); gc.setAlpha(alpha); } else { drawLineRange(gc, startLine, endLine, x, w); } gc.setClipping(clipping); } }
available.intersect(proposed); int area= available.width * available.height; if (area > bestArea) {
available.intersect(proposed); int area= available.width * available.height; if (area > bestArea) {
private void handleDrawRequest(GC gc, int x, int y, int w, int h) { int startLine= fTextWidget.getLineIndex(y); int endLine= fTextWidget.getLineIndex(y + h - 1); if (startLine <= endLine && startLine < fTextWidget.getLineCount()) { // avoid painting into the margins: Rectangle clipping= gc.getClipping(); Rectangle clientArea= fTextWidget.getClientArea(); int leftMargin= fTextWidget.getLeftMargin(); int rightMargin= fTextWidget.getRightMargin(); clientArea.x+= leftMargin; clientArea.width-= leftMargin + rightMargin; clipping.intersect(clientArea); gc.setClipping(clientArea); if (fIsAdvancedGraphicsPresent) { int alpha= gc.getAlpha(); gc.setAlpha(fAlpha); drawLineRange(gc, startLine, endLine, x, w); gc.setAlpha(alpha); } else { drawLineRange(gc, startLine, endLine, x, w); } gc.setClipping(clipping); } }
if (errX != 0 || errY != 0) { if (errX <= deviceZoom / 100 && errY <= deviceZoom / 100) { src.intersect(b); } else { SWT.error (SWT.ERROR_INVALID_ARGUMENT);
foregroundDrawArea.y += foregroundOffsetOnBg.y; foregroundDrawArea.intersect(backgroundArea);