当前位置: 首页>>代码示例>>Java>>正文


Java Area.subtract方法代码示例

本文整理汇总了Java中java.awt.geom.Area.subtract方法的典型用法代码示例。如果您正苦于以下问题:Java Area.subtract方法的具体用法?Java Area.subtract怎么用?Java Area.subtract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.geom.Area的用法示例。


在下文中一共展示了Area.subtract方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: draw

import java.awt.geom.Area; //导入方法依赖的package包/类
/**
 * Draws the frame.  This method is called by the {@link DialPlot} class,
 * you shouldn't need to call it directly.
 *
 * @param g2  the graphics target (<code>null</code> not permitted).
 * @param plot  the plot (<code>null</code> not permitted).
 * @param frame  the frame (<code>null</code> not permitted).
 * @param view  the view (<code>null</code> not permitted).
 */
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, 
        Rectangle2D view) {
    
    Shape window = getWindow(frame);
    
    Rectangle2D f = DialPlot.rectangleByRadius(frame, this.radius + 0.02, 
            this.radius + 0.02);
    Ellipse2D e = new Ellipse2D.Double(f.getX(), f.getY(), f.getWidth(), 
            f.getHeight());
    
    Area area = new Area(e);
    Area area2 = new Area(window);
    area.subtract(area2);
    g2.setPaint(this.backgroundPaint);
    g2.fill(area);
    
    g2.setStroke(this.stroke);
    g2.setPaint(this.foregroundPaint);
    g2.draw(window);
    g2.draw(e);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:31,代码来源:SimpleDialFrame.java

示例2: updateVisionShape

import java.awt.geom.Area; //导入方法依赖的package包/类
@Override
public void updateVisionShape() {
  final Path2D path = new Path2D.Float();
  final Path2D renderPath = new Path2D.Float();
  path.append(this.getMapVisionCircle(this.combatEntity), false);
  renderPath.append(this.getRenderVisionArc(this.combatEntity), false);

  for (final ICombatEntity entity : this.environment.getCombatEntities()) {
    if (entity.isFriendly(this.combatEntity) && !entity.equals(this.combatEntity)) {
      path.append(this.getMapVisionCircle(entity), false);
      renderPath.append(this.getRenderVisionArc(entity), false);
    }
  }

  this.renderVisionShape = renderPath;

  final float width = (float) this.environment.getMap().getSizeInPixels().getWidth();
  final float height = (float) this.environment.getMap().getSizeInPixels().getHeight();
  final Rectangle2D rect = new Rectangle2D.Float(0, 0, width, height);
  final Area rectangleArea = new Area(rect);
  rectangleArea.subtract(new Area(path));

  this.fogOfWar = rectangleArea;
}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:25,代码来源:CombatEntityVision.java

示例3: drawUtilizationMulti

import java.awt.geom.Area; //导入方法依赖的package包/类
private void drawUtilizationMulti(double U, Color startC, Color border, boolean gradientFill, Graphics2D g2d, int cpu) {

		double x = getProcessorXY().x, y = getProcessorXY().y;
		try {
			occupiedRect = new Rectangle2D.Double(x + PROC_RAD / 2 + ELEMS_GAP / 2, y + cpu * (PROC_RAD - ELEMS_GAP) + ELEMS_GAP * cpu * 3
					- ELEMS_GAP / 2, PROC_RAD - ELEMS_GAP, (PROC_RAD - ELEMS_GAP) * (1 - U / nCpu));
		} catch (Exception e) {
			occupiedRect = new Rectangle2D.Double(x + PROC_RAD / 2 + ELEMS_GAP / 2, y + cpu * (PROC_RAD - ELEMS_GAP) + ELEMS_GAP * cpu * 3
					- ELEMS_GAP / 2, PROC_RAD - ELEMS_GAP, 0);
		}
		occupiedEll = new Ellipse2D.Double(x + PROC_RAD / 2 + ELEMS_GAP / 2, y + cpu * (PROC_RAD - ELEMS_GAP) + ELEMS_GAP * cpu * 3 - ELEMS_GAP / 2,
				PROC_RAD - ELEMS_GAP, PROC_RAD - ELEMS_GAP);
		if (gradientFill) {
			GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + 2 * PROC_RAD), startC.darker(),
					false);
			g2d.setPaint(gp);
		} else {
			g2d.setPaint(startC);
		}
		occupiedArea = new Area(occupiedEll);
		occupiedArea.subtract(new Area(occupiedRect));
		g2d.fill(occupiedArea);
		g2d.setPaint(Color.BLACK);
		g2d.draw(occupiedArea);

	}
 
