當前位置: 首頁>>代碼示例>>Java>>正文


Java QuadCurve2D.Float方法代碼示例

本文整理匯總了Java中java.awt.geom.QuadCurve2D.Float方法的典型用法代碼示例。如果您正苦於以下問題:Java QuadCurve2D.Float方法的具體用法?Java QuadCurve2D.Float怎麽用?Java QuadCurve2D.Float使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.geom.QuadCurve2D的用法示例。


在下文中一共展示了QuadCurve2D.Float方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getNormalEdgeShape

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
private Shape getNormalEdgeShape()
{
	Line line = getConnectionPoints();
	QuadCurve2D curve = new QuadCurve2D.Float();
	curve.setCurve(Conversions.toPoint2D(line.getPoint1()), getControlPoint(), 
			Conversions.toPoint2D(line.getPoint2()));
	return curve;
}
 
開發者ID:prmr,項目名稱:JetUML,代碼行數:9,代碼來源:StateTransitionEdgeView.java

示例2: divideAndDraw

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
/**
 * Divide the given curve in two half, and call drawCurve on each part.
 */
public boolean divideAndDraw(GL2 gl, Point2D center1, Point2D center2,
    QuadCurve2D curve, GLEntity shape1, GLEntity shape2, QuadCurve2D last) {
  QuadCurve2D left = new QuadCurve2D.Float();
  QuadCurve2D right = new QuadCurve2D.Float();
  curve.subdivide(left, right);
  boolean resL = drawCurve(gl, center1, center2, left, shape1, shape2, last);
  boolean resR = drawCurve(gl, center1, center2, right, shape1, shape2, last);
  return resL || resR;
}
 
開發者ID:google,項目名稱:depan,代碼行數:13,代碼來源:Arrow.java

示例3: quadCurvesCanBeCloned

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
@Test
public void quadCurvesCanBeCloned() throws InstantiationException, IllegalAccessException {
	for (Class shapeClass : new Class[] {
		QuadCurve2D.Float.class, QuadCurve2D.Double.class
	}) {
		assertShapeClassIsCloneable(shapeClass);
	}
}
 
開發者ID:eseifert,項目名稱:vectorgraphics2d,代碼行數:9,代碼來源:GraphicsUtilsTest.java

示例4: transform

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
@Override
public Shape transform(Context<Graph<V, E>, E> context) {
	Pair<V> endpoints = context.graph.getEndpoints(context.element);
	int index = edgeIndexFunction != null ? edgeIndexFunction.getIndex(context.graph, context.element) : 1;

	if (endpoints != null && endpoints.getFirst().equals(endpoints.getSecond())) {
		float diam = 1.0f + index * fontSize / 40.0f;

		return new Ellipse2D.Float(-diam / 2.0f, -diam / 2.0f, diam, diam);
	} else {
		float controlY = 10.0f + 1.7f * fontSize * index;

		return new QuadCurve2D.Float(0.0f, 0.0f, 0.5f, controlY, 1.0f, 0.0f);
	}
}
 
開發者ID:SiLeBAT,項目名稱:BfROpenLab,代碼行數:16,代碼來源:BetterEdgeShapeTransformer.java

示例5: addLengthLines

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
private void addLengthLines(int startSpace, int endSpace, boolean horseOffset) {
	// If there is no jump to show, don't bother computing a jump.
	if (startSpace == endSpace) {
		return;
	}

	// Get end points of the curve
	int [] p1coords = getHorsePoint(startSpace, horseOffset);
	int [] p2coords = getHorsePoint(endSpace, horseOffset);
	Point p1 = new Point (p1coords[0], p1coords[1]);
	Point p2 = new Point (p2coords[0], p2coords[1]);

	// Compute control point location for the curve
	int dx = (p2coords[0] - p1coords[0]) / 2;
	int dy = (p2coords[1] - p1coords[1]) / 2;
	Point cp = new Point (p1coords[0] + dx, p1coords[1] + dy);
	double ratio = (HORSE_VERT_OFFSET / Math.sqrt((dx * dx) + (dy * dy)));
	if (dx > 0) {
		cp.translate((int) (dy * ratio), (int) (-dx * ratio));
	} else {
		cp.translate((int) (-dy * ratio), (int) (dx * ratio));
	}

	// Create the curve
	QuadCurve2D q = new QuadCurve2D.Float();
	q.setCurve(p1, cp, p2);

	// Add it to the lines
	lines.add(new JumpingTrackOrnament(q));

	// Add a dot at the end.
	lines.add(new JumpingTrackOrnament(p2coords));
}
 
