List of usage examples for java.awt.geom GeneralPath closePath
public final synchronized void closePath()
From source file:gov.nih.nci.rembrandt.web.plots.RBTPrincipalComponentAnalysisPlot.java
/** * This chart uses the XYAnnotation as a glyph to represent * a single pca data point. Glyph shape is determined by survival time. * Survival of more than 10 months is represented by a circle. 10 months or less * is represented by a square. Component1 values are represented by X * Component2 values are represented by Y *///from w ww.ja va 2 s . c o m protected void createGlyphsAndAddToPlot(XYPlot plot) { //for RBT, if its non_tumor, show a diamond meaning "N/A for survival" XYShapeAnnotation glyph; Shape glyphShape; Color glyphColor; PrincipalComponentAnalysisDataPoint pcaPoint; double x, y; for (Iterator i = dataPoints.iterator(); i.hasNext();) { pcaPoint = (PrincipalComponentAnalysisDataPoint) i.next(); x = pcaPoint.getComponentValue(component1); y = pcaPoint.getComponentValue(component2); double survival = pcaPoint.getSurvivalInMonths(); String diseaseName = pcaPoint.getDiseaseName(); if (this.colorBy.equals(PCAcolorByType.NONE)) { Ellipse2D.Double circle = new Ellipse2D.Double(); circle.setFrameFromCenter(x, y, x + 2, y + 2); glyphShape = circle; } else if (diseaseName.equals(RembrandtConstants.NON_TUMOR) || diseaseName.equals("CELL_LINE")) { //glyphShape = ShapeUtilities.createDiamond(new Float(x)); Rectangle2D.Double rect = new Rectangle2D.Double(); rect.setFrameFromCenter(x, y, x + 2, y + 2); glyphShape = rect; Shape gShape = ShapeUtilities.rotateShape(glyphShape, new Double(0.785398163), new Float(x), new Float(y)); glyphShape = gShape; } else if ((survival > 0) && (survival < 10.0)) { Rectangle2D.Double rect = new Rectangle2D.Double(); rect.setFrameFromCenter(x, y, x + 2, y + 2); glyphShape = rect; } else if ((survival > 0) && (survival >= 10.0)) { Ellipse2D.Double circle = new Ellipse2D.Double(); circle.setFrameFromCenter(x, y, x + 2, y + 2); glyphShape = circle; } else { GeneralPath gp = new GeneralPath(); float xf = (float) x; float yf = (float) y; //make a triangle gp.moveTo(xf, yf); gp.lineTo(xf + 3.0f, yf - 3.0f); gp.lineTo(xf - 3.0f, yf - 3.0f); gp.closePath(); glyphShape = gp; } glyphColor = getColorForDataPoint(pcaPoint); glyph = new XYShapeAnnotation(glyphShape, new BasicStroke(1.0f), Color.BLACK, glyphColor); String tooltip = ""; if (pcaPoint.getSurvivalInMonths() <= 0.0) { tooltip = pcaPoint.getSampleId() + " " + pcaPoint.getDiseaseName(); } else { tooltip = pcaPoint.getSampleId() + " " + pcaPoint.getDiseaseName() + " survivalMonths=" + nf.format(pcaPoint.getSurvivalInMonths()); } glyph.setToolTipText(tooltip); plot.addAnnotation(glyph); } }
From source file:net.sourceforge.processdash.ev.ui.chart.TooltipLineXYLineAndShapeRenderer.java
/** * Creates and returns a polygon that has the same shape as the line passed * as a parameter, but ticker so it can be used as a mouse-over tooltip area *///from ww w . ja va 2 s . c o m private Shape getTooltipArea(Line2D line, int series) { GeneralPath area = new GeneralPath(); float areaWidth = getAreaWidth(series); area.moveTo((float) line.getX1(), (float) (line.getY1() + areaWidth / 2)); area.lineTo((float) line.getX2(), (float) (line.getY2() + areaWidth / 2)); area.lineTo((float) line.getX2(), (float) (line.getY2() - areaWidth / 2)); area.lineTo((float) line.getX1(), (float) (line.getY1() - areaWidth / 2)); area.closePath(); return area; }
From source file:net.sf.fspdfs.chartthemes.spring.ScaledDialPointer.java
/** * Draws the pointer./*from w w w. ja v a 2 s. co m*/ * * @param g2 the graphics target. * @param plot the plot. * @param frame the dial's reference frame. * @param view the dial's view. */ public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view) { g2.setStroke(new BasicStroke(1.0f)); Rectangle2D lengthRect = DialPlot.rectangleByRadius(frame, this.getRadius(), this.getRadius()); Rectangle2D widthRect = DialPlot.rectangleByRadius(frame, this.getWidthRadius(), this.getWidthRadius()); double value = ChartThemesUtilities.getScaledValue(plot.getValue(this.getDatasetIndex()), scale); DialScale scale = plot.getScaleForDataset(this.getDatasetIndex()); double angle = scale.valueToAngle(value); Arc2D arc1 = new Arc2D.Double(lengthRect, angle, 0, Arc2D.OPEN); Point2D pt1 = arc1.getEndPoint(); Arc2D arc2 = new Arc2D.Double(widthRect, angle - 90.0, 180.0, Arc2D.OPEN); Point2D pt2 = arc2.getStartPoint(); Point2D pt3 = arc2.getEndPoint(); Arc2D arc3 = new Arc2D.Double(widthRect, angle - 180.0, 0.0, Arc2D.OPEN); Point2D pt4 = arc3.getStartPoint(); GeneralPath gp = new GeneralPath(); gp.moveTo((float) pt1.getX(), (float) pt1.getY()); gp.lineTo((float) pt2.getX(), (float) pt2.getY()); gp.lineTo((float) pt4.getX(), (float) pt4.getY()); gp.lineTo((float) pt3.getX(), (float) pt3.getY()); gp.closePath(); g2.setPaint(this.fillPaint); g2.fill(gp); g2.setPaint(this.getOutlinePaint()); Line2D line = new Line2D.Double(frame.getCenterX(), frame.getCenterY(), pt1.getX(), pt1.getY()); // g2.draw(line); line.setLine(pt2, pt3); g2.draw(line); line.setLine(pt3, pt1); g2.draw(line); line.setLine(pt2, pt1); g2.draw(line); line.setLine(pt2, pt4); g2.draw(line); line.setLine(pt3, pt4); g2.draw(line); }
From source file:net.sf.jasperreports.chartthemes.spring.ScaledDialPointer.java
/** * Draws the pointer.//ww w . java2s . co m * * @param g2 the graphics target. * @param plot the plot. * @param frame the dial's reference frame. * @param view the dial's view. */ @Override public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view) { g2.setStroke(new BasicStroke(1.0f)); Rectangle2D lengthRect = DialPlot.rectangleByRadius(frame, this.getRadius(), this.getRadius()); Rectangle2D widthRect = DialPlot.rectangleByRadius(frame, this.getWidthRadius(), this.getWidthRadius()); double value = ChartThemesUtilities.getScaledValue(plot.getValue(this.getDatasetIndex()), scale); DialScale scale = plot.getScaleForDataset(this.getDatasetIndex()); double angle = scale.valueToAngle(value); Arc2D arc1 = new Arc2D.Double(lengthRect, angle, 0, Arc2D.OPEN); Point2D pt1 = arc1.getEndPoint(); Arc2D arc2 = new Arc2D.Double(widthRect, angle - 90.0, 180.0, Arc2D.OPEN); Point2D pt2 = arc2.getStartPoint(); Point2D pt3 = arc2.getEndPoint(); Arc2D arc3 = new Arc2D.Double(widthRect, angle - 180.0, 0.0, Arc2D.OPEN); Point2D pt4 = arc3.getStartPoint(); GeneralPath gp = new GeneralPath(); gp.moveTo((float) pt1.getX(), (float) pt1.getY()); gp.lineTo((float) pt2.getX(), (float) pt2.getY()); gp.lineTo((float) pt4.getX(), (float) pt4.getY()); gp.lineTo((float) pt3.getX(), (float) pt3.getY()); gp.closePath(); g2.setPaint(this.fillPaint); g2.fill(gp); g2.setPaint(this.getOutlinePaint()); Line2D line = new Line2D.Double(frame.getCenterX(), frame.getCenterY(), pt1.getX(), pt1.getY()); // g2.draw(line); line.setLine(pt2, pt3); g2.draw(line); line.setLine(pt3, pt1); g2.draw(line); line.setLine(pt2, pt1); g2.draw(line); line.setLine(pt2, pt4); g2.draw(line); line.setLine(pt3, pt4); g2.draw(line); }
From source file:org.jfree.experimental.chart.renderer.xy.VectorRenderer.java
/** * Draws the block representing the specified item. * /*from w w w .jav a 2 s . co m*/ * @param g2 the graphics device. * @param state the state. * @param dataArea the data area. * @param info the plot rendering info. * @param plot the plot. * @param domainAxis the x-axis. * @param rangeAxis the y-axis. * @param dataset the dataset. * @param series the series index. * @param item the item index. * @param crosshairState the crosshair state. * @param pass the pass index. */ public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { double x = dataset.getXValue(series, item); double y = dataset.getYValue(series, item); double dx = 0.0; double dy = 0.0; if (dataset instanceof VectorXYDataset) { dx = ((VectorXYDataset) dataset).getDeltaXValue(series, item); dy = ((VectorXYDataset) dataset).getDeltaYValue(series, item); } double xx0 = domainAxis.valueToJava2D(x, dataArea, plot.getDomainAxisEdge()); double yy0 = rangeAxis.valueToJava2D(y, dataArea, plot.getRangeAxisEdge()); double xx1 = domainAxis.valueToJava2D(x + dx, dataArea, plot.getDomainAxisEdge()); double yy1 = rangeAxis.valueToJava2D(y + dy, dataArea, plot.getRangeAxisEdge()); Line2D line; PlotOrientation orientation = plot.getOrientation(); if (orientation.equals(PlotOrientation.HORIZONTAL)) { line = new Line2D.Double(yy0, xx0, yy1, xx1); } else { line = new Line2D.Double(xx0, yy0, xx1, yy1); } g2.setPaint(getItemPaint(series, item)); g2.setStroke(getItemStroke(series, item)); g2.draw(line); // calculate the arrow head and draw it... double dxx = (xx1 - xx0); double dyy = (yy1 - yy0); double bx = xx0 + (1.0 - this.baseLength) * dxx; double by = yy0 + (1.0 - this.baseLength) * dyy; double cx = xx0 + (1.0 - this.headLength) * dxx; double cy = yy0 + (1.0 - this.headLength) * dyy; double angle = 0.0; if (dxx != 0.0) { angle = Math.PI / 2.0 - Math.atan(dyy / dxx); } double deltaX = 2.0 * Math.cos(angle); double deltaY = 2.0 * Math.sin(angle); double leftx = cx + deltaX; double lefty = cy - deltaY; double rightx = cx - deltaX; double righty = cy + deltaY; GeneralPath p = new GeneralPath(); p.moveTo((float) xx1, (float) yy1); p.lineTo((float) rightx, (float) righty); p.lineTo((float) bx, (float) by); p.lineTo((float) leftx, (float) lefty); p.closePath(); g2.draw(p); }
From source file:com.controlj.addon.gwttree.server.OpaqueBarRenderer3D.java
@Override public void drawBackground(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea) { float x0 = (float) dataArea.getX(); float x1 = x0 + (float) Math.abs(getXOffset()); float x3 = (float) dataArea.getMaxX(); float x2 = x3 - (float) Math.abs(getXOffset()); float y0 = (float) dataArea.getMaxY(); float y1 = y0 - (float) Math.abs(getYOffset()); float y3 = (float) dataArea.getMinY(); float y2 = y3 + (float) Math.abs(getYOffset()); GeneralPath clip = new GeneralPath(); clip.moveTo(x0, y0);/*from ww w . jav a 2s . c om*/ clip.lineTo(x0, y2); clip.lineTo(x1, y3); clip.lineTo(x3, y3); clip.lineTo(x3, y1); clip.lineTo(x2, y0); clip.closePath(); Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, plot.getBackgroundAlpha())); // fill background... Paint backgroundPaint = plot.getBackgroundPaint(); if (backgroundPaint != null) { g2.setPaint(backgroundPaint); g2.fill(clip); } GeneralPath bottomWall = new GeneralPath(); bottomWall.moveTo(x0, y0); bottomWall.lineTo(x1, y1); bottomWall.lineTo(x3, y1); bottomWall.lineTo(x2, y0); bottomWall.closePath(); g2.setPaint(getWallPaint()); g2.fill(bottomWall); // draw background image, if there is one... Image backgroundImage = plot.getBackgroundImage(); if (backgroundImage != null) { Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX() + getXOffset(), dataArea.getY(), dataArea.getWidth() - getXOffset(), dataArea.getHeight() - getYOffset()); plot.drawBackgroundImage(g2, adjusted); } g2.setComposite(originalComposite); }
From source file:de.iteratec.iteraplan.presentation.dialog.GraphicalReporting.Line.JFreeChartSvgRenderer.java
byte[] renderJFreeChart(JFreeChart chart, float width, float height, boolean naked, Date fromDate, Date toDate) throws IOException { String svgNamespaceUri = SVGDOMImplementation.SVG_NAMESPACE_URI; Document doc = SVGDOMImplementation.getDOMImplementation().createDocument(svgNamespaceUri, "svg", null); String generatedText = "Generated " + DateUtils.formatAsStringToLong(new Date(), UserContext.getCurrentLocale()) + " by " + MessageAccess.getStringOrNull("global.applicationname", UserContext.getCurrentLocale()) + " " + properties.getBuildId();// ww w .j av a 2s . co m String drawingInfo = MessageAccess.getStringOrNull("graphicalExport.timeline.drawInfo", UserContext.getCurrentLocale()) + ": " + DateUtils.formatAsString(fromDate, UserContext.getCurrentLocale()) + " -> " + DateUtils.formatAsString(toDate, UserContext.getCurrentLocale()); SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(doc); ctx.setComment(generatedText); SVGGraphics2D svgGraphics = new SVGGraphics2D(ctx, false); if (!naked) { //Render the chart to the SVG graphics object chart.draw(svgGraphics, new Rectangle(20, 20, Math.round(width - MARGIN), Math.round(height - MARGIN))); //Add logo and generated text int widthIntForLogo = Math.round(width + 40 - MARGIN); int heightIntForLogo = Math.round(height - MARGIN + 20); int xLogoUpperRightCorner[] = { widthIntForLogo - 40, widthIntForLogo, widthIntForLogo, widthIntForLogo - 8, widthIntForLogo - 8, widthIntForLogo - 40 }; int yLogoUpperRightCorner[] = { MARGIN_TOP, MARGIN_TOP, MARGIN_TOP + 40, MARGIN_TOP + 40, MARGIN_TOP + 8, MARGIN_TOP + 8 }; GeneralPath logoUpperRightCorner = new GeneralPath(); logoUpperRightCorner.moveTo(xLogoUpperRightCorner[0], yLogoUpperRightCorner[0]); for (int i = 1; i < xLogoUpperRightCorner.length; i++) { logoUpperRightCorner.lineTo(xLogoUpperRightCorner[i], yLogoUpperRightCorner[i]); } logoUpperRightCorner.closePath(); svgGraphics.setColor(Color.decode(COLOR_LOGO)); svgGraphics.fill(logoUpperRightCorner); svgGraphics.draw(logoUpperRightCorner); int xLogoLowerLeftCorner[] = { MARGIN_LEFT, MARGIN_LEFT + 8, MARGIN_LEFT + 8, MARGIN_LEFT + 40, MARGIN_LEFT + 40, MARGIN_LEFT }; int yLogoLowerLeftCorner[] = { heightIntForLogo, heightIntForLogo, heightIntForLogo + 32, heightIntForLogo + 32, heightIntForLogo + 40, heightIntForLogo + 40 }; GeneralPath logoLowerLeftCorner = new GeneralPath(); logoLowerLeftCorner.moveTo(xLogoLowerLeftCorner[0], yLogoLowerLeftCorner[0]); for (int i = 1; i < xLogoLowerLeftCorner.length; i++) { logoLowerLeftCorner.lineTo(xLogoLowerLeftCorner[i], yLogoLowerLeftCorner[i]); } logoLowerLeftCorner.closePath(); svgGraphics.setColor(Color.BLACK); svgGraphics.fill(logoLowerLeftCorner); svgGraphics.draw(logoLowerLeftCorner); Font f = new Font(null, Font.ITALIC, 12); svgGraphics.setFont(f); FontMetrics fontMetrics = svgGraphics.getFontMetrics(f); int charsWidthInfo = fontMetrics.stringWidth(drawingInfo); svgGraphics.drawString(drawingInfo, width - MARGIN - charsWidthInfo, height - MARGIN + MARGIN_DOWN_GENERATED_TEXT); int charsWidth = fontMetrics.stringWidth(generatedText); svgGraphics.drawString(generatedText, width - MARGIN - charsWidth, height - MARGIN + MARGIN_DOWN_GENERATED_TEXT + 20); } else { chart.draw(svgGraphics, new Rectangle(20, 20, Math.round(JFreeChartLineGraphicCreator.DEFAULT_HEIGHT - NAKED_MARGIN), Math.round(JFreeChartLineGraphicCreator.DEFAULT_HEIGHT - NAKED_MARGIN))); } svgGraphics.setSVGCanvasSize(new Dimension((int) width, (int) height)); //Convert the SVGGraphics2D object to SVG XML ByteArrayOutputStream baos = new ByteArrayOutputStream(); Writer out = new OutputStreamWriter(baos, "UTF-8"); svgGraphics.stream(out, true); byte[] originalSvgXml = baos.toByteArray(); // return originalSvgXml; return addAdditionalAttributes(originalSvgXml); }
From source file:chiliad.parser.pdf.extractor.vectorgraphics.operator.Invoke.java
/** * process : Do : Paint the specified XObject (section 4.7). * * @param operator The operator that is being executed. * @param arguments List//from w ww . ja v a2 s . com * @throws IOException If there is an error invoking the sub object. */ @Override public void process(PDFOperator operator, List<COSBase> arguments) throws IOException { VectorGraphicsExtractor extractor = (VectorGraphicsExtractor) context; PDPage page = extractor.getPage(); COSName objectName = (COSName) arguments.get(0); Map<String, PDXObject> xobjects = extractor.getResources().getXObjects(); PDXObject xobject = (PDXObject) xobjects.get(objectName.getName()); if (xobject == null) { LOG.warn("Can't find the XObject for '" + objectName.getName() + "'"); } else if (xobject instanceof PDXObjectImage) { PDXObjectImage image = (PDXObjectImage) xobject; try { if (image.getImageMask()) { // set the current non stroking colorstate, so that it can // be used to create a stencil masked image image.setStencilColor(extractor.getGraphicsState().getNonStrokingColor()); } BufferedImage awtImage = image.getRGBImage(); if (awtImage == null) { LOG.warn("getRGBImage returned NULL"); return;//TODO PKOCH } int imageWidth = awtImage.getWidth(); int imageHeight = awtImage.getHeight(); double pageHeight = extractor.getPageSize().getHeight(); LOG.debug("imageWidth: " + imageWidth + "\t\timageHeight: " + imageHeight); Matrix ctm = extractor.getGraphicsState().getCurrentTransformationMatrix(); float yScaling = ctm.getYScale(); float angle = (float) Math.acos(ctm.getValue(0, 0) / ctm.getXScale()); if (ctm.getValue(0, 1) < 0 && ctm.getValue(1, 0) > 0) { angle = (-1) * angle; } ctm.setValue(2, 1, (float) (pageHeight - ctm.getYPosition() - Math.cos(angle) * yScaling)); ctm.setValue(2, 0, (float) (ctm.getXPosition() - Math.sin(angle) * yScaling)); // because of the moved 0,0-reference, we have to shear in the opposite direction ctm.setValue(0, 1, (-1) * ctm.getValue(0, 1)); ctm.setValue(1, 0, (-1) * ctm.getValue(1, 0)); AffineTransform ctmAT = ctm.createAffineTransform(); ctmAT.scale(1f / imageWidth, 1f / imageHeight); extractor.drawImage(awtImage, ctmAT); } catch (Exception e) { LOG.error(e, e); } } else if (xobject instanceof PDXObjectForm) { // save the graphics state context.getGraphicsStack().push((PDGraphicsState) context.getGraphicsState().clone()); PDXObjectForm form = (PDXObjectForm) xobject; COSStream formContentstream = form.getCOSStream(); // find some optional resources, instead of using the current resources PDResources pdResources = form.getResources(); // if there is an optional form matrix, we have to map the form space to the user space Matrix matrix = form.getMatrix(); if (matrix != null) { Matrix xobjectCTM = matrix.multiply(context.getGraphicsState().getCurrentTransformationMatrix()); context.getGraphicsState().setCurrentTransformationMatrix(xobjectCTM); } if (form.getBBox() != null) { PDGraphicsState graphicsState = context.getGraphicsState(); PDRectangle bBox = form.getBBox(); float x1 = bBox.getLowerLeftX(); float y1 = bBox.getLowerLeftY(); float x2 = bBox.getUpperRightX(); float y2 = bBox.getUpperRightY(); Point2D p0 = extractor.transformedPoint(x1, y1); Point2D p1 = extractor.transformedPoint(x2, y1); Point2D p2 = extractor.transformedPoint(x2, y2); Point2D p3 = extractor.transformedPoint(x1, y2); GeneralPath bboxPath = new GeneralPath(); bboxPath.moveTo((float) p0.getX(), (float) p0.getY()); bboxPath.lineTo((float) p1.getX(), (float) p1.getY()); bboxPath.lineTo((float) p2.getX(), (float) p2.getY()); bboxPath.lineTo((float) p3.getX(), (float) p3.getY()); bboxPath.closePath(); Area resultClippingArea = new Area(graphicsState.getCurrentClippingPath()); Area newArea = new Area(bboxPath); resultClippingArea.intersect(newArea); graphicsState.setCurrentClippingPath(resultClippingArea); } getContext().processSubStream(page, pdResources, formContentstream); // restore the graphics state context.setGraphicsState((PDGraphicsState) context.getGraphicsStack().pop()); } }
From source file:gov.nih.nci.caintegrator.ui.graphing.chart.plot.ClinicalPlot.java
private void createGlyphsAndAddToPlot(XYPlot plot) { XYShapeAnnotation glyph;//from ww w .java 2 s . c o m Shape glyphShape; Color glyphColor; ClinicalDataPoint clinicalPoint; String survivalLenStr; double x, y; for (Iterator i = dataPoints.iterator(); i.hasNext();) { clinicalPoint = (ClinicalDataPoint) i.next(); x = clinicalPoint.getFactorValue(factor1); y = clinicalPoint.getFactorValue(factor2); if ((x != ClinicalDataPoint.MISSING_CLINICAL_FACTOR_VALUE) && (y != ClinicalDataPoint.MISSING_CLINICAL_FACTOR_VALUE)) { //Make this a triangle GeneralPath gp = new GeneralPath(); float xf = (float) x; float yf = (float) y; //make a triangle gp.moveTo(xf, yf); gp.lineTo(xf + 1.5f, yf - 1.5f); gp.lineTo(xf - 1.5f, yf - 1.5f); gp.closePath(); glyphShape = gp; //Rectangle2D.Double rect = new Rectangle2D.Double(); //rect.setFrameFromCenter(x,y, x+1,y+1); //glyphShape = rect; glyphColor = getColorForDataPoint(clinicalPoint); glyph = new XYShapeAnnotation(glyphShape, new BasicStroke(1.0f), Color.BLACK, glyphColor); if (clinicalPoint.getSurvivalInMonths() >= 0.0) { survivalLenStr = nf.format(clinicalPoint.getSurvivalInMonths()); } else { survivalLenStr = ""; } String tooltip = clinicalPoint.getPatientId() + " " + clinicalPoint.getDiseaseName() + " survivalMonths=" + survivalLenStr; glyph.setToolTipText(tooltip); plot.addAnnotation(glyph); } } }
From source file:Bouncer.java
protected Shape createShape() { GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD, mPoints.length); path.moveTo(mPoints[0], mPoints[1]); for (int i = 2; i < mN; i += 6) path.curveTo(mPoints[i], mPoints[i + 1], mPoints[i + 2], mPoints[i + 3], mPoints[i + 4], mPoints[i + 5]);/*from w ww.jav a2 s .com*/ path.closePath(); return path; }