开发者ID:max6cn,项目名称:jmt,代码行数:27,代码来源:QueueDrawer.java

示例4: paintComponent

import java.awt.geom.Area; //导入方法依赖的package包/类
protected void paintComponent(Graphics g1D) {
    if (theImage == null || theRectangle == null)
        return;
    Graphics2D g = (Graphics2D) g1D;
    Insets insets = getInsets();
    int xOffset = insets.left;
    int yOffset = insets.top;
    int availableWidth = getWidth() - insets.left - insets.right;
    int availableHeight = getHeight() - insets.top - insets.bottom;
    g.drawImage(theImage, xOffset, yOffset, null);
    Color tmpColor = g.getColor();
    Area area = new Area(new Rectangle(xOffset, yOffset, availableWidth,
            availableHeight));
    area.subtract(new Area(theRectangle));
    g.setColor(new Color(200, 200, 200, 128));
    g.fill(area);
    g.setColor(Color.BLACK);
    g.draw(theRectangle);
    g.setColor(tmpColor);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:21,代码来源:ScrollPanePreview.java

示例5: drawFrame

import java.awt.geom.Area; //导入方法依赖的package包/类
private void drawFrame(GraphicsDecorator g, Shape shape, Color color, Point2D.Float pos) {
    Shape old_clip = g.getClip();
    AffineTransform old = g.getTransform();
    AffineTransform t = g.getTransform();
    t.concatenate(AffineTransform.getTranslateInstance(pos.x, pos.y));
    g.setTransform(t);
    g.setColor(color);
    Stroke old_stroke = g.getStroke();
    g.setStroke(new BasicStroke(10.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND));
    Area a = new Area(g.getClip());
    a.subtract(new Area(shape));
    g.setClip(a);
    g.draw(shape);
    g.setTransform(old);
    g.setStroke(old_stroke);
    g.setClip(old_clip);
}
 
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:18,代码来源:ViwnVertexRenderer.java

示例6: createInactiveConformationShape

import java.awt.geom.Area; //导入方法依赖的package包/类
private static Shape createInactiveConformationShape() {

        // Create the overall outline.
        GeneralPath outline = new GeneralPath();

        outline.moveTo( 0, (float) HEIGHT / 2 );
        outline.quadTo( (float) WIDTH / 2, (float) HEIGHT / 2, (float) WIDTH / 2, -(float) HEIGHT / 3 );
        outline.quadTo( 0, (float) ( -HEIGHT * 0.8 ), (float) -WIDTH / 2, (float) -HEIGHT / 3 );
        outline.lineTo( (float) -WIDTH / 2, (float) ( HEIGHT * 0.25 ) );
        outline.closePath();
        Area area = new Area( outline );

        // Get the shape of a lactose molecule and shift it to the appropriate
        // position.
        Shape lactoseShape = Lactose.getShape();
        AffineTransform transform = new AffineTransform();
        transform.setToTranslation( 0, HEIGHT / 2 );
        lactoseShape = transform.createTransformedShape( lactoseShape );

        // Subtract off the shape of the lactose molecule.
        area.subtract( new Area( lactoseShape ) );

        return area;
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:25,代码来源:LacI.java

示例7: paint

import java.awt.geom.Area; //导入方法依赖的package包/类
public void paint(Graphics2D g, int x, int y, int width, int height) {
	g.setRenderingHints( Thumbnail.qualityHints );
	Shape outer, inner;
	g.setColor(color);
	if(innerCurvature>0 || outerCurvature>0) {
		outer = new RoundRectangle2D.Float(x, y, width, height, outerCurvature, outerCurvature);
		inner = new RoundRectangle2D.Float(x + thickness, y + thickness, width - thickness*2, height - thickness*2, innerCurvature, innerCurvature);
	} else {
		outer = new Rectangle(x, y, width, height);
		inner = new Rectangle(x + thickness, y + thickness, width - thickness*2, height - thickness*2);
	}
	
	AffineTransform tx = g.getTransform();
	if(tx.getShearX()==0 && tx.getShearY()==0) {
		//this should be faster, but produces pixelated artifacts when rotated
		GeneralPath path = new GeneralPath( GeneralPath.WIND_EVEN_ODD );
		path.append(outer, false);
		path.append(inner, false);
		g.fill(path);
	} else {
		Area area = new Area(outer);
		area.subtract(new Area(inner));
		g.fill(area);
	}
}
 
开发者ID:mickleness,项目名称:pumpernickel,代码行数:26,代码来源:BasicThumbnail.java

示例8: applyShape

import java.awt.geom.Area; //导入方法依赖的package包/类
@Override
public void applyShape() {
    Shape shape;
    Area a = new Area(new Rectangle2D.Float(0, 0, 200, 200));
    GeneralPath gp;
    gp = new GeneralPath();
    gp.moveTo(190, 0);
    gp.lineTo(200, 0);
    gp.lineTo(200, 10);
    gp.lineTo(10, 200);
    gp.lineTo(0, 200);
    gp.lineTo(0, 190);
    gp.closePath();
    a.subtract(new Area(gp));
    shape = a;

    window.setShape(shape);
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:19,代码来源:FocusAWTTest.java

示例9: draw

import java.awt.geom.Area; //导入方法依赖的package包/类
/**
 * Draws the frame.
 *
 * @param g2  the graphics target.
 * @param plot  the plot.
 * @param frame  the dial's reference frame.
 * @param view  the dial's view rectangle.
 */
@Override
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame,
        Rectangle2D view) {

    Shape window = getWindow(frame);
    Shape outerWindow = getOuterWindow(frame);

    Area area1 = new Area(outerWindow);
    Area area2 = new Area(window);
    area1.subtract(area2);
    g2.setPaint(Color.lightGray);
    g2.fill(area1);

    g2.setStroke(this.stroke);
    g2.setPaint(this.foregroundPaint);
    g2.draw(window);
    g2.draw(outerWindow);

}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:28,代码来源:ArcDialFrame.java

示例10: paintBorder

import java.awt.geom.Area; //导入方法依赖的package包/类
@SuppressWarnings("unused")
public void paintBorder(Component c, Graphics g0, int x, int y,
		int width, int height) {
	Graphics2D g = (Graphics2D)g0;
	Area area = new Area(new Rectangle(x, y, width, height));
	area.subtract(new Area(new Rectangle(
			x+insets.left, y+insets.top,
			width-insets.left-insets.right,
			height-insets.top-insets.bottom
	)));
	if(c.isOpaque()) {
		Color bkgnd = c.getBackground();
		g.setColor(bkgnd);
		g.fill(area);
	}
	if(false) {
		g.setColor(debugColor);
		g.fill(area);
	}
}
 
开发者ID:mickleness,项目名称:pumpernickel,代码行数:21,代码来源:BasicQOptionPaneUI.java

示例11: getShadowMask

import java.awt.geom.Area; //导入方法依赖的package包/类
private Shape getShadowMask( Shape parentMask ) {
    Area area = new Area(parentMask);

    AffineTransform tx = new AffineTransform();
    tx.translate(SHADOW_SIZE, SHADOW_SIZE );//Math.sin(ANGLE)*(getHeight()+SHADOW_SIZE), 0);
    area.transform(tx);
    area.subtract(new Area(parentMask));
    return area;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:BalloonManager.java

示例12: drawUtilization

import java.awt.geom.Area; //导入方法依赖的package包/类
private void drawUtilization(double U, Color startC, Color border, boolean gradientFill, Graphics2D g2d) {

		double x = getProcessorXY().x, y = getProcessorXY().y;
		try {
			occupiedRect = new Rectangle2D.Double(x, y, 2 * PROC_RAD, 2 * PROC_RAD * (1 - U));
		} catch (Exception e) {
			occupiedRect = new Rectangle2D.Double(x, y, 2 * PROC_RAD, 0.0);
		}
		occupiedEll = new Ellipse2D.Double(x, y, 2 * PROC_RAD, 2 * PROC_RAD);
		if (gradientFill) {
			GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + 2 * PROC_RAD), startC.darker(),
					false);
			g2d.setPaint(gp);
		} else {
			g2d.setPaint(startC);
		}
		occupiedArea = new Area(occupiedEll);
		occupiedArea.subtract(new Area(occupiedRect));
		g2d.fill(occupiedArea);
		g2d.setPaint(Color.BLACK);
		g2d.draw(occupiedArea);

		// //draw informations about processes
		// txtBounds = drawCenteredText("job n.:" + donejobs, Color.BLACK, x +
		// PROC_RAD,y + PROC_RAD * 2 + 4 * ELEMS_GAP,g2d, false);
		// //draw orizontal line parallel to occupation
		//			
		// //draw box around text
		// txtBounds.setFrame(
		// x + PROC_RAD - txtBounds.getWidth() / 2,
		// y + 2 * PROC_RAD + 4 * ELEMS_GAP - txtBounds.getHeight() / 2,
		// txtBounds.getWidth(),
		// txtBounds.getHeight());
		//			
		// g2d.draw(txtBounds);
	}
 
开发者ID:max6cn,项目名称:jmt,代码行数:37,代码来源:QueueDrawer.java

示例13: drawUtilization2

import java.awt.geom.Area; //导入方法依赖的package包/类
private void drawUtilization2(double U, Color startC, Color border, boolean gradientFill, Graphics2D g2d, int cpu) {

		double x = getProcessorXY().x, y = getProcessorXY().y;
		try {
			occupiedRect = new Rectangle2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, PROC_RAD
					* (1 - U / nCpu));
		} catch (Exception e) {
			occupiedRect = new Rectangle2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, 0.0);
		}
		occupiedEll = new Ellipse2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, 2 * PROC_RAD / 2);
		if (gradientFill) {
			GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + 2 * PROC_RAD), startC.darker(),
					false);
			g2d.setPaint(gp);
		} else {
			g2d.setPaint(startC);
		}
		occupiedArea = new Area(occupiedEll);
		occupiedArea.subtract(new Area(occupiedRect));
		g2d.fill(occupiedArea);
		g2d.setPaint(Color.BLACK);
		g2d.draw(occupiedArea);

		// //draw informations about processes
		// txtBounds = drawCenteredText("job n.:" + donejobs, Color.BLACK, x +
		// PROC_RAD,y + PROC_RAD * 2 + 4 * ELEMS_GAP,g2d, false);
		// //draw orizontal line parallel to occupation
		//			
		// //draw box around text
		// txtBounds.setFrame(
		// x + PROC_RAD - txtBounds.getWidth() / 2,
		// y + 2 * PROC_RAD + 4 * ELEMS_GAP - txtBounds.getHeight() / 2,
		// txtBounds.getWidth(),
		// txtBounds.getHeight());
		//			
		// g2d.draw(txtBounds);
	}
 