開發者ID:lgsilvestre,項目名稱:Jogre,代碼行數:34,代碼來源:JumpingTrackComponent.java

示例6: drawLeftLabel

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
/**
 * Draws a section label on the left side of the pie chart.
 *
 * @param g2  the graphics device.
 * @param state  the state.
 * @param record  the label record.
 */
protected void drawLeftLabel(Graphics2D g2, PiePlotState state,
                             PieLabelRecord record) {

    double anchorX = state.getLinkArea().getMinX();
    double targetX = anchorX - record.getGap();
    double targetY = record.getAllocatedY();

    if (this.labelLinksVisible) {
        double theta = record.getAngle();
        double linkX = state.getPieCenterX() + Math.cos(theta)
                * state.getPieWRadius() * record.getLinkPercent();
        double linkY = state.getPieCenterY() - Math.sin(theta)
                * state.getPieHRadius() * record.getLinkPercent();
        double elbowX = state.getPieCenterX() + Math.cos(theta)
                * state.getLinkArea().getWidth() / 2.0;
        double elbowY = state.getPieCenterY() - Math.sin(theta)
                * state.getLinkArea().getHeight() / 2.0;
        double anchorY = elbowY;
        g2.setPaint(this.labelLinkPaint);
        g2.setStroke(this.labelLinkStroke);
        PieLabelLinkStyle style = getLabelLinkStyle();
        if (style.equals(PieLabelLinkStyle.STANDARD)) {
            g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));
            g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));
            g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));
        }
        else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) {
            QuadCurve2D q = new QuadCurve2D.Float();
            q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY);
            g2.draw(q);
            g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY));
        }
        else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) {
            CubicCurve2D c = new CubicCurve2D .Float();
            c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY,
                    linkX, linkY);
            g2.draw(c);
        }
    }
    TextBox tb = record.getLabel();
    tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.RIGHT);

}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:51,代碼來源:PiePlot.java

示例7: drawRightLabel

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
/**
 * Draws a section label on the right side of the pie chart.
 *
 * @param g2  the graphics device.
 * @param state  the state.
 * @param record  the label record.
 */
protected void drawRightLabel(Graphics2D g2, PiePlotState state,
                              PieLabelRecord record) {

    double anchorX = state.getLinkArea().getMaxX();
    double targetX = anchorX + record.getGap();
    double targetY = record.getAllocatedY();

    if (this.labelLinksVisible) {
        double theta = record.getAngle();
        double linkX = state.getPieCenterX() + Math.cos(theta)
                * state.getPieWRadius() * record.getLinkPercent();
        double linkY = state.getPieCenterY() - Math.sin(theta)
                * state.getPieHRadius() * record.getLinkPercent();
        double elbowX = state.getPieCenterX() + Math.cos(theta)
                * state.getLinkArea().getWidth() / 2.0;
        double elbowY = state.getPieCenterY() - Math.sin(theta)
                * state.getLinkArea().getHeight() / 2.0;
        double anchorY = elbowY;
        g2.setPaint(this.labelLinkPaint);
        g2.setStroke(this.labelLinkStroke);
        PieLabelLinkStyle style = getLabelLinkStyle();
        if (style.equals(PieLabelLinkStyle.STANDARD)) {
            g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));
            g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));
            g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));
        }
        else if (style.equals(PieLabelLinkStyle.QUAD_CURVE)) {
            QuadCurve2D q = new QuadCurve2D.Float();
            q.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY);
            g2.draw(q);
            g2.draw(new Line2D.Double(elbowX, elbowY, linkX, linkY));
        }
        else if (style.equals(PieLabelLinkStyle.CUBIC_CURVE)) {
            CubicCurve2D c = new CubicCurve2D .Float();
            c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY,
                    linkX, linkY);
            g2.draw(c);
        }
    }

    TextBox tb = record.getLabel();
    tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.LEFT);

}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:52,代碼來源:PiePlot.java

