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 * @param {Canvas} canvas
*/ */
disableImageSmoothing : function (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'); var context = canvas.getContext('2d');
context.imageSmoothingEnabled = false; context.imageSmoothingEnabled = smoothing;
context.mozImageSmoothingEnabled = false; context.mozImageSmoothingEnabled = smoothing;
context.oImageSmoothingEnabled = false; context.oImageSmoothingEnabled = smoothing;
context.webkitImageSmoothingEnabled = false; context.webkitImageSmoothingEnabled = smoothing;
context.msImageSmoothingEnabled = false; context.msImageSmoothingEnabled = smoothing;
}, },
clear : function (canvas) { clear : function (canvas) {