List of usage examples for java.awt.geom Arc2D getCenterX
public double getCenterX()
From source file:ExtendedGeneralPath.java
/** * Adds an elliptical arc, defined by two radii, an angle from the * x-axis, a flag to choose the large arc or not, a flag to * indicate if we increase or decrease the angles and the final * point of the arc./*from www. j ava 2 s .c o m*/ * * @param rx the x radius of the ellipse * @param ry the y radius of the ellipse * * @param angle the angle from the x-axis of the current * coordinate system to the x-axis of the ellipse in degrees. * * @param largeArcFlag the large arc flag. If true the arc * spanning less than or equal to 180 degrees is chosen, otherwise * the arc spanning greater than 180 degrees is chosen * * @param sweepFlag the sweep flag. If true the line joining * center to arc sweeps through decreasing angles otherwise it * sweeps through increasing angles * * @param x the absolute x coordinate of the final point of the arc. * @param y the absolute y coordinate of the final point of the arc. */ public synchronized void arcTo(float rx, float ry, float angle, boolean largeArcFlag, boolean sweepFlag, float x, float y) { // Ensure radii are valid if (rx == 0 || ry == 0) { lineTo(x, y); return; } checkMoveTo(); // check if prev command was moveto // Get the current (x, y) coordinates of the path double x0 = cx; double y0 = cy; if (x0 == x && y0 == y) { // If the endpoints (x, y) and (x0, y0) are identical, then this // is equivalent to omitting the elliptical arc segment entirely. return; } Arc2D arc = computeArc(x0, y0, rx, ry, angle, largeArcFlag, sweepFlag, x, y); if (arc == null) return; AffineTransform t = AffineTransform.getRotateInstance(Math.toRadians(angle), arc.getCenterX(), arc.getCenterY()); Shape s = t.createTransformedShape(arc); path.append(s, true); makeRoom(7); types[numSeg++] = ExtendedPathIterator.SEG_ARCTO; values[numVals++] = rx; values[numVals++] = ry; values[numVals++] = angle; values[numVals++] = largeArcFlag ? 1 : 0; values[numVals++] = sweepFlag ? 1 : 0; cx = values[numVals++] = x; cy = values[numVals++] = y; }