示例8: addContourToPath

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
private static void addContourToPath(GeneralPath gp, Glyph glyph, int startIndex, int count) {
    int offset = 0;
    boolean connect = false;
    while (offset < count) {
        Shape s = null;
        Point point_minus1 = glyph.getPoint((offset==0) ? startIndex+count-1 : startIndex+(offset-1)%count);
        Point point = glyph.getPoint(startIndex + offset%count);
        Point point_plus1 = glyph.getPoint(startIndex + (offset+1)%count);
        Point point_plus2 = glyph.getPoint(startIndex + (offset+2)%count);
        if (point.onCurve && point_plus1.onCurve) {
            s = new Line2D.Float(point.x, point.y, point_plus1.x, point_plus1.y);
            offset++;
        } else if (point.onCurve && !point_plus1.onCurve && point_plus2.onCurve) {
            s = new QuadCurve2D.Float(
                point.x,
                point.y,
                point_plus1.x,
                point_plus1.y,
                point_plus2.x,
                point_plus2.y);
            offset+=2;
        } else if (point.onCurve && !point_plus1.onCurve && !point_plus2.onCurve) {
            s = new QuadCurve2D.Float(
                point.x,
                point.y,
                point_plus1.x,
                point_plus1.y,
                midValue(point_plus1.x, point_plus2.x),
                midValue(point_plus1.y, point_plus2.y));
            offset+=2;
        } else if (!point.onCurve && !point_plus1.onCurve) {
            s = new QuadCurve2D.Float(
                midValue(point_minus1.x, point.x),
                midValue(point_minus1.y, point.y),
                point.x,
                point.y,
                midValue(point.x, point_plus1.x),
                midValue(point.y, point_plus1.y));
            offset++;
        } else if (!point.onCurve && point_plus1.onCurve) {
            s = new QuadCurve2D.Float(
                midValue(point_minus1.x, point.x),
                midValue(point_minus1.y, point.y),
                point.x,
                point.y,
                point_plus1.x,
                point_plus1.y);
            offset++;
        } else {
            System.out.println("addContourToPath case not catered for!!");
            break;
        }
        gp.append(s, connect);
        connect = true;
    }
}
 
開發者ID:dcsch,項目名稱:typecast,代碼行數:57,代碼來源:GlyphPathFactory.java

示例9: linkShapes

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
/**
 * Links the two given shapes (and their centers) with this arrow. Shapes are
 * used to determine if points are inside the shapes, or outside. This is
 * useful to draw an arrow that starts and end at the edge of the shape, and
 * not in the middle of the shape.
 *
 * @param gl GL object where to draw this shape.
 * @param center1 origin point of the arrow
 * @param center2 target point for this arrow
 * @param shape1 shape at the starting point
 * @param shape2
 * @param deviation
 * @return
 */
public Point2D linkShapes(GL2 gl, Point2D center1, Point2D center2,
    GLEntity shape1, GLEntity shape2, float deviation) {
  Vec2 c1 = new Vec2(center1);
  Vec2 c2 = new Vec2(center2);

  Vec2 dir = c2.minus(c1);
  Vec2 norm = new Vec2(dir.y, -dir.x).mult(deviation);
  Vec2 middle = c1.plus(c2).div(2.0f).plus(norm);

  QuadCurve2D curve = new QuadCurve2D.Float(c1.x, c1.y, middle.x, middle.y,
      c2.x, c2.y);
  QuadCurve2D last = new QuadCurve2D.Float();

  // enable GL_LINE_STIPPLE if edge must be dashed
  if (dashed) {
    gl.glEnable(GL2.GL_LINE_STIPPLE);
    gl.glLineStipple(1, (short) 0xf0f0);
  }
  boolean ok = drawCurve(gl, center1, center2, curve, shape1, shape2, last);

  // now disable GL_LINE_STIPPLE if it was enabled
  if (dashed) {
    gl.glDisable(GL2.GL_LINE_STIPPLE);
  }

  if (ok) {
    // draw the head at the last position, trying to orient it so that it
    // follows the last segment of the "line".
    double x1 = last.getP1().getX();
    double y1 = last.getP1().getY();
    double x2 = last.getP2().getX();
    double y2 = last.getP2().getY();

    double slope = (y2 - y1) / (x2 - x1);
    double angle = (float) Math.tanh(slope) - Math.PI / 2.0;
    if (x2 < x1) {
      angle += Math.PI;
    }

    head.setTranslation((float) (last.getP2().getX()), (float) (last.getP2()
        .getY()), 0f);
    head.setScale(8f, 8f, 8f);
    head.setRotation(angle);
    head.fill(gl);
  }

  QuadCurve2D left = new QuadCurve2D.Float();
  QuadCurve2D right = new QuadCurve2D.Float();
  curve.subdivide(left, right);

  return right.getP1(); // new Point2D.Float(middle.x, middle.y);
}
 
