Added method to enable image smoothing on Canvas

This commit is contained in:
jdescottes 2015-02-26 00:13:32 +01:00
parent 4f2f01ea36
commit bcb709300c

View File

@ -41,12 +41,20 @@
* @param {Canvas} canvas
*/
disableImageSmoothing : function (canvas) {
pskl.utils.CanvasUtils.setImageSmoothing(canvas, false);
},
enableImageSmoothing : function (canvas) {
pskl.utils.CanvasUtils.setImageSmoothing(canvas, true);
},
setImageSmoothing : function (canvas, smoothing) {
var context = canvas.getContext('2d');
context.imageSmoothingEnabled = false;
context.mozImageSmoothingEnabled = false;
context.oImageSmoothingEnabled = false;
context.webkitImageSmoothingEnabled = false;
context.msImageSmoothingEnabled = false;
context.imageSmoothingEnabled = smoothing;
context.mozImageSmoothingEnabled = smoothing;
context.oImageSmoothingEnabled = smoothing;
context.webkitImageSmoothingEnabled = smoothing;
context.msImageSmoothingEnabled = smoothing;
},
clear : function (canvas) {