@Override public Canvas lineTo(int x, int y) { addOperation(() -> context2d.lineTo(x, y)); return this; }
@Override public Canvas drawPoint(float x, float y) { ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x, y); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas drawPoint(float x, float y) { ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x, y); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas drawPoint(float x, float y) { ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x, y); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas drawLine(float x0, float y0, float x1, float y1) { ctx.beginPath(); ctx.moveTo(x0, y0); ctx.lineTo(x1, y1); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas drawLine(float x0, float y0, float x1, float y1) { ctx.beginPath(); ctx.moveTo(x0, y0); ctx.lineTo(x1, y1); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas drawLine(float x0, float y0, float x1, float y1) { ctx.beginPath(); ctx.moveTo(x0, y0); ctx.lineTo(x1, y1); ctx.stroke(); isDirty = true; return this; }
@Override public void draw( Context2d ctx, double x, double y, double radius ) { ctx.beginPath(); ctx.arc( x, y, radius, 0, Math.PI, false ); ctx.moveTo( x - radius, y ); ctx.lineTo( x + radius, y ); ctx.stroke(); } }
private void drawGradient() { final Context2d ctx = canvas.getContext2d(); // draw gradient ctx.setFillStyle("#ffffff"); //$NON-NLS-1$ ctx.fillRect(0, 0, 26, 180); final Hsl hsl = new Hsl(0, 100, 50); for (int y = 0; y <= 179; y++) { hsl.setH(y * 2); ctx.setFillStyle(Colors.hsl2html(hsl)); ctx.fillRect(3, y, 20, 1); } // draw handle if (handleY >= 0) { ctx.setFillStyle("#000000"); //$NON-NLS-1$ ctx.beginPath(); ctx.moveTo(3, handleY); ctx.lineTo(0, handleY - 3); ctx.lineTo(0, handleY + 3); ctx.closePath(); ctx.fill(); ctx.moveTo(23, handleY); ctx.lineTo(26, handleY - 3); ctx.lineTo(26, handleY + 3); ctx.closePath(); ctx.fill(); } }
protected void onUpdate(double progress) { context.moveTo(centerX, centerY); context.lineTo( centerX + 2 * centerX * Math.cos((progress * Math.PI * 2)-Math.PI/2), centerY + 2 * centerY * Math.sin((progress * Math.PI * 2)-Math.PI/2));
context.moveTo(child.getIntAttribute("from_x"), child.getIntAttribute("from_y")); context.lineTo(child.getIntAttribute("to_x"), child.getIntAttribute("to_y")); context.closePath();
x = list.get(i++); y = list.get(i++); ctx.lineTo(x, y); break;
x = list.get(i++); y = list.get(i++); ctx.lineTo(x, y); break;
x = list.get(i++); y = list.get(i++); ctx.lineTo(x, y); break;
@Override public void paint(Canvas canvas, Matrix matrix) { if (Geometry.POLYGON.equals(geometry.getGeometryType())) { canvas.getContext2d().save(); canvas.getContext2d().setFillStyle(fillStyle); canvas.getContext2d().setStrokeStyle(strokeStyle); canvas.getContext2d().setLineWidth(strokeWidthPixels / matrix.getXx()); canvas.getContext2d().beginPath(); for (Geometry ring : geometry.getGeometries()) { Coordinate[] coords = ring.getCoordinates(); canvas.getContext2d().moveTo(coords[0].getX(), coords[0].getY()); for (int i = 1; i < coords.length - 1; i++) { canvas.getContext2d().lineTo(coords[i].getX(), coords[i].getY()); } } canvas.getContext2d().closePath(); canvas.getContext2d().fill(); canvas.getContext2d().stroke(); canvas.getContext2d().restore(); } }
@Override public void paint(Canvas canvas, Matrix matrix) { if (Geometry.POLYGON.equals(geometry.getGeometryType())) { canvas.getContext2d().save(); canvas.getContext2d().setFillStyle(fillStyle); canvas.getContext2d().setStrokeStyle(strokeStyle); canvas.getContext2d().setLineWidth(strokeWidthPixels / matrix.getXx()); canvas.getContext2d().beginPath(); for (Geometry ring : geometry.getGeometries()) { Coordinate[] coords = ring.getCoordinates(); canvas.getContext2d().moveTo(coords[0].getX(), coords[0].getY()); for (int i = 1; i < coords.length - 1; i++) { canvas.getContext2d().lineTo(coords[i].getX(), coords[i].getY()); } } canvas.getContext2d().closePath(); canvas.getContext2d().fill(); canvas.getContext2d().stroke(); canvas.getContext2d().restore(); } }
curvePoint.setY(line.getY()); ctx.lineTo(line.getX(), line.getY()); } else if (cmd instanceof CurveTo) { CurveTo curve = (CurveTo) cmd;