開發者ID:google,項目名稱:depan,代碼行數:67,代碼來源:Arrow.java

示例10: setLine

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
/**
 * Sets the curve using control points given in double precision
 * 
 * @param points
 *            the control points for the curve
 */
public void setLine(double... points) {
    path = new GeneralPath();
    path.moveTo((float) points[0], (float) points[1]);
    segments = new Shape[points.length / 2 - 1];

    for (int i = 2; i < points.length;) {
        switch (points.length - i) {
        case 2:
            lastPart = new Line2D.Float((float) path.getCurrentPoint().getX(), (float) path
                    .getCurrentPoint().getY(), (float) points[i], (float) points[i + 1]);
            path.append(lastPart, true);
            segments[i / 2 - 1] = lastPart;
            i += 2;
            break;
        case 4:
            lastPart = new QuadCurve2D.Float((float) path.getCurrentPoint().getX(),
                    (float) path.getCurrentPoint().getY(), (float) points[i],
                    (float) points[i + 1], (float) points[i + 2], (float) points[i + 3]);
            path.append(lastPart, true);
            segments[i / 2 - 1] = lastPart;
            segments[i / 2] = lastPart;
            i += 4;
            break;
        case 6:
            lastPart = new CubicCurve2D.Double(path.getCurrentPoint().getX(), path
                    .getCurrentPoint().getY(), points[i], points[i + 1], points[i + 2],
                    points[i + 3], points[i + 4], points[i + 5]);
            path.append(lastPart, true);
            segments[i / 2 - 1] = lastPart;
            segments[i / 2] = lastPart;
            segments[i / 2 + 1] = lastPart;
            i += 6;
            break;
        default: // use two points and add one extra between 2nd and 3rd
            float x = (float) (points[i + 2] + points[i + 4]) / 2F;
            float y = (float) (points[i + 3] + points[i + 5]) / 2F;

            lastPart = new CubicCurve2D.Double(path.getCurrentPoint().getX(), path
                    .getCurrentPoint().getY(), points[i], points[i + 1], points[i + 2],
                    points[i + 3], x, y);

            path.append(lastPart, true);
            segments[i / 2 - 1] = lastPart;
            segments[i / 2] = lastPart;

            i += 4;
        }
    }
}
 
開發者ID:davidmoten,項目名稱:grumpy,代碼行數:56,代碼來源:NearBSpline.java

