/** * Raw Canvas API object - should always correspond with the Canvas Schema * @param id * @param name * @param width * @param height * @param parentEntity * @constructor */ GameLib.D3.API.Canvas = function( id, name, width, height, parentEntity ) { if (GameLib.Utils.UndefinedOrNull(id)) { id = GameLib.Utils.RandomId(); } this.id = id; if (GameLib.Utils.UndefinedOrNull(name)) { name = 'Canvas (' + id + ')'; } this.name = name; if (GameLib.Utils.UndefinedOrNull(width)) { width = 512; } this.width = width; if (GameLib.Utils.UndefinedOrNull(height)) { height = 512; } this.height = height; if (GameLib.Utils.UndefinedOrNull(parentEntity)){ parentEntity = null; } this.parentEntity = parentEntity; }; GameLib.D3.API.Canvas.prototype = Object.create(GameLib.Component.prototype); GameLib.D3.API.Canvas.prototype.constructor = GameLib.D3.API.Canvas; /** * Returns an API light from an Object light * @param objectCanvas * @constructor */ GameLib.D3.API.Canvas.FromObject = function(objectCanvas) { return new GameLib.D3.API.Canvas( objectCanvas.id, objectCanvas.name, objectCanvas.width, objectCanvas.height, objectCanvas.parentEntity ); };