
Kontur i wypełnienie prostokąta (1)
Jeżeli narysujemy prostokąt i użyjemy polecenia stroke() oraz polecenia fill() wówczas zobaczymy figurę posiadającą zarówno kontur jak i wypełnienie.
Listing
var cv = document.getElementById("canvas");
var ctx = cv.getContext("2d");
ctx.beginPath();
ctx.rect(50, 50, 200, 100);
ctx.lineWidth = 5;
ctx.strokeStyle = "#ff0000";
ctx.stroke();
ctx.fillStyle = "#0000ff";
ctx.fill();
