我有一個帶有藍色輪廓的圓弧,然後是使用全局複合運算符「destination-out」覆蓋部分圓弧的圓,導致部分圓弧被取消/切斷,但這留下了部分新的沒有輪廓的形狀,有沒有簡單的方法可以重新建立輪廓?使用globalCompositeOperation「destination-out」之後,如何獲得輪廓以包含新形狀?
工作實例可以在這裏找到:http://jsfiddle.net/NY2up/
var ctx = document.getElementById("display").getContext('2d');
ctx.beginPath();
ctx.arc(100, 100, 50, 0.0, 1.5, false);
ctx.lineTo(100, 100);
ctx.closePath();
ctx.fillStyle = 'red'
ctx.fill();
ctx.strokeStyle = 'blue';
ctx.lineWidth = 5;
ctx.stroke();
ctx.globalCompositeOperation = "destination-out";
ctx.beginPath();
ctx.arc(100, 100, 20, 0, Math.PI*2, true);
ctx.fill();
ctx.closePath();
@Loktar謝謝你的提示,我現在已經標出了合適的答案。 – 01AutoMonkey