类java.awt.geom.QuadCurve2D源码实例Demo

下面列出了怎么用java.awt.geom.QuadCurve2D的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dragonwell8_jdk   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码2 项目: TencentKona-8   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码3 项目: jdk8u60   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码4 项目: HtmlUnit-Android   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码5 项目: openjdk-jdk8u   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码6 项目: openjdk-jdk8u-backup   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码7 项目: Bytecoder   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double[] ret) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码8 项目: openjdk-jdk9   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码9 项目: jdk8u-jdk   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码10 项目: hottub   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码11 项目: openjdk-8-source   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码12 项目: openjdk-8   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码13 项目: pumpernickel   文件: Order3X.java
public static int getHorizontalParams(double c0, double cp0, double cp1,
		double c1, double ret[]) {
	if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
		return 0;
	}
	c1 -= cp1;
	cp1 -= cp0;
	cp0 -= c0;
	ret[0] = cp0;
	ret[1] = (cp1 - cp0) * 2;
	ret[2] = (c1 - cp1 - cp1 + cp0);
	int numroots = QuadCurve2D.solveQuadratic(ret, ret);
	int j = 0;
	for (int i = 0; i < numroots; i++) {
		double t = ret[i];
		// No splits at t==0 and t==1
		if (t > 0 && t < 1) {
			if (j < i) {
				ret[j] = t;
			}
			j++;
		}
	}
	return j;
}
 
源代码14 项目: rapidminer-studio   文件: TabbedPaneUI.java
/**
 * 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;
}
 
源代码15 项目: rapidminer-studio   文件: TabbedPaneUI.java
/**
 * 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;
}
 
源代码16 项目: jdk8u-jdk   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码17 项目: jdk8u-dev-jdk   文件: Order3.java
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
源代码18 项目: ontopia   文件: TMAbstractEdge.java
protected QuadCurve2D getCurvedLine(int index) {
  double x1 = from.drawx;
  double x2 = to.drawx;
  double y1 = from.drawy;
  double y2 = to.drawy;
  double midx = calculateMidPointBetween(x1, x2);
  double midy = calculateMidPointBetween(y1, y2);
  
  int weight = index / 2;
  if (index % 2 == 1) {
    weight++;
    weight = -weight;
  }
  Dimension offset = calculateOffset(x1, x2, y1, y2, LOADING * weight);
  QuadCurve2D curve = new QuadCurve2D.Double(x1, y1,
      midx-offset.width, midy+offset.height,
      x2, y2);
  return curve;
}
 
源代码19 项目: dragonwell8_jdk   文件: Order3.java
public double nextVertical(double t0, double t1) {
    double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
    int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
    for (int i = 0; i < numroots; i++) {
        if (eqn[i] > t0 && eqn[i] < t1) {
            t1 = eqn[i];
        }
    }
    return t1;
}
 
源代码20 项目: dragonwell8_jdk   文件: Order3.java
public void enlarge(Rectangle2D r) {
    r.add(x0, y0);
    double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
    int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
    for (int i = 0; i < numroots; i++) {
        double t = eqn[i];
        if (t > 0 && t < 1) {
            r.add(XforT(t), YforT(t));
        }
    }
    r.add(x1, y1);
}
 
源代码21 项目: TencentKona-8   文件: Order3.java
public double nextVertical(double t0, double t1) {
    double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
    int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
    for (int i = 0; i < numroots; i++) {
        if (eqn[i] > t0 && eqn[i] < t1) {
            t1 = eqn[i];
        }
    }
    return t1;
}
 
源代码22 项目: TencentKona-8   文件: Order3.java
public void enlarge(Rectangle2D r) {
    r.add(x0, y0);
    double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
    int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
    for (int i = 0; i < numroots; i++) {
        double t = eqn[i];
        if (t > 0 && t < 1) {
            r.add(XforT(t), YforT(t));
        }
    }
    r.add(x1, y1);
}
 
源代码23 项目: jdk8u60   文件: Order3.java
public double nextVertical(double t0, double t1) {
    double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
    int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
    for (int i = 0; i < numroots; i++) {
        if (eqn[i] > t0 && eqn[i] < t1) {
            t1 = eqn[i];
        }
    }
    return t1;
}
 
源代码24 项目: jdk8u60   文件: Order3.java
public void enlarge(Rectangle2D r) {
    r.add(x0, y0);
    double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
    int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
    for (int i = 0; i < numroots; i++) {
        double t = eqn[i];
        if (t > 0 && t < 1) {
            r.add(XforT(t), YforT(t));
        }
    }
    r.add(x1, y1);
}
 
源代码25 项目: HtmlUnit-Android   文件: Order3.java
public double nextVertical(double t0, double t1) {
    double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
    int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
    for (int i = 0; i < numroots; i++) {
        if (eqn[i] > t0 && eqn[i] < t1) {
            t1 = eqn[i];
        }
    }
    return t1;
}
 
源代码26 项目: HtmlUnit-Android   文件: Order3.java
public void enlarge(Rectangle2D r) {
    r.add(x0, y0);
    double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
    int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
    for (int i = 0; i < numroots; i++) {
        double t = eqn[i];
        if (t > 0 && t < 1) {
            r.add(XforT(t), YforT(t));
        }
    }
    r.add(x1, y1);
}
 
源代码27 项目: sis   文件: ShapeUtilitiesTest.java
/**
 * Tests {@link ShapeUtilities#toPrimitive(Shape)}.
 */
