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


Java GeneralPath.quadTo方法代码示例

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


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

示例1: drawGlassEffect

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
/**
 * Draws the glass effect
 */
public static void drawGlassEffect(mxGraphics2DCanvas canvas, mxCellState state) {
  double size = 0.4;
  canvas.getGraphics()
      .setPaint(new GradientPaint((float) state.getX(), (float) state.getY(),
          new Color(1, 1, 1, 0.9f), (float) (state.getX()),
          (float) (state.getY() + state.getHeight() * size), new Color(1, 1, 1, 0.3f)));

  float sw = (float) (mxUtils.getFloat(state.getStyle(), mxConstants.STYLE_STROKEWIDTH, 1)
      * canvas.getScale() / 2);

  GeneralPath path = new GeneralPath();
  path.moveTo((float) state.getX() - sw, (float) state.getY() - sw);
  path.lineTo((float) state.getX() - sw, (float) (state.getY() + state.getHeight() * size));
  path.quadTo((float) (state.getX() + state.getWidth() * 0.5),
      (float) (state.getY() + state.getHeight() * 0.7),
      (float) (state.getX() + state.getWidth() + sw),
      (float) (state.getY() + state.getHeight() * size));
  path.lineTo((float) (state.getX() + state.getWidth() + sw), (float) state.getY() - sw);
  path.closePath();

  canvas.getGraphics().fill(path);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:26,代码来源:mxLabelShape.java

示例2: computeShield

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
private static GeneralPath computeShield(int width, int height) {
	GeneralPath base;
	if (width < 40) {
		base = SHIELD_NARROW;
	} else if (width < 60) {
		base = SHIELD_MEDIUM;
	} else {
		base = SHIELD_WIDE;
	}

	if (height <= width) { // no wings
		return base;
	} else { // we need to add wings
		int wingHeight = (height - width) / 2;
		int dx = Math.min(20, wingHeight / 4);

		GeneralPath path = new GeneralPath();
		path.moveTo(-width, -height / 2);
		path.quadTo(-width + dx, -(width + height) / 4, -width, -width / 2);
		path.append(base, true);
		path.quadTo(-width + dx, (width + height) / 4, -width, height / 2);
		return path;
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:25,代码来源:PainterShaped.java

示例3: drawGlassEffect

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
/**
 * Draws the glass effect
 */
public static void drawGlassEffect(mxGraphics2DCanvas canvas,
		mxCellState state)
{
	double size = 0.4;
	canvas.getGraphics().setPaint(
			new GradientPaint((float) state.getX(), (float) state.getY(),
					new Color(1, 1, 1, 0.9f), (float) (state.getX()),
					(float) (state.getY() + state.getHeight() * size),
					new Color(1, 1, 1, 0.3f)));

	float sw = (float) (mxUtils.getFloat(state.getStyle(),
			mxConstants.STYLE_STROKEWIDTH, 1) * canvas.getScale() / 2);

	GeneralPath path = new GeneralPath();
	path.moveTo((float) state.getX() - sw, (float) state.getY() - sw);
	path.lineTo((float) state.getX() - sw,
			(float) (state.getY() + state.getHeight() * size));
	path.quadTo((float) (state.getX() + state.getWidth() * 0.5),
			(float) (state.getY() + state.getHeight() * 0.7),
			(float) (state.getX() + state.getWidth() + sw),
			(float) (state.getY() + state.getHeight() * size));
	path.lineTo((float) (state.getX() + state.getWidth() + sw),
			(float) state.getY() - sw);
	path.closePath();

	canvas.getGraphics().fill(path);
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:31,代码来源:mxLabelShape.java

示例4: main

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
public static void main(String[] args) {

        GeneralPath shape = new GeneralPath();
        int[] pointTypes = {0, 0, 1, 1, 0, 1, 1, 0};
        double[] xpoints = {428, 420, 400, 400, 400, 400, 420, 733};
        double[] ypoints = {180, 180, 180, 160, 30, 10, 10, 10};
        shape.moveTo(xpoints[0], ypoints[0]);
        for (int i = 1; i < pointTypes.length; i++) {
            if (pointTypes[i] == 1 && i < pointTypes.length - 1) {
                shape.quadTo(xpoints[i], ypoints[i],
                             xpoints[i + 1], ypoints[i + 1]);
            } else {
                shape.lineTo(xpoints[i], ypoints[i]);
            }
        }

        BufferedImage image = new
            BufferedImage(1000, 1000, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = image.createGraphics();

        Color color = new Color(124, 0, 124, 255);
        g2.setColor(color);
        Stroke stroke = new BasicStroke(1.0f,
                                        BasicStroke.CAP_BUTT,
                                        BasicStroke.JOIN_BEVEL,
                                        10.0f, new float[] {9, 6}, 0.0f);
        g2.setStroke(stroke);
        g2.draw(shape);
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:DashStrokeTest.java

示例5: PaintGradiente

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
protected void PaintGradiente(Graphics2D g, boolean round) {
    int dist = 0;
    int w = getWidth() - dist;
    int h = getHeight() - dist;
    int L = getLeft();
    int T = getTop();
    boolean dv = getGDirecao() == VERTICAL;

    //Composite originalComposite = g.getComposite();
    //g.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_OVER, alfa));
    GradientPaint GP = new GradientPaint(L, T, getGradienteStartColor(), dv ? L : L + w, dv ? T + h : T, getGradienteEndColor(), true);
    //g.setPaint(GP);

    g.setPaint(getForeColor());
    if (round) {
        g.drawRoundRect(L, T, w - 1, h - 1, roundRectSize, roundRectSize);
        g.setPaint(GP);
        g.fillRoundRect(L + 1, T + 1, w - 2, h - 2, roundRectSize, roundRectSize);
        g.setPaint(isDisablePainted()? disabledColor : Color.WHITE);
        g.drawRoundRect(L + 1, T + 1, w - 3, h - 3, roundRectSize, roundRectSize);
    } else {
        g.drawRect(L, T, w - 1, h - 1);
        g.setPaint(GP);
        g.fillRect(L + 1, T + 1, w - 2, h - 2);
        g.setPaint(isDisablePainted()? disabledColor : Color.WHITE);
        g.drawRect(L + 1, T + 1, w - 3, h - 3);
    }
    if (isGradientePinteDetalhe()) {
        g.setPaint(getGradienteCorDetalhe());
        GeneralPath path = new GeneralPath();
        path.moveTo(L + 2, T + 2);
        path.quadTo(L + w / 2 + 1, T + h / 2 + 1, L + w - 1, T + 2);
        path.closePath();
        g.fill(path);
    }
    //g.setComposite(originalComposite);

}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:39,代码来源:PreTexto.java

示例6: paintPolyline

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
/**
 * 
 */
public void paintPolyline(mxPoint[] points, boolean rounded)
{
	if (points != null && points.length > 1)
	{
		mxPoint pt = points[0];
		mxPoint pe = points[points.length - 1];

		double arcSize = mxConstants.LINE_ARCSIZE * scale;

		GeneralPath path = new GeneralPath();
		path.moveTo((float) pt.getX(), (float) pt.getY());

		// Draws the line segments
		for (int i = 1; i < points.length - 1; i++)
		{
			mxPoint tmp = points[i];
			double dx = pt.getX() - tmp.getX();
			double dy = pt.getY() - tmp.getY();

			if ((rounded && i < points.length - 1) && (dx != 0 || dy != 0))
			{
				// Draws a line from the last point to the current
				// point with a spacing of size off the current point
				// into direction of the last point
				double dist = Math.sqrt(dx * dx + dy * dy);
				double nx1 = dx * Math.min(arcSize, dist / 2) / dist;
				double ny1 = dy * Math.min(arcSize, dist / 2) / dist;

				double x1 = tmp.getX() + nx1;
				double y1 = tmp.getY() + ny1;
				path.lineTo((float) x1, (float) y1);

				// Draws a curve from the last point to the current
				// point with a spacing of size off the current point
				// into direction of the next point
				mxPoint next = points[i + 1];

				// Uses next non-overlapping point
				while (i < points.length - 2 && Math.round(next.getX() - tmp.getX()) == 0 && Math.round(next.getY() - tmp.getY()) == 0)
				{
					next = points[i + 2];
					i++;
				}
				
				dx = next.getX() - tmp.getX();
				dy = next.getY() - tmp.getY();

				dist = Math.max(1, Math.sqrt(dx * dx + dy * dy));
				double nx2 = dx * Math.min(arcSize, dist / 2) / dist;
				double ny2 = dy * Math.min(arcSize, dist / 2) / dist;

				double x2 = tmp.getX() + nx2;
				double y2 = tmp.getY() + ny2;

				path.quadTo((float) tmp.getX(), (float) tmp.getY(),
						(float) x2, (float) y2);
				tmp = new mxPoint(x2, y2);
			}
			else
			{
				path.lineTo((float) tmp.getX(), (float) tmp.getY());
			}

			pt = tmp;
		}

		path.lineTo((float) pe.getX(), (float) pe.getY());
		g.draw(path);
	}
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:74,代码来源:mxGraphics2DCanvas.java

示例7: paintPolyline

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
/**
 * 
 */
public void paintPolyline(mxPoint[] points, boolean rounded) {
  if (points != null && points.length > 1) {
    mxPoint pt = points[0];
    mxPoint pe = points[points.length - 1];

    double arcSize = mxConstants.LINE_ARCSIZE * scale;

    GeneralPath path = new GeneralPath();
    path.moveTo((float) pt.getX(), (float) pt.getY());

    // Draws the line segments
    for (int i = 1; i < points.length - 1; i++) {
      mxPoint tmp = points[i];
      double dx = pt.getX() - tmp.getX();
      double dy = pt.getY() - tmp.getY();

      if ((rounded && i < points.length - 1) && (dx != 0 || dy != 0)) {
        // Draws a line from the last point to the current
        // point with a spacing of size off the current point
        // into direction of the last point
        double dist = Math.sqrt(dx * dx + dy * dy);
        double nx1 = dx * Math.min(arcSize, dist / 2) / dist;
        double ny1 = dy * Math.min(arcSize, dist / 2) / dist;

        double x1 = tmp.getX() + nx1;
        double y1 = tmp.getY() + ny1;
        path.lineTo((float) x1, (float) y1);

        // Draws a curve from the last point to the current
        // point with a spacing of size off the current point
        // into direction of the next point
        mxPoint next = points[i + 1];

        // Uses next non-overlapping point
        while (i < points.length - 2 && Math.round(next.getX() - tmp.getX()) == 0
            && Math.round(next.getY() - tmp.getY()) == 0) {
          next = points[i + 2];
          i++;
        }

        dx = next.getX() - tmp.getX();
        dy = next.getY() - tmp.getY();

        dist = Math.max(1, Math.sqrt(dx * dx + dy * dy));
        double nx2 = dx * Math.min(arcSize, dist / 2) / dist;
        double ny2 = dy * Math.min(arcSize, dist / 2) / dist;

        double x2 = tmp.getX() + nx2;
        double y2 = tmp.getY() + ny2;

        path.quadTo((float) tmp.getX(), (float) tmp.getY(), (float) x2, (float) y2);
        tmp = new mxPoint(x2, y2);
      } else {
        path.lineTo((float) tmp.getX(), (float) tmp.getY());
      }

      pt = tmp;
    }

    path.lineTo((float) pe.getX(), (float) pe.getY());
    g.draw(path);
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:67,代码来源:mxGraphics2DCanvas.java


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