Java Code Examples for javafx.scene.canvas.GraphicsContext#stroke()
The following examples show how to use
javafx.scene.canvas.GraphicsContext#stroke() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NotGatePeer.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paintGate(GraphicsContext graphics, CircuitState circuitState) { int x = getScreenX(); int y = getScreenY(); int width = 3 * GuiUtils.BLOCK_SIZE; int height = 2 * GuiUtils.BLOCK_SIZE; graphics.beginPath(); graphics.moveTo(x, y); graphics.lineTo(x, y + height); graphics.lineTo(x + width * 0.7, y + height * 0.5); graphics.closePath(); graphics.setFill(Color.WHITE); graphics.setStroke(Color.BLACK); graphics.fill(); graphics.stroke(); graphics.fillOval(x + width * 0.7, y + height * 0.5 - width * 0.125, width * 0.25, width * 0.25); graphics.strokeOval(x + width * 0.7, y + height * 0.5 - width * 0.125, width * 0.25, width * 0.25); }
Example 2
Source File: ToolGraphics.java From JetUML with GNU General Public License v3.0 | 6 votes |
/** * Strokes and fills a path, by converting the elements to integer coordinates and then * aligning them to the center of the pixels, so that it aligns precisely * with the JavaFX coordinate system. See the documentation for * javafx.scene.shape.Shape for details. * * @param pGraphics The graphics context. * @param pPath The path to stroke * @param pFill The fill color for the path. * @param pShadow True to include a drop shadow. */ public static void strokeAndFillSharpPath(GraphicsContext pGraphics, Path pPath, Paint pFill, boolean pShadow) { double width = pGraphics.getLineWidth(); Paint fill = pGraphics.getFill(); pGraphics.setLineWidth(LINE_WIDTH); pGraphics.setFill(pFill); applyPath(pGraphics, pPath); if( pShadow ) { pGraphics.setEffect(DROP_SHADOW); } pGraphics.fill(); pGraphics.stroke(); pGraphics.setLineWidth(width); pGraphics.setFill(fill); pGraphics.setEffect(null); }
Example 3
Source File: ControlledBufferPeer.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paint(GraphicsContext graphics, CircuitState circuitState) { GuiUtils.drawName(graphics, this, getProperties().getValue(Properties.LABEL_LOCATION)); GuiUtils.rotateGraphics(this, graphics, getProperties().getValue(Properties.DIRECTION)); graphics.beginPath(); graphics.moveTo(getScreenX(), getScreenY()); graphics.lineTo(getScreenX() + getScreenWidth(), getScreenY() + getScreenHeight() * 0.5); graphics.lineTo(getScreenX(), getScreenY() + getScreenHeight()); graphics.closePath(); graphics.setFill(Color.WHITE); graphics.fill(); graphics.setStroke(Color.BLACK); graphics.stroke(); }
Example 4
Source File: XnorGatePeer.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paintGate(GraphicsContext graphics, CircuitState circuitState) { int x = getScreenX(); int y = getScreenY(); int width = 4 * GuiUtils.BLOCK_SIZE; int height = 4 * GuiUtils.BLOCK_SIZE; graphics.beginPath(); graphics.moveTo(x + width * 0.1, y + height); graphics.arc(x + width * 0.1, y + height * 0.5, width * 0.25, height * 0.5, 270, 180); graphics.arcTo(x + width * 0.66, y, x + width, y + height * 1.3, width * 0.7); graphics.arcTo(x + width * 0.66, y + height, x + width * 0.1, y + height, width * 0.7); graphics.closePath(); graphics.setFill(Color.WHITE); graphics.setStroke(Color.BLACK); graphics.fill(); graphics.stroke(); graphics.strokeArc(x - width * 0.3, y, width * 0.5, height, 270, 180, ArcType.OPEN); graphics.fillOval(x + width * 0.8, y + height * 0.5 - width * 0.1, width * 0.2, width * 0.2); graphics.strokeOval(x + width * 0.8, y + height * 0.5 - width * 0.1, width * 0.2, width * 0.2); }
Example 5
Source File: AndGatePeer.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paintGate(GraphicsContext graphics, CircuitState circuitState) { int x = getScreenX(); int y = getScreenY(); int width = 4 * GuiUtils.BLOCK_SIZE; int height = 4 * GuiUtils.BLOCK_SIZE; graphics.beginPath(); graphics.moveTo(x, y); graphics.lineTo(x, y + height); graphics.arc(x + width * 0.5, y + height * 0.5, width * 0.5, height * 0.5, 270, 180); graphics.closePath(); graphics.setFill(Color.WHITE); graphics.setStroke(Color.BLACK); graphics.fill(); graphics.stroke(); }
Example 6
Source File: NandGatePeer.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paintGate(GraphicsContext graphics, CircuitState circuitState) { int x = getScreenX(); int y = getScreenY(); int width = 4 * GuiUtils.BLOCK_SIZE; int height = 4 * GuiUtils.BLOCK_SIZE; graphics.beginPath(); graphics.moveTo(x, y); graphics.lineTo(x, y + height); graphics.arc(x + width * 0.3, y + height * 0.5, width * 0.5, height * 0.5, 270, 180); graphics.closePath(); graphics.setFill(Color.WHITE); graphics.setStroke(Color.BLACK); graphics.fill(); graphics.stroke(); graphics.fillOval(x + width * 0.8, y + height * 0.5 - width * 0.1, width * 0.2, width * 0.2); graphics.strokeOval(x + width * 0.8, y + height * 0.5 - width * 0.1, width * 0.2, width * 0.2); }
Example 7
Source File: OrGatePeer.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paintGate(GraphicsContext graphics, CircuitState circuitState) { int x = getScreenX(); int y = getScreenY(); int width = 4 * GuiUtils.BLOCK_SIZE; int height = 4 * GuiUtils.BLOCK_SIZE; graphics.beginPath(); graphics.moveTo(x, y + height); graphics.arc(x, y + height * 0.5, width * 0.25, height * 0.5, 270, 180); graphics.arcTo(x + width * 0.66, y, x + width * 1.25, y + height, width); graphics.arcTo(x + width * 0.66, y + height, x, y + height, width); graphics.closePath(); graphics.setFill(Color.WHITE); graphics.setStroke(Color.BLACK); graphics.fill(); graphics.stroke(); }
Example 8
Source File: XorGatePeer.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paintGate(GraphicsContext graphics, CircuitState circuitState) { int x = getScreenX(); int y = getScreenY(); int width = 4 * GuiUtils.BLOCK_SIZE; int height = 4 * GuiUtils.BLOCK_SIZE; graphics.beginPath(); graphics.moveTo(x + width * 0.1, y + height); graphics.arc(x + width * 0.1, y + height * 0.5, width * 0.25, height * 0.5, 270, 180); graphics.arcTo(x + width * 0.66, y, x + width * 1.25, y + height, width); graphics.arcTo(x + width * 0.66, y + height, x + width * 0.1, y + height, width); graphics.closePath(); graphics.setFill(Color.WHITE); graphics.setStroke(Color.BLACK); graphics.fill(); graphics.stroke(); graphics.strokeArc(x - width * 0.3, y, width * 0.5, height, 270, 180, ArcType.OPEN); }
Example 9
Source File: NorGatePeer.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void paintGate(GraphicsContext graphics, CircuitState circuitState) { int x = getScreenX(); int y = getScreenY(); int width = 4 * GuiUtils.BLOCK_SIZE; int height = 4 * GuiUtils.BLOCK_SIZE; graphics.beginPath(); graphics.moveTo(x, y + height); graphics.arc(x, y + height * 0.5, width * 0.25, height * 0.5, 270, 180); graphics.arcTo(x + width * 0.66, y, x + width, y + height * 1.3, width * 0.7); graphics.arcTo(x + width * 0.66, y + height, x, y + height, width * 0.7); graphics.closePath(); graphics.setFill(Color.WHITE); graphics.setStroke(Color.BLACK); graphics.fill(); graphics.stroke(); graphics.fillOval(x + width * 0.8, y + height * 0.5 - width * 0.1, width * 0.2, width * 0.2); graphics.strokeOval(x + width * 0.8, y + height * 0.5 - width * 0.1, width * 0.2, width * 0.2); }
Example 10
Source File: GeneralPath.java From chart-fx with Apache License 2.0 | 6 votes |
public int draw(final GraphicsContext gc) { int count = 0; for (final Segment segment : drawList) { switch (segment.type) { case GC_LINETO: gc.lineTo(segment.x, segment.y); count++; break; case GC_MOVETO: gc.moveTo(segment.x, segment.y); count++; break; case GC_BEGINPATH: gc.beginPath(); break; case GC_CLOSEPATH: gc.closePath(); gc.stroke(); break; default: break; } } return count; }
Example 11
Source File: Path.java From charts with Apache License 2.0 | 6 votes |
public void draw(final GraphicsContext CTX, final boolean FILL, final boolean STROKE) { PathIterator pi = getPathIterator(new Affine()); CTX.setFillRule(WindingRule.WIND_EVEN_ODD == pi.getWindingRule() ? FillRule.EVEN_ODD : FillRule.NON_ZERO); CTX.beginPath(); double[] seg = new double[6]; int segType; while(!pi.isDone()) { segType = pi.currentSegment(seg); switch (segType) { case PathIterator.MOVE_TO : CTX.moveTo(seg[0], seg[1]); break; case PathIterator.LINE_TO : CTX.lineTo(seg[0], seg[1]); break; case PathIterator.QUAD_TO : CTX.quadraticCurveTo(seg[0], seg[1], seg[2], seg[3]);break; case PathIterator.BEZIER_TO: CTX.bezierCurveTo(seg[0], seg[1], seg[2], seg[3], seg[4], seg[5]);break; case PathIterator.CLOSE : CTX.closePath();break; default : break; } pi.next(); } if (FILL) { CTX.setFill(fill); CTX.fill(); } if (STROKE) { CTX.setStroke(stroke); CTX.stroke(); } }
Example 12
Source File: ToolGraphics.java From JetUML with GNU General Public License v3.0 | 5 votes |
/** * Strokes a path, by converting the elements to integer coordinates and then * aligning them to the center of the pixels, so that it aligns precisely * with the JavaFX coordinate system. See the documentation for * javafx.scene.shape.Shape for details. * * @param pGraphics The graphics context. * @param pPath The path to stroke * @param pStyle The line style for the path. */ public static void strokeSharpPath(GraphicsContext pGraphics, Path pPath, LineStyle pStyle) { double[] oldDash = pGraphics.getLineDashes(); pGraphics.setLineDashes(pStyle.getLineDashes()); double width = pGraphics.getLineWidth(); pGraphics.setLineWidth(LINE_WIDTH); applyPath(pGraphics, pPath); pGraphics.stroke(); pGraphics.setLineDashes(oldDash); pGraphics.setLineWidth(width); }
Example 13
Source File: DecoderPeer.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void paint(GraphicsContext graphics, CircuitState circuitState) { GuiUtils.drawName(graphics, this, getProperties().getValue(Properties.LABEL_LOCATION)); Direction direction = getProperties().getValue(Properties.DIRECTION); int x = getScreenX(); int y = getScreenY(); int width = 3 * GuiUtils.BLOCK_SIZE; int height = (getComponent().getNumOutputs() + 2) * GuiUtils.BLOCK_SIZE; int zeroXOffset = 0; switch(direction) { case SOUTH: graphics.translate(x, y); graphics.rotate(270); graphics.translate(-x - width, -y); case WEST: zeroXOffset = 2; graphics.beginPath(); graphics.moveTo(x, y); graphics.lineTo(x + width, y + Math.min(20, height * 0.2)); graphics.lineTo(x + width, y + height - Math.min(20, height * 0.2)); graphics.lineTo(x, y + height); graphics.closePath(); break; case NORTH: graphics.translate(x, y); graphics.rotate(270); graphics.translate(-x - width, -y); case EAST: zeroXOffset = width - 10; graphics.beginPath(); graphics.moveTo(x + width, y); graphics.lineTo(x, y + Math.min(20, height * 0.2)); graphics.lineTo(x, y + height - Math.min(20, height * 0.2)); graphics.lineTo(x + width, y + height); graphics.closePath(); break; } graphics.setFill(Color.WHITE); graphics.fill(); graphics.setStroke(Color.BLACK); graphics.stroke(); graphics.setFill(Color.DARKGRAY); graphics.fillText("0", x + zeroXOffset, y + 13); }
Example 14
Source File: DemultiplexerPeer.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void paint(GraphicsContext graphics, CircuitState circuitState) { GuiUtils.drawName(graphics, this, getProperties().getValue(Properties.LABEL_LOCATION)); Direction direction = getProperties().getValue(Properties.DIRECTION); int x = getScreenX(); int y = getScreenY(); int width = 3 * GuiUtils.BLOCK_SIZE; int height = (getComponent().getNumOutputs() + 2) * GuiUtils.BLOCK_SIZE; int zeroXOffset = 0; switch(direction) { case SOUTH: graphics.translate(x, y); graphics.rotate(270); graphics.translate(-x - width, -y); case WEST: zeroXOffset = 2; graphics.beginPath(); graphics.moveTo(x, y); graphics.lineTo(x + width, y + Math.min(20, height * 0.2)); graphics.lineTo(x + width, y + height - Math.min(20, height * 0.2)); graphics.lineTo(x, y + height); graphics.closePath(); break; case NORTH: graphics.translate(x, y); graphics.rotate(270); graphics.translate(-x - width, -y); case EAST: zeroXOffset = width - 10; graphics.beginPath(); graphics.moveTo(x + width, y); graphics.lineTo(x, y + Math.min(20, height * 0.2)); graphics.lineTo(x, y + height - Math.min(20, height * 0.2)); graphics.lineTo(x + width, y + height); graphics.closePath(); break; } graphics.setFill(Color.WHITE); graphics.fill(); graphics.setStroke(Color.BLACK); graphics.stroke(); graphics.setFill(Color.DARKGRAY); graphics.fillText("0", x + zeroXOffset, y + 13); }
Example 15
Source File: MultiplexerPeer.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void paint(GraphicsContext graphics, CircuitState circuitState) { GuiUtils.drawName(graphics, this, getProperties().getValue(Properties.LABEL_LOCATION)); Direction direction = getProperties().getValue(Properties.DIRECTION); int x = getScreenX(); int y = getScreenY(); int width = 3 * GuiUtils.BLOCK_SIZE; int height = (getComponent().getNumInputs() + 2) * GuiUtils.BLOCK_SIZE; int zeroXOffset = 0; switch(direction) { case NORTH: graphics.translate(x, y); graphics.rotate(270); graphics.translate(-x - width, -y); case EAST: zeroXOffset = 2; graphics.beginPath(); graphics.moveTo(x, y); graphics.lineTo(x + width, y + Math.min(20, height * 0.2)); graphics.lineTo(x + width, y + height - Math.min(20, height * 0.2)); graphics.lineTo(x, y + height); graphics.closePath(); break; case SOUTH: graphics.translate(x, y); graphics.rotate(270); graphics.translate(-x - width, -y); case WEST: zeroXOffset = width - 10; graphics.beginPath(); graphics.moveTo(x + width, y); graphics.lineTo(x, y + Math.min(20, height * 0.2)); graphics.lineTo(x, y + height - Math.min(20, height * 0.2)); graphics.lineTo(x + width, y + height); graphics.closePath(); break; } graphics.setFill(Color.WHITE); graphics.fill(); graphics.setStroke(Color.BLACK); graphics.stroke(); graphics.setFill(Color.DARKGRAY); graphics.fillText("0", x + zeroXOffset, y + 13); }
Example 16
Source File: Tunnel.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void paint(GraphicsContext graphics, CircuitState circuitState) { Direction direction = getProperties().getValue(Properties.DIRECTION); boolean isIncompatible = isIncompatible(); graphics.setStroke(Color.BLACK); graphics.setFill(isIncompatible ? Color.ORANGE : Color.WHITE); int block = GuiUtils.BLOCK_SIZE; int x = getScreenX(); int y = getScreenY(); int width = getScreenWidth(); int height = getScreenHeight(); int xOff = 0; int yOff = 0; switch(direction) { case EAST: xOff = -block; graphics.beginPath(); graphics.moveTo(x + width, y + height * 0.5); graphics.lineTo(x + width - block, y + height); graphics.lineTo(x, y + height); graphics.lineTo(x, y); graphics.lineTo(x + width - block, y); graphics.closePath(); break; case WEST: xOff = block; graphics.beginPath(); graphics.moveTo(x, y + height * 0.5); graphics.lineTo(x + block, y); graphics.lineTo(x + width, y); graphics.lineTo(x + width, y + height); graphics.lineTo(x + block, y + height); graphics.closePath(); break; case NORTH: yOff = block; graphics.beginPath(); graphics.moveTo(x + width * 0.5, y); graphics.lineTo(x + width, y + block); graphics.lineTo(x + width, y + height); graphics.lineTo(x, y + height); graphics.lineTo(x, y + block); graphics.closePath(); break; case SOUTH: yOff = -block; graphics.beginPath(); graphics.moveTo(x + width * 0.5, y + height); graphics.lineTo(x, y + height - block); graphics.lineTo(x, y); graphics.lineTo(x + width, y); graphics.lineTo(x + width, y + height - block); graphics.closePath(); break; } graphics.fill(); graphics.stroke(); if(!label.isEmpty()) { Bounds bounds = GuiUtils.getBounds(graphics.getFont(), label); graphics.setFill(Color.BLACK); graphics.fillText(label, x + xOff + ((width - xOff) - bounds.getWidth()) * 0.5, y + yOff + ((height - yOff) + bounds.getHeight()) * 0.4); } if(isIncompatible) { PortConnection port = getConnections().get(0); graphics.setFill(Color.BLACK); graphics.fillText(String.valueOf(bitSize), port.getScreenX() + 11, port.getScreenY() + 21); graphics.setStroke(Color.ORANGE); graphics.setFill(Color.ORANGE); graphics.strokeOval(port.getScreenX() - 2, port.getScreenY() - 2, 10, 10); graphics.fillText(String.valueOf(bitSize), port.getScreenX() + 10, port.getScreenY() + 20); } }
Example 17
Source File: TransistorPeer.java From CircuitSim with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void paint(GraphicsContext graphics, CircuitState state) { GuiUtils.drawName(graphics, this, getProperties().getValue(Properties.LABEL_LOCATION)); GuiUtils.rotateGraphics(this, graphics, getProperties().getValue(Properties.DIRECTION)); int x = getScreenX(); int y = getScreenY(); int width = getScreenWidth() > getScreenHeight() ? getScreenWidth() : getScreenHeight(); int height = getScreenWidth() > getScreenHeight() ? getScreenHeight() : getScreenWidth(); boolean gateLoc = getProperties().getValue(GATE_LOCATION_PROPERTY); switch(getProperties().getValue(Properties.DIRECTION)) { case WEST: case SOUTH: gateLoc = !gateLoc; break; } int yOff = gateLoc ? 0 : height; int m = gateLoc ? 1 : -1; graphics.setStroke(Color.BLACK); graphics.setLineWidth(2); graphics.beginPath(); graphics.moveTo(x, y + height - yOff); graphics.lineTo(x + width / 3.0, y + height - yOff); graphics.lineTo(x + width / 3.0, y + yOff + m * height * 0.7); graphics.lineTo(x + 2.0 * width / 3.0, y + yOff + m * height * 0.7); graphics.lineTo(x + 2.0 * width / 3.0, y + height - yOff); graphics.lineTo(x + width, y + height - yOff); graphics.moveTo(x + width / 3.0, y + yOff + m * height * 0.5); graphics.lineTo(x + 2.0 * width / 3.0, y + yOff + m * height * 0.5); graphics.stroke(); graphics.setLineWidth(1); graphics.beginPath(); graphics.moveTo(x + width * 0.5 - 1.5, y + yOff + m * (height * 0.7 + 3)); graphics.lineTo(x + width * 0.5 + 3.0, y + yOff + m * (height * 0.7 + 5)); graphics.lineTo(x + width * 0.5 - 1.5, y + yOff + m * (height * 0.7 + 7)); graphics.stroke(); if(getProperties().getValue(TRANSISTOR_TYPE_PROPERTY)) { graphics.strokeOval(x + width * 0.5 - 3, y + (gateLoc ? 3 : height - 9), 6, 6); } else { graphics.strokeLine(x + width * 0.5, y + yOff, x + width * 0.5, y + height * 0.5); } }
Example 18
Source File: ErrorDataSetRenderer.java From chart-fx with Apache License 2.0 | 4 votes |
protected static void drawPolyLineLine(final GraphicsContext gc, final CachedDataPoints localCachedPoints) { gc.save(); DefaultRenderColorScheme.setLineScheme(gc, localCachedPoints.defaultStyle, localCachedPoints.dataSetIndex + localCachedPoints.dataSetStyleIndex); DefaultRenderColorScheme.setGraphicsContextAttributes(gc, localCachedPoints.defaultStyle); if (localCachedPoints.allowForNaNs) { gc.beginPath(); gc.moveTo(localCachedPoints.xValues[0], localCachedPoints.yValues[0]); boolean lastIsFinite = true; double xLastValid = 0.0; double yLastValid = 0.0; for (int i = 0; i < localCachedPoints.actualDataCount; i++) { final double x0 = localCachedPoints.xValues[i]; final double y0 = localCachedPoints.yValues[i]; if (Double.isFinite(x0) && Double.isFinite(y0)) { if (!lastIsFinite) { gc.moveTo(x0, y0); lastIsFinite = true; continue; } gc.lineTo(x0, y0); xLastValid = x0; yLastValid = y0; lastIsFinite = true; } else { lastIsFinite = false; } } gc.moveTo(xLastValid, yLastValid); gc.closePath(); gc.stroke(); } else { if (gc.getLineDashes() != null) { gc.strokePolyline(localCachedPoints.xValues, localCachedPoints.yValues, localCachedPoints.actualDataCount); } else { for (int i = 0; i < localCachedPoints.actualDataCount - 1; i++) { final double x1 = localCachedPoints.xValues[i]; final double x2 = localCachedPoints.xValues[i + 1]; final double y1 = localCachedPoints.yValues[i]; final double y2 = localCachedPoints.yValues[i + 1]; gc.strokeLine(x1, y1, x2, y2); } } } gc.restore(); }
Example 19
Source File: ErrorDataSetRenderer.java From chart-fx with Apache License 2.0 | 4 votes |
protected static void drawPolyLineHistogramBezier(final GraphicsContext gc, final CachedDataPoints localCachedPoints) { final int n = localCachedPoints.actualDataCount; if (n < 2) { drawPolyLineLine(gc, localCachedPoints); return; } // need to allocate new array :-( final double[] xCp1 = DoubleArrayCache.getInstance().getArrayExact(n); final double[] yCp1 = DoubleArrayCache.getInstance().getArrayExact(n); final double[] xCp2 = DoubleArrayCache.getInstance().getArrayExact(n); final double[] yCp2 = DoubleArrayCache.getInstance().getArrayExact(n); BezierCurve.calcCurveControlPoints(localCachedPoints.xValues, localCachedPoints.yValues, xCp1, yCp1, xCp2, yCp2, localCachedPoints.actualDataCount); gc.save(); DefaultRenderColorScheme.setLineScheme(gc, localCachedPoints.defaultStyle, localCachedPoints.dataSetIndex + localCachedPoints.dataSetStyleIndex); DefaultRenderColorScheme.setGraphicsContextAttributes(gc, localCachedPoints.defaultStyle); // use stroke as fill colour gc.setFill(gc.getStroke()); gc.beginPath(); for (int i = 0; i < n - 1; i++) { final double x0 = localCachedPoints.xValues[i]; final double x1 = localCachedPoints.xValues[i + 1]; final double y0 = localCachedPoints.yValues[i]; final double y1 = localCachedPoints.yValues[i + 1]; // coordinates of first Bezier control point. final double xc0 = xCp1[i]; final double yc0 = yCp1[i]; // coordinates of the second Bezier control point. final double xc1 = xCp2[i]; final double yc1 = yCp2[i]; gc.moveTo(x0, y0); gc.bezierCurveTo(xc0, yc0, xc1, yc1, x1, y1); } gc.moveTo(localCachedPoints.xValues[n - 1], localCachedPoints.yValues[n - 1]); gc.closePath(); gc.stroke(); gc.restore(); // release arrays to Cache DoubleArrayCache.getInstance().add(xCp1); DoubleArrayCache.getInstance().add(yCp1); DoubleArrayCache.getInstance().add(xCp2); DoubleArrayCache.getInstance().add(yCp2); }