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


Java Path2D.append方法代码示例

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


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

示例1: updateVisionShape

import java.awt.geom.Path2D; //导入方法依赖的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

示例2: getDropIndication

import java.awt.geom.Path2D; //导入方法依赖的package包/类
@Override
protected Shape getDropIndication( TopComponent draggedTC, Point location ) {
    location = SwingUtilities.convertPoint( getComponent(), location, getTabDisplayer() );
    Path2D res = new Path2D.Double();
    Rectangle tabRect = getTabDisplayer().dropIndication( draggedTC, location );
    if( null != tabRect ) {
        tabRect = SwingUtilities.convertRectangle( getTabDisplayer(), tabRect, container );
        res.append( tabRect, false );
    }
    res.append( container.getContentArea(), false );
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:TabbedImpl.java

示例3: createIntermediateShape

import java.awt.geom.Path2D; //导入方法依赖的package包/类
/**
 * Creates the shape for a single part of the intermediate bar.
 *
 * @param x
 * @param width
 * @param h
 * @param verticval
 * @return
 */
private Path2D createIntermediateShape(double x, double width, double h) {
	int offset = 10;

	Path2D path = new Path2D.Double();
	path.append(new Line2D.Double(x, h, x + offset, 0), true);
	path.append(new Line2D.Double(x + offset, 0, x + width + offset, 0), true);
	path.append(new Line2D.Double(x + width + offset, 0, x + width, h), true);
	path.append(new Line2D.Double(x + width, h, x, h), true);

	return path;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:21,代码来源:ProgressBarUI.java

示例4: createTopTabShape

import java.awt.geom.Path2D; //导入方法依赖的package包/类
/**
 * Creates the shape for a top tab.
 *
 * @param x
 * @param y
 * @param w
 * @param h
 * @param rTop
 * @param addBottom
 *            if {@code false}, the bottom line below the tab will not be added to the shape
 * @return
 */
private static Path2D createTopTabShape(int x, int y, int w, int h, double rTop, boolean addBottom) {
	Path2D path = new Path2D.Double();
	path.append(new Line2D.Double(x, y + h - 1, x, y + rTop), true);

	QuadCurve2D curve = new QuadCurve2D.Double(x, y + rTop, x, y, x + rTop, y);
	path.append(curve, true);

	path.append(new Line2D.Double(x + rTop, y, x + w - rTop, y), true);

	curve = new QuadCurve2D.Double(x + w - rTop, y, x + w, y, x + w, y + rTop);
	path.append(curve, true);

	path.append(new Line2D.Double(x + w, y + rTop, x + w, y + h), true);

	if (addBottom) {
		path.append(new Line2D.Double(x + w, y + h - 1, x, y + h - 1), true);
	}
	return path;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:32,代码来源:TabbedPaneUI.java

示例5: createLeftTabShape

import java.awt.geom.Path2D; //导入方法依赖的package包/类
/**
 * Creates the shape for a left tab.
 *
 * @param x
 * @param y
 * @param w
 * @param h
 * @param rLeft
 * @param addSide
 *            if {@code false}, the closing side line right of the tab will not be added to the
 *            shape
 * @return
 */
private static Path2D createLeftTabShape(int x, int y, int w, int h, double rLeft, boolean addSide) {
	Path2D path = new Path2D.Double();
	path.append(new Line2D.Double(x + w, y + h, x + rLeft, y + h), true);

	QuadCurve2D curve = new QuadCurve2D.Double(x + rLeft, y + h, x, y + h, x, y + h - rLeft);
	path.append(curve, true);

	path.append(new Line2D.Double(x, y + h - rLeft, x, y + rLeft), true);

	curve = new QuadCurve2D.Double(x, y + rLeft, x, y, x + rLeft, y);
	path.append(curve, true);

	path.append(new Line2D.Double(x + rLeft, y, x + w, y), true);

	if (addSide) {
		path.append(new Line2D.Double(x + w, y, x + w, y + h - 1), true);
	}
	return path;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:33,代码来源:TabbedPaneUI.java

示例6: paintBorder

import java.awt.geom.Path2D; //导入方法依赖的package包/类
/**
 * Paints the border for the specified component with the
 * specified position and size.
 * @param c the component for which this border is being painted
 * @param g the paint graphics
 * @param x the x position of the painted border
 * @param y the y position of the painted border
 * @param width the width of the painted border
 * @param height the height of the painted border
 */
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if ((this.thickness > 0) && (g instanceof Graphics2D)) {
        Graphics2D g2d = (Graphics2D) g;

        Color oldColor = g2d.getColor();
        g2d.setColor(this.lineColor);

        Shape outer;
        Shape inner;

        int offs = this.thickness;
        int size = offs + offs;
        if (this.roundedCorners) {
            float arc = .2f * offs;
            outer = new RoundRectangle2D.Float(x, y, width, height, offs, offs);
            inner = new RoundRectangle2D.Float(x + offs, y + offs, width - size, height - size, arc, arc);
        }
        else {
            outer = new Rectangle2D.Float(x, y, width, height);
            inner = new Rectangle2D.Float(x + offs, y + offs, width - size, height - size);
        }
        Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD);
        path.append(outer, false);
        path.append(inner, false);
        g2d.fill(path);
        g2d.setColor(oldColor);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:LineBorder.java

示例7: paintBorder

import java.awt.geom.Path2D; //导入方法依赖的package包/类
/**
 * Paints the border for the specified component with the
 * specified position and size.
 *
 * @param c the component for which this border is being painted
 * @param g the paint graphics
 * @param x the x position of the painted border
 * @param y the y position of the painted border
 * @param width the width of the painted border
 * @param height the height of the painted border
 */
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if ((this.thickness > 0) && (g instanceof Graphics2D)) {
        Graphics2D g2d = (Graphics2D) g;

        Color oldColor = g2d.getColor();
        g2d.setColor(this.lineColor);

        Shape outer;
        Shape inner;

        int offs = this.thickness;
        int size = offs + offs;
        if (this.roundedCorners) {
            float arc = .2f * offs;
            outer = new RoundRectangle2D.Float(x, y, width, height, offs, offs);
            inner = new RoundRectangle2D.Float(x + offs, y + offs, width - size, height - size, arc, arc);
        }
        else {
            outer = new Rectangle2D.Float(x, y, width, height);
            inner = new Rectangle2D.Float(x + offs, y + offs, width - size, height - size);
        }
        Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD);
        path.append(outer, false);
        path.append(inner, false);
        g2d.fill(path);
        g2d.setColor(oldColor);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:LineBorder.java

示例8: getShape

import java.awt.geom.Path2D; //导入方法依赖的package包/类
@Override
public Shape getShape() {
  Path2D shape = new Path2D.Float();
  int xDiff = Math.abs(getSuperclass().getCenterX() - getSubclass().getCenterX());
  int yDiff = Math.abs(getSuperclass().getCenterY() - getSubclass().getCenterY());
  if (xDiff > 2 * yDiff) {
    if (getSuperclass().getStartX() > getSubclass().getEndX()) {
      trianglePosition = Position.LEFT;
      shape.moveTo(getSuperclass().getStartX(), getSuperclass().getCenterY());
      shape.lineTo(getSuperclass().getStartX() - cos30,
        getSuperclass().getCenterY() - sin30);
      shape.lineTo(getSuperclass().getStartX() - cos30,
        getSuperclass().getCenterY() - sinNeg30);
      shape.lineTo(getSuperclass().getStartX(), getSuperclass().getCenterY());
    } else if (getSuperclass().getEndX() < getSubclass().getStartX()) {
      trianglePosition = Position.RIGHT;
      shape.moveTo(getSuperclass().getEndX(), getSuperclass().getCenterY());
      shape.lineTo(getSuperclass().getEndX() + cos30,
        getSuperclass().getCenterY() + sin30);
      shape.lineTo(getSuperclass().getEndX() + cos30,
        getSuperclass().getCenterY() + sinNeg30);
      shape.lineTo(getSuperclass().getEndX(), getSuperclass().getCenterY());
    }
  } else {
    if (getSuperclass().getStartY() > getSubclass().getEndY()) {
      trianglePosition = Position.TOP;
      shape.moveTo(getSuperclass().getCenterX(), getSuperclass().getStartY());
      shape.lineTo(getSuperclass().getCenterX() - sin30,
        getSuperclass().getStartY() - cos30);// 30°
      shape.lineTo(getSuperclass().getCenterX() - sinNeg30,
        getSuperclass().getStartY() - cosNeg30);// 30°
      shape.lineTo(getSuperclass().getCenterX(), getSuperclass().getStartY());
    } else {
      trianglePosition = Position.BOTTOM;
      shape.moveTo(getSuperclass().getCenterX(), getSuperclass().getEndY());
      shape.lineTo(getSuperclass().getCenterX() + sin30,
        getSuperclass().getEndY() + cos30);// 30°
      shape.lineTo(getSuperclass().getCenterX() + sinNeg30,
        getSuperclass().getEndY() + cosNeg30);// 30°
      shape.lineTo(getSuperclass().getCenterX(), getSuperclass().getEndY());
    }
  }
  try {
    shape.closePath();
  } catch (IllegalPathStateException e) {
    return super.getShape();
  }
  shape.append(super.getShape(), false);
  return shape;
}
 
开发者ID:onprom,项目名称:onprom,代码行数:51,代码来源:Inheritance.java


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