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