@Override public Canvas strokeRoundRect(float x, float y, float w, float h, float radius) { addRoundRectPath(x, y, w, h, radius); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas strokePath(Path path) { assert path instanceof HtmlPath; ((HtmlPath) path).replay(ctx); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas strokeRoundRect(float x, float y, float w, float h, float radius) { addRoundRectPath(x, y, w, h, radius); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas strokeRoundRect(float x, float y, float w, float h, float radius) { addRoundRectPath(x, y, w, h, radius); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas strokePath(Path path) { assert path instanceof HtmlPath; ((HtmlPath) path).replay(ctx); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas strokePath(Path path) { assert path instanceof HtmlPath; ((HtmlPath) path).replay(ctx); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas strokeCircle(float x, float y, float radius) { ctx.beginPath(); ctx.arc(x, y, radius, 0, 2 * Math.PI); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas drawArc(float cx, float cy, float r, float startAngle, float arcAngle) { boolean ccw = arcAngle > 0; ctx.beginPath(); ctx.arc(cx, cy, r, -startAngle, -(startAngle + arcAngle), ccw); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas strokeCircle(float x, float y, float radius) { ctx.beginPath(); ctx.arc(x, y, radius, 0, 2 * Math.PI); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas drawArc(float cx, float cy, float r, float startAngle, float arcAngle) { boolean ccw = arcAngle > 0; ctx.beginPath(); ctx.arc(cx, cy, r, -startAngle, -(startAngle + arcAngle), ccw); ctx.stroke(); isDirty = true; return this; }
@Override public Canvas strokeCircle(float x, float y, float radius) { ctx.beginPath(); ctx.arc(x, y, radius, 0, 2 * Math.PI); 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 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 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 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(); } }
@Override public void draw( Context2d ctx, double x, double y, double radius ) { ctx.beginPath(); ctx.moveTo( x + radius, y + radius ); ctx.lineTo( x, y ); ctx.lineTo( x - radius, y + radius ); ctx.stroke(); } }
protected void appendPath(Context2d ctx, PathSprite sprite) { ctx.beginPath(); sprite.toAbsolute(); // sprite = sprite.copy().toCurve(); PrecisePoint currentPoint = new PrecisePoint(); PrecisePoint movePoint = new PrecisePoint(); PrecisePoint curvePoint = new PrecisePoint(); PrecisePoint quadraticPoint = new PrecisePoint(); appendPathCommands(ctx, sprite.getCommands(), currentPoint, movePoint, curvePoint, quadraticPoint); double opacity = Double.isNaN(sprite.getOpacity()) ? 1.0 : sprite.getOpacity(); if (sprite.getFill() != null && sprite.getFill() != Color.NONE) { ctx.setGlobalAlpha(Double.isNaN(sprite.getFillOpacity()) ? opacity : opacity * sprite.getFillOpacity()); ctx.fill(); } if (sprite.getStroke() != null && sprite.getStroke() != Color.NONE && sprite.getStrokeWidth() != 0) { ctx.setLineCap(sprite.getStrokeLineCap() == null ? LineCap.BUTT : sprite.getStrokeLineCap()); ctx.setLineJoin(sprite.getStrokeLineJoin() == null ? LineJoin.MITER : sprite.getStrokeLineJoin()); ctx.setMiterLimit(sprite.getMiterLimit() == Double.NaN ? 4 : sprite.getMiterLimit()); ctx.setGlobalAlpha(Double.isNaN(sprite.getStrokeOpacity()) ? opacity : opacity * sprite.getStrokeOpacity()); ctx.stroke(); } }