@Test
public void testToPrimitive() {
    final Path2D path = new Path2D.Double();
    path.moveTo(4, 5);
    path.lineTo(7, 9);
    Shape p = ShapeUtilities.toPrimitive(path);
    assertInstanceOf("toPrimitive", Line2D.class, p);
    assertEquals("P1", new Point2D.Double(4, 5), ((Line2D) p).getP1());
    assertEquals("P2", new Point2D.Double(7, 9), ((Line2D) p).getP2());

    path.reset();
    path.moveTo(4, 5);
    path.quadTo(6, 7, 8, 5);
    p = ShapeUtilities.toPrimitive(path);
    assertInstanceOf("toPrimitive", QuadCurve2D.class, p);
    assertEquals("P1",     new Point2D.Double(4, 5), ((QuadCurve2D) p).getP1());
    assertEquals("CtrlPt", new Point2D.Double(6, 7), ((QuadCurve2D) p).getCtrlPt());
    assertEquals("P2",     new Point2D.Double(8, 5), ((QuadCurve2D) p).getP2());

    path.reset();
    path.moveTo(4, 5);
    path.curveTo(6, 7, 8, 6, 9, 4);
    p = ShapeUtilities.toPrimitive(path);
    assertInstanceOf("toPrimitive", CubicCurve2D.class, p);
    assertEquals("P1",     new Point2D.Double(4, 5), ((CubicCurve2D) p).getP1());
    assertEquals("CtrlP1", new Point2D.Double(6, 7), ((CubicCurve2D) p).getCtrlP1());
    assertEquals("CtrlP2", new Point2D.Double(8, 6), ((CubicCurve2D) p).getCtrlP2());
    assertEquals("P2",     new Point2D.Double(9, 4), ((CubicCurve2D) p).getP2());
}
 
源代码28 项目: openjdk-jdk8u   文件: Order3.java
public void enlarge(Rectangle2D r) {
    r.add(x0, y0);
    double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
    int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
    for (int i = 0; i < numroots; i++) {
        double t = eqn[i];
        if (t > 0 && t < 1) {
            r.add(XforT(t), YforT(t));
        }
    }
    r.add(x1, y1);
}
 
源代码29 项目: openjdk-jdk8u-backup   文件: Order3.java
public double nextVertical(double t0, double t1) {
    double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
    int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
    for (int i = 0; i < numroots; i++) {
        if (eqn[i] > t0 && eqn[i] < t1) {
            t1 = eqn[i];
        }
    }
    return t1;
}
 
源代码30 项目: openjdk-jdk8u-backup   文件: Order3.java
public void enlarge(Rectangle2D r) {
    r.add(x0, y0);
    double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
    int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
    for (int i = 0; i < numroots; i++) {
        double t = eqn[i];
        if (t > 0 && t < 1) {
            r.add(XforT(t), YforT(t));
        }
    }
    r.add(x1, y1);
}
 
 类所在包
 同包方法