2012-09-20 02:43:39 +04:00
|
|
|
(function () {
|
2013-05-28 01:42:53 +04:00
|
|
|
var ns = $.namespace("pskl");
|
2012-09-20 02:43:39 +04:00
|
|
|
|
2013-05-28 01:42:53 +04:00
|
|
|
ns.CanvasUtils = {
|
|
|
|
createCanvas : function (width, height, classList) {
|
|
|
|
var canvas = document.createElement("canvas");
|
2012-09-20 02:43:39 +04:00
|
|
|
canvas.setAttribute("width", width);
|
|
|
|
canvas.setAttribute("height", height);
|
|
|
|
|
|
|
|
if (typeof classList == "string") {
|
2013-05-28 01:42:53 +04:00
|
|
|
classList = [classList];
|
|
|
|
}
|
|
|
|
if (Array.isArray(classList)) {
|
|
|
|
for (var i = 0 ; i < classList.length ; i++) {
|
|
|
|
canvas.classList.add(classList[i]);
|
2012-09-20 02:43:39 +04:00
|
|
|
}
|
2013-05-28 01:42:53 +04:00
|
|
|
}
|
2012-09-20 02:43:39 +04:00
|
|
|
|
|
|
|
return canvas;
|
2013-05-28 01:42:53 +04:00
|
|
|
}
|
|
|
|
};
|
2012-09-20 02:43:39 +04:00
|
|
|
})();
|