// vim: set ts=2 sw=2 et tw=80: class PenBrush { constructor() { this.opacity = 1; this.name = "PenBrush"; } draw(ctx, strokeStyle, x, y) { ctx.lineJoin = ctx.lineCap = 'round'; ctx.strokeStyle = strokeStyle; ctx.lineTo(x, y); ctx.stroke(); } } class DiscBrush extends PenBrush { static get RADIUS() { return 10; } constructor() { super(); this.name = "DiscBrush"; } draw(ctx, strokeStyle, x, y) { ctx.beginPath(); // clear previous path starting ctx.ellipse(x, y, 10, 10, 0, 0, 2 * Math.PI); ctx.fill(); ctx.stroke(); } } class StarBrush extends PenBrush { constructor() { super(); this.name = "StarBrush"; } draw(ctx, strokeStyle, x, y) { ctx.moveTo(x - 8, y - 3); ctx.lineTo(x - 3, y - 3); ctx.lineTo(x, y - 8); ctx.lineTo(x + 3, y - 3); ctx.lineTo(x + 8, y - 3); ctx.lineTo(x + 4, y + 1); ctx.lineTo(x + 4, y + 6); ctx.lineTo(x, y + 3); ctx.lineTo(x - 4, y + 6); ctx.lineTo(x - 4, y + 1); ctx.lineTo(x - 8, y - 3); ctx.stroke(); } }