area.exclusiveOr(new Area(new Rectangle(x, y, pBounds.x + pBounds.width - x, pBounds.y + pBounds.height - y)));
/** Sets the shape of this region to the union of its current shape and the shape of the given region, minus their intersection. @param region The region to be joined with this region as described. @throws NullPointerException If {@code region} is {@code null}. */ public void exclusive(final Region region) { area.exclusiveOr(region.area); }
/** Converts all points in @param area to ints by casting. */ static public final Area areaInInts(final Area area) { final Area a = new Area(); for (final Polygon pol : M.getPolygons(area)) { a.exclusiveOr(new Area(pol)); } return a; }
@Override public void paintBorder( final Component c, final Graphics g, final int x, final int y, final int width, final int height ) { if ( ( this.thickness > 0 ) && ( g instanceof Graphics2D ) ) { final Graphics2D g2d = ( Graphics2D ) g; final Object oldRenderingHint = g2d.getRenderingHint( RenderingHints.KEY_ANTIALIASING ); final Color oldColor = g2d.getColor(); g2d.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ); final float arc = 4f * thickness; final Shape inner = new RoundRectangle2D.Float( x, y, width - 1, height - 1, (int) arc, (int) arc ); final Shape outer = new Rectangle( x, y, width, height ); g2d.setColor( parent.getBackground() ); final Area area = new Area(outer); area.exclusiveOr( new Area(inner) ); g2d.fill( area ); g2d.setColor( this.lineColor ); g2d.draw( inner ); g2d.setColor( oldColor ); g2d.setRenderingHint( RenderingHints.KEY_ANTIALIASING, oldRenderingHint ); } }
@Override public void draw(HwmfGraphics ctx) { if (polyList.isEmpty()) { return; } int windingRule = getWindingRule(ctx); Area area = null; for (Path2D poly : polyList) { Path2D p = (Path2D)poly.clone(); p.setWindingRule(windingRule); Area newArea = new Area(p); if (area == null) { area = newArea; } else { area.exclusiveOr(newArea); } } ctx.fill(area); } }
ShapeRoi unaryOp(ShapeRoi sr, int op) { AffineTransform at = new AffineTransform(); at.translate(x, y); Area a1 = new Area(at.createTransformedShape(getShape())); at = new AffineTransform(); at.translate(sr.x, sr.y); Area a2 = new Area(at.createTransformedShape(sr.getShape())); try { switch (op) { case OR: a1.add(a2); break; case AND: a1.intersect(a2); break; case XOR: a1.exclusiveOr(a2); break; case NOT: a1.subtract(a2); break; } } catch(Exception e) {} Rectangle r = a1.getBounds(); at = new AffineTransform(); at.translate(-r.x, -r.y); setShape(new GeneralPath(at.createTransformedShape(a1))); x = r.x; y = r.y; cachedMask = null; return this; }
ShapeRoi unaryOp(ShapeRoi sr, int op) { AffineTransform at = new AffineTransform(); at.translate(x, y); Area a1 = new Area(at.createTransformedShape(getShape())); at = new AffineTransform(); at.translate(sr.x, sr.y); Area a2 = new Area(at.createTransformedShape(sr.getShape())); try { switch (op) { case OR: a1.add(a2); break; case AND: a1.intersect(a2); break; case XOR: a1.exclusiveOr(a2); break; case NOT: a1.subtract(a2); break; } } catch(Exception e) {} Rectangle r = a1.getBounds(); at = new AffineTransform(); at.translate(-r.x, -r.y); setShape(new GeneralPath(at.createTransformedShape(a1))); x = r.x; y = r.y; cachedMask = null; return this; }
area.exclusiveOr(new Area(new Rectangle(x, y, pBounds.x + pBounds.width - x, pBounds.y + pBounds.height - y)));
a1.exclusiveOr(new Area(r2)); Area a2 = new Area(r2); a2.add(new Area(r1));
public Shape createStrokedShape( Shape shape ) { Area area1 = new Area( stroke1.createStrokedShape( shape ) ); Area area2 = new Area( stroke2.createStrokedShape( shape ) ); switch ( operation ) { case ADD: area1.add( area2 ); break; case SUBSTRACT: area1.subtract( area2 ); break; case INTERSECT: area1.intersect( area2 ); break; case DIFFERENCE: area1.exclusiveOr( area2 ); break; } return area1; }
/** * Set the shape of this area node to be the combined area of its current * shape and the shape of the specified area, minus their intersection. The * resulting shape of this area node will include only areas that were contained * in either this area node or in the specified area, but not in both. * * @param area area to exclusive or, must not be null * @throws NullPointerException if area is null */ public void exclusiveOr(final Area area) { Area oldArea = (Area) this.area.clone(); this.area.exclusiveOr(area); updateBoundsFromShape(); firePropertyChange(-1, "area", oldArea, getArea()); }
/** * Set the shape of this area node to be the combined area of its current * shape and the shape of the specified area, minus their intersection. The * resulting shape of this area node will include only areas that were contained * in either this area node or in the specified area, but not in both. * * @param area area to exclusive or, must not be null * @throws NullPointerException if area is null */ public void exclusiveOr(final Area area) { Area oldArea = (Area) this.area.clone(); this.area.exclusiveOr(area); updateBoundsFromShape(); firePropertyChange(-1, "area", oldArea, getArea()); }
public static BezierPath op(final BezierPath path1, final BezierPath path2, final OP op) { final Area area1 = new Area(path1.toGeneralPath()); final Area area2 = new Area(path2.toGeneralPath()); switch (op) { case ADD: area1.add(area2); break; case XOR: area1.exclusiveOr(area2); break; case INTERSECT: area1.intersect(area2); break; case SUBTRACT: area1.subtract(area2); break; } return toBezierPath(area1.getPathIterator(new AffineTransform())); }
Area temp = a; line.intersect(temp); temp.exclusiveOr(line);
System.out.println(showBounds("spaceTest", spaceTestArea)); Area xOr = (Area)spaceTestArea.clone(); xOr.exclusiveOr(moveLineArea); System.out.printf("Pre %s %s %s%n", showBounds("STA", spaceTestArea), showBounds("MLA", moveLineArea), showBounds("xOr", xOr)); spaceTestArea.subtract(uArea); xOr = (Area)spaceTestArea.clone(); xOr.exclusiveOr(moveLineArea); System.out.printf("i: %02d %s %s %s %s%n", i, showBounds("STA", spaceTestArea),
String.valueOf((char) i)); Area area2 = new Area(moveToOrigin(gv2.getOutline())); area2.exclusiveOr(area1);
if (clip != null) { Area a = new Area(shape); a.exclusiveOr(new Area(clip)); renderer.setClip(a); } else {