示例11: paintItem

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
public void paintItem(Graphics2D g, int x1, int y1, int x2, int y2) {
	if (!canPaint()) {
		return;
	}
	if(!model.isReady()) { return; }

	int width = x2 - x1;
	int height = Math.max(y2 - y1,1);
	int halfy = y2 - (height/2);
	int regionStart = model.getRegion().getStart();
	int regionEnd = model.getRegion().getEnd();
	int regionWidth = model.getRegion().getWidth();
	int linewidth = Math.max(getProperties().LineWidth,1);
	Stroke oldStroke = g.getStroke();
	g.setStroke(new BasicStroke((float)linewidth));

	Map<Point,Float> events = model.getEvents();
	Map<Pair<Point,Point>,Float> interactions = model.getInteractions();

	if (getProperties().DrawTrackLabel) {
		g.setFont(attrib.getLargeLabelFont(width,height));
		g.setColor(Color.BLACK);
		g.drawString("Analysis " +getLabel(),x1 + g.getFont().getSize()*2,y1 + g.getFont().getSize());
	}

	int h = height;
	float maxweight = 0;
	g.setStroke(new BasicStroke(1.0f));
	for (Pair<Point,Point> pair : interactions.keySet()) {
		if (!pair.car().equals(pair.cdr())) {
			float count = interactions.get(pair);
			float curvewidth = Math.min(30, count);
			g.setStroke(new BasicStroke(curvewidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
			int leftx = getXPos(pair.car().getLocation(), regionStart, regionEnd, x1, x2);
			int rightx = getXPos(pair.cdr().getLocation(), regionStart, regionEnd, x1, x2);
			int midx = (leftx+rightx)/2;
			int midy = y2 - (int)(((double)(rightx-leftx)/(double)width) * 2*height);
			g.setColor(new Color(0, 0, 255, 127));
			QuadCurve2D loop = new QuadCurve2D.Float(leftx, y2, midx, midy, rightx, y2);
			g.draw(loop);
			g.setColor(Color.black);
			g.drawString(count+"", midx, y2 - (int)(((double)(rightx-leftx)/(double)width) * height));
		}
	}
	g.setStroke(oldStroke);
}
 
開發者ID:shaunmahony,項目名稱:multigps-archive,代碼行數:47,代碼來源:InteractionAnalysisPainter.java

示例12: drawLink

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
/**
	 * Draw a link between 2 notes
	 *
	 * @see #getLinkPoints(TwoNotesLink) calculates the best link curve
	 */
	protected void drawLink(Graphics2D g2, TwoNotesLink slurDef) {
		Point2D[] points = null;
		try {
			points = getLinkPoints(slurDef);
		} catch (Exception e) {
			System.err.println("Exception in drawLink : "+e.getMessage());
			e.printStackTrace();
		}
		if ((points == null) || (points.length != 3))
			return;

		//TODO move this in JSlurOrTie.render(g2);
		JSlurOrTie jSlurDef = getJSlurOrTie(slurDef);
		if (jSlurDef.isTuplet()) {
			//we consider tuplet are always above notes
			if (jSlurDef.getTupletControlPoint() == null) {
				jSlurDef.setTupletControlPoint(new Point2D.Double(
					points[START].getX()+(points[END].getX()-points[START].getX())/2,
					points[START].getY()-getMetrics().getSlurAnchorYOffset()*5
				));
			}
			points[CONTROL].setLocation(
				jSlurDef.getTupletControlPoint()
			);
		}
		
//		System.out.println("drawLink "+slurDef);
//		System.out.println("  - start = "+points[START]);
//		System.out.println("  - end = "+points[END]);

		Color previousColor = g2.getColor();
		boolean isAboveNotes = false;
		if (points[CONTROL].getY() < points[START].getY()
			&& (points[CONTROL].getY() < points[END].getY()))
			isAboveNotes = true;
		else if (points[CONTROL].getY() > points[START].getY()
				&& (points[CONTROL].getY() > points[END].getY()))
			isAboveNotes = false;
		else {//problem, mark it red
			g2.setColor(Color.RED);
		}

		GeneralPath path = new GeneralPath();
		path.moveTo((float)points[START].getX(), (float)points[START].getY());
		QuadCurve2D q = new QuadCurve2D.Float();
		q.setCurve(
				points[START],
				newControl(points[START], points[CONTROL], points[END]),
				points[END]);
		path.append(q, true);
		q = new QuadCurve2D.Float();
		double slurThickness = Math.max(1.0,
				getTemplate().getAttributeSize(
						ScoreAttribute.SLUR_THICKNESS));
		if (!isAboveNotes) {
			points[CONTROL].setLocation(points[CONTROL].getX(),
				points[CONTROL].getY()+slurThickness);
		} else {
			points[CONTROL].setLocation(points[CONTROL].getX(),
					points[CONTROL].getY()-slurThickness);
		}
		q.setCurve(
				points[END],
				newControl(points[START], points[CONTROL], points[END]),
				points[START]);
		path.append(q, true);
		g2.fill(path);
		g2.draw(path);

		g2.setColor(previousColor);
	}
 
開發者ID:Sciss,項目名稱:abc4j,代碼行數:77,代碼來源:JTune.java

示例13: setHighlightMove

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
/**
 * Set the highlighted move to the given one.
 *
 * @param move      The move to make the highlighted one.
 * @param playerId  The player whose move is being shown.  This is used
 *                  to set the color of the line.
 */
public void setHighlightMove(Vector move, int playerId) {
	highlightedMoveCurves = new Vector();
	highlightedMoveColor = playerColors[playerId];

	if (move != null) {
		// Make the Quad Curves for the move

		ListIterator iter = move.listIterator();
		Point p2 = (Point) iter.next();
		while (iter.hasNext()) {
			// Get the logical end points of the move
			Point p1 = p2;
			p2 = (Point) iter.next();

			// Convert them to screen points
			Point sp1 = getScreenCenterFor(p1);
			Point sp2 = getScreenCenterFor(p2);

			// Compute the control point location for this curve.
			int dx = (sp2.x - sp1.x) / 2;
			int dy = (sp2.y - sp1.y) / 2;
			Point cp = new Point (sp1.x + dx, sp1.y + dy);
			double halfLength = Math.sqrt((dx * dx) + (dy * dy));
			double ratio = (HEXAGON_SIZE / halfLength);

			if (dx > 0) {
				cp.translate((int) (dy * ratio), (int) (- dx * ratio));
			} else {
				cp.translate((int) (- dy * ratio), (int) (dx * ratio));
			}

			// Generate the Quad curve connecting those points
			QuadCurve2D q = new QuadCurve2D.Float();
			q.setCurve(sp1, cp, sp2);

			// Add the curve to the vectors of curves
			highlightedMoveCurves.add(q);
		}
	}
}
 
開發者ID:lgsilvestre,項目名稱:Jogre,代碼行數:48,代碼來源:ChineseCheckersBoardComponent.java

示例14: createQuadCurve

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
/**
 * Create and return a new path node with the specified quadratic curve in single
 * precision floating point coordinates.
 *
 * @param x1 x coordinate of the start point
 * @param y1 y coordinate of the start point
 * @param ctrlx x coordinate of the control point
 * @param ctrly y coordinate of the control point
 * @param x2 x coordinate of the end point
 * @param y2 y coordinate of the end point
 * @return a new path node with the specified quadratic curve in single
 *    precision floating point coordinates
 */
public static final PPath createQuadCurve(final float x1,
                                          final float y1,
                                          final float ctrlx,
                                          final float ctrly,
                                          final float x2,
                                          final float y2) {
    return new PPath.Float(new QuadCurve2D.Float(x1, y1, ctrlx, ctrly, x2, y2));
}
 
開發者ID:piccolo2d,項目名稱:piccolo2d.java,代碼行數:22,代碼來源:PPath.java

示例15: CurvedArrow

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
/**
 * Instantiates a <CODE>CurvedArrow</CODE> object.
 * 
 * @param x1
 *            the x coordinate of the start point
 * @param y1
 *            the y coordinate of the start point
 * @param x2
 *            the x coordinate of the end point
 * @param y2
 *            the y coordinate of the end point
 * @param curvy
 *            the curvi-ness factor; 0 will create a straight line; 1 and -1
 *            are rather curvy
 */
public CurvedArrow(int x1, int y1, int x2, int y2, float curvy, TransitionObject t) {
	curve = new QuadCurve2D.Float();
	start = new Point();
	end = new Point();
	control = new Point();
	setStart(x1, y1);
	setEnd(x2, y2);
	setCurvy(curvy);
       myTransition = t;
	refreshCurve();
}
 
開發者ID:franciscaconcha,項目名稱:ProyectoLogisim,代碼行數:27,代碼來源:CurvedArrow.java


注:本文中的java.awt.geom.QuadCurve2D.Float方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。