2013-06-26 40 views
3

我在使用createjs庫在html5畫布上繪圖時遇到問題。圖紙不光滑但是有別名。 似乎很多人只是用chrome來解決這個問題,但對我來說,IE和firefox並沒有什麼不同。我也發現它應該可以use alphamaskfilter to achieve anti-aliasing但我不知道如何。如果這是要走的路,有人可以告訴我該怎麼做?與createjs在畫布上繪圖是別名

這裏是代碼的一部分。這是使用鼠標的移動和油漆從鼠標是之前其中線現在在哪裏鼠標:

var drawing = new createjs.Shape(); 
drawing.name = pathID.toString(); 
drawing.graphics.ss(point.width, "round").s(point.color); 
drawing.graphics.mt(lastPoint.x, lastPoint.y);   
drawing.graphics.lt(point.x, point.y); 

// Draw onto the canvas, and then update the container cache. 
wrapper.addChild(drawing); 
wrapper.updateCache("source-over"); 
+1

請加上您的解決方案作爲一個答案(並標記它是正確的),人們這樣就會知道你的問題並不需要注意了。 –

回答

0

我找到了解決辦法。奇怪的是,如果你沒有給出參數wrapper.updateCache(它變得光滑),像這樣:

var drawing = new createjs.Shape(); 
drawing.name = pathID.toString(); 
drawing.graphics.ss(point.width, "round").s(point.color); 
drawing.graphics.mt(lastPoint.x, lastPoint.y);   
drawing.graphics.lt(point.x, point.y); 

// Draw onto the canvas, and then update the container cache. 
wrapper.addChild(drawing); 
wrapper.updateCache();