开发者ID:max6cn,项目名称:jmt,代码行数:38,代码来源:QueueDrawer.java

示例14: drawOccupiedPercentage

import java.awt.geom.Area; //导入方法依赖的package包/类
private void drawOccupiedPercentage(Color startC, Color border, boolean gradientFill, Graphics2D g2d) {

		if (remainingTime[0] != 0) {
			double x = getProcessorXY().x, y = getProcessorXY().y;
			occupiedRect = new Rectangle2D.Double(x, y, 2 * PROC_RAD, 2 * PROC_RAD * (1 - (double) remainingTime[0] / (double) totTime[0]));
			occupiedEll = new Ellipse2D.Double(x, y, 2 * PROC_RAD, 2 * PROC_RAD);
			if (gradientFill) {
				GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + 2 * PROC_RAD), startC.darker(),
						false);
				g2d.setPaint(gp);
			} else {
				g2d.setPaint(startC);
			}
			occupiedArea = new Area(occupiedEll);
			occupiedArea.subtract(new Area(occupiedRect));
			g2d.fill(occupiedArea);
			g2d.setPaint(Color.BLACK);
			g2d.draw(occupiedArea);

			// draw orizontal line parallel to occupation
			Line2D.Double l = new Line2D.Double(x + PROC_RAD * 2 + ELEMS_GAP, y + PROC_RAD * 2
					* (1 - (double) remainingTime[0] / (double) totTime[0]), x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + PROC_RAD * 2
					* (1 - (double) remainingTime[0] / (double) totTime[0]));
			g2d.draw(l);

			// draw vertical line
			l = new Line2D.Double(x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + PROC_RAD * 2 * (1 - (double) remainingTime[0] / (double) totTime[0]), x
					+ PROC_RAD * 2 + 2 * ELEMS_GAP, y + 2 * PROC_RAD + 4 * ELEMS_GAP - txtBounds.getHeight() / 2);
			g2d.draw(l);

			// draw horizontal line under text
			txtBounds.setFrame(x + PROC_RAD - txtBounds.getWidth() / 2, y + 2 * PROC_RAD + 4 * ELEMS_GAP - txtBounds.getHeight() / 2, txtBounds
					.getWidth(), txtBounds.getHeight());

			g2d.draw(txtBounds);
		}
	}
 
