MCPcopy
hub / github.com/viliusle/miniPaint / render

Method render

src/js/tools/shapes/moon.js:52–71  ·  view source on GitHub ↗
(ctx, layer)

Source from the content-addressed store, hash-verified

50 }
51
52 render(ctx, layer) {
53 var params = layer.params;
54 ctx.save();
55
56 //set styles
57 ctx.strokeStyle = 'transparent';
58 ctx.fillStyle = 'transparent';
59 if(params.border)
60 ctx.strokeStyle = params.border_color;
61 if(params.fill)
62 ctx.fillStyle = params.fill_color;
63 ctx.lineWidth = params.border_size;
64
65 //draw with rotation support
66 ctx.translate(layer.x + layer.width / 2, layer.y + layer.height / 2);
67 ctx.rotate(layer.rotate * Math.PI / 180);
68 this.draw_shape(ctx, -layer.width / 2, -layer.height / 2, layer.width, layer.height, params.fill, params.border);
69
70 ctx.restore();
71 }
72
73 draw_shape(ctx, x, y, width, height, fill, stroke) {
74 var left = parseInt(x);

Callers

nothing calls this directly

Calls 4

draw_shapeMethod · 0.95
rotateMethod · 0.80
saveMethod · 0.45
translateMethod · 0.45

Tested by

no test coverage detected