开发者ID:max6cn,项目名称:jmt,代码行数:38,代码来源:QueueDrawer.java

示例15: drawOccupiedPercentage2

import java.awt.geom.Area; //导入方法依赖的package包/类
private void drawOccupiedPercentage2(Color startC, Color border, boolean gradientFill, Graphics2D g2d, int cpu) {
	//processor.setFrame(x+PROC_RAD/2 , y + cpu*PROC_RAD, 2 * PROC_RAD /2, 2 * PROC_RAD /2);

	//		if (remainingTime[cpu] != 0) {
	double x = getProcessorXY().x, y = getProcessorXY().y;
	occupiedRect = new Rectangle2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, 2 * PROC_RAD
			* (1 - (double) remainingTime[cpu] / (double) totTime[cpu]) / 2);
	occupiedEll = new Ellipse2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, 2 * PROC_RAD / 2);
	if (gradientFill) {
		GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + 2 * PROC_RAD), startC.darker(),
				false);
		g2d.setPaint(gp);
	} else {
		g2d.setPaint(startC);
	}
	occupiedArea = new Area(occupiedEll);
	occupiedArea.subtract(new Area(occupiedRect));
	g2d.fill(occupiedArea);
	g2d.setPaint(Color.BLACK);
	g2d.draw(occupiedArea);

	// draw orizontal line parallel to occupation
	Line2D.Double l = new Line2D.Double(x + PROC_RAD * 2 + ELEMS_GAP, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2 + 2 * PROC_RAD
			* (1 - (double) remainingTime[cpu] / (double) totTime[cpu]) / 2,//y + PROC_RAD * 2 * (1 - (double) remainingTime / (double) totTime) /2 + ELEMS_GAP * cpu -  ELEMS_GAP /2  , 
			x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2 + 2 * PROC_RAD
					* (1 - (double) remainingTime[cpu] / (double) totTime[cpu]) / 2);//y + PROC_RAD * 2 * (1 - (double) remainingTime / (double) totTime) /2 + ELEMS_GAP * cpu -  ELEMS_GAP /2 );
	g2d.draw(l);

	// draw vertical line
	l = new Line2D.Double(x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2 + 2 * PROC_RAD
			* (1 - (double) remainingTime[cpu] / (double) totTime[cpu]) / 2, x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + PROC_RAD * 2 / 2 + cpu
			* PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2);
	g2d.draw(l);

	//		}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:37,代码来源:QueueDrawer.java


注:本文中的java.awt.geom.Area.subtract方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。