diff --git a/src/pixi/Pixi.js b/src/pixi/Pixi.js index 2672346..66cae42 100644 --- a/src/pixi/Pixi.js +++ b/src/pixi/Pixi.js @@ -3,23 +3,63 @@ */ /** + * The [pixi.js](http://www.pixijs.com/) module/namespace. + * * @module PIXI */ + +/** + * Namespace-class for [pixi.js](http://www.pixijs.com/). + * + * Contains assorted static properties and enumerations. + * + * @class PIXI + * @static + */ var PIXI = PIXI || {}; -/* -* -* This file contains a lot of pixi consts which are used across the rendering engine -* @class Consts -*/ +/** + * @property {Integer} WEBGL_RENDERER + * @protected + * @static + */ PIXI.WEBGL_RENDERER = 0; +/** + * @property {Integer} CANVAS_RENDERER + * @protected + * @static + */ PIXI.CANVAS_RENDERER = 1; -// useful for testing against if your lib is using pixi. +/** + * Version of pixi that is loaded. + * @property {String} VERSION + * @static + */ PIXI.VERSION = "v2.1.0"; - -// the various blend modes supported by pixi +/** + * Various blend modes supported by pixi. + * @property {Object} blendModes + * @property {Integer} blendModes.NORMAL + * @property {Integer} blendModes.ADD + * @property {Integer} blendModes.MULTIPLY + * @property {Integer} blendModes.SCREEN + * @property {Integer} blendModes.OVERLAY + * @property {Integer} blendModes.DARKEN + * @property {Integer} blendModes.LIGHTEN + * @property {Integer} blendModes.COLOR_DODGE + * @property {Integer} blendModes.COLOR_BURN + * @property {Integer} blendModes.HARD_LIGHT + * @property {Integer} blendModes.SOFT_LIGHT + * @property {Integer} blendModes.DIFFERENCE + * @property {Integer} blendModes.EXCLUSION + * @property {Integer} blendModes.HUE + * @property {Integer} blendModes.SATURATION + * @property {Integer} blendModes.COLOR + * @property {Integer} blendModes.LUMINOSITY + * @static + */ PIXI.blendModes = { NORMAL:0, ADD:1, @@ -40,7 +80,18 @@ LUMINOSITY:16 }; -// the scale modes +/** + * The scale modes that are supported by pixi. + * + * The DEFAULT scale mode affects the default scaling mode of future operrations. + * It can be user-reassigned to either LINEAR or NEAREST, depending upon need. + * + * @property {Object} scaleModes + * @property {Integer} scaleModes.DEFAULT=LINEAR + * @property {Integer} scaleModes.LINEAR Smooth scaling + * @property {Integer} scaleModes.NEAREST Pixelating scaling + * @static + */ PIXI.scaleModes = { DEFAULT:0, LINEAR:0, @@ -65,19 +116,58 @@ PIXI.INTERACTION_FREQUENCY = 30; PIXI.AUTO_PREVENT_DEFAULT = true; +/** + * @property {Number} PI_2 + * @static + */ PIXI.PI_2 = Math.PI * 2; + +/** + * @property {Number} RAD_TO_DEG + * @static + */ PIXI.RAD_TO_DEG = 180 / Math.PI; + +/** + * @property {Number} DEG_TO_RAD + * @static + */ PIXI.DEG_TO_RAD = Math.PI / 180; +/** + * @property {String} RETINA_PREFIX + * @protected + * @static + */ PIXI.RETINA_PREFIX = "@2x"; //PIXI.SCALE_PREFIX "@x%%"; +/** + * If true the default pixi startup (console) banner message will be suppressed. + * + * @property {Boolean} dontSayHello + * @default false + * @static + */ PIXI.dontSayHello = false; - +/** + * The default render options if none are supplied to + * {{#crossLink "WebGLRenderer"}}{{/crossLink}} or {{#crossLink "CanvasRenderer"}}{{/crossLink}}. + * + * @property {Object} defaultRenderOptions + * @property {Object} defaultRenderOptions.view=null + * @property {Boolean} defaultRenderOptions.transparent=false + * @property {Boolean} defaultRenderOptions.antialias=false + * @property {Boolean} defaultRenderOptions.preserveDrawingBuffer=false + * @property {Number} defaultRenderOptions.resolution=1 + * @property {Boolean} defaultRenderOptions.clearBeforeRender=true + * @property {Boolean} defaultRenderOptions.autoResize=false + * @static + */ PIXI.defaultRenderOptions = { - view:null, - transparent:false, + view:null, + transparent:false, antialias:false, preserveDrawingBuffer:false, resolution:1, @@ -104,8 +194,6 @@ 'color: #ff2424; background: #fff' ]; - - console.log.apply(console, args); } else if (window['console']) diff --git a/src/pixi/Pixi.js b/src/pixi/Pixi.js index 2672346..66cae42 100644 --- a/src/pixi/Pixi.js +++ b/src/pixi/Pixi.js @@ -3,23 +3,63 @@ */ /** + * The [pixi.js](http://www.pixijs.com/) module/namespace. + * * @module PIXI */ + +/** + * Namespace-class for [pixi.js](http://www.pixijs.com/). + * + * Contains assorted static properties and enumerations. + * + * @class PIXI + * @static + */ var PIXI = PIXI || {}; -/* -* -* This file contains a lot of pixi consts which are used across the rendering engine -* @class Consts -*/ +/** + * @property {Integer} WEBGL_RENDERER + * @protected + * @static + */ PIXI.WEBGL_RENDERER = 0; +/** + * @property {Integer} CANVAS_RENDERER + * @protected + * @static + */ PIXI.CANVAS_RENDERER = 1; -// useful for testing against if your lib is using pixi. +/** + * Version of pixi that is loaded. + * @property {String} VERSION + * @static + */ PIXI.VERSION = "v2.1.0"; - -// the various blend modes supported by pixi +/** + * Various blend modes supported by pixi. + * @property {Object} blendModes + * @property {Integer} blendModes.NORMAL + * @property {Integer} blendModes.ADD + * @property {Integer} blendModes.MULTIPLY + * @property {Integer} blendModes.SCREEN + * @property {Integer} blendModes.OVERLAY + * @property {Integer} blendModes.DARKEN + * @property {Integer} blendModes.LIGHTEN + * @property {Integer} blendModes.COLOR_DODGE + * @property {Integer} blendModes.COLOR_BURN + * @property {Integer} blendModes.HARD_LIGHT + * @property {Integer} blendModes.SOFT_LIGHT + * @property {Integer} blendModes.DIFFERENCE + * @property {Integer} blendModes.EXCLUSION + * @property {Integer} blendModes.HUE + * @property {Integer} blendModes.SATURATION + * @property {Integer} blendModes.COLOR + * @property {Integer} blendModes.LUMINOSITY + * @static + */ PIXI.blendModes = { NORMAL:0, ADD:1, @@ -40,7 +80,18 @@ LUMINOSITY:16 }; -// the scale modes +/** + * The scale modes that are supported by pixi. + * + * The DEFAULT scale mode affects the default scaling mode of future operrations. + * It can be user-reassigned to either LINEAR or NEAREST, depending upon need. + * + * @property {Object} scaleModes + * @property {Integer} scaleModes.DEFAULT=LINEAR + * @property {Integer} scaleModes.LINEAR Smooth scaling + * @property {Integer} scaleModes.NEAREST Pixelating scaling + * @static + */ PIXI.scaleModes = { DEFAULT:0, LINEAR:0, @@ -65,19 +116,58 @@ PIXI.INTERACTION_FREQUENCY = 30; PIXI.AUTO_PREVENT_DEFAULT = true; +/** + * @property {Number} PI_2 + * @static + */ PIXI.PI_2 = Math.PI * 2; + +/** + * @property {Number} RAD_TO_DEG + * @static + */ PIXI.RAD_TO_DEG = 180 / Math.PI; + +/** + * @property {Number} DEG_TO_RAD + * @static + */ PIXI.DEG_TO_RAD = Math.PI / 180; +/** + * @property {String} RETINA_PREFIX + * @protected + * @static + */ PIXI.RETINA_PREFIX = "@2x"; //PIXI.SCALE_PREFIX "@x%%"; +/** + * If true the default pixi startup (console) banner message will be suppressed. + * + * @property {Boolean} dontSayHello + * @default false + * @static + */ PIXI.dontSayHello = false; - +/** + * The default render options if none are supplied to + * {{#crossLink "WebGLRenderer"}}{{/crossLink}} or {{#crossLink "CanvasRenderer"}}{{/crossLink}}. + * + * @property {Object} defaultRenderOptions + * @property {Object} defaultRenderOptions.view=null + * @property {Boolean} defaultRenderOptions.transparent=false + * @property {Boolean} defaultRenderOptions.antialias=false + * @property {Boolean} defaultRenderOptions.preserveDrawingBuffer=false + * @property {Number} defaultRenderOptions.resolution=1 + * @property {Boolean} defaultRenderOptions.clearBeforeRender=true + * @property {Boolean} defaultRenderOptions.autoResize=false + * @static + */ PIXI.defaultRenderOptions = { - view:null, - transparent:false, + view:null, + transparent:false, antialias:false, preserveDrawingBuffer:false, resolution:1, @@ -104,8 +194,6 @@ 'color: #ff2424; background: #fff' ]; - - console.log.apply(console, args); } else if (window['console']) diff --git a/src/pixi/renderers/canvas/utils/CanvasTinter.js b/src/pixi/renderers/canvas/utils/CanvasTinter.js index 33da9e1..dd50b06 100644 --- a/src/pixi/renderers/canvas/utils/CanvasTinter.js +++ b/src/pixi/renderers/canvas/utils/CanvasTinter.js @@ -3,8 +3,9 @@ */ /** + * Utility methods for Sprite/Texture tinting. + * * @class CanvasTinter - * @constructor * @static */ PIXI.CanvasTinter = function() @@ -15,6 +16,7 @@ * Basically this method just needs a sprite and a color and tints the sprite with the given color. * * @method getTintedTexture + * @static * @param sprite {Sprite} the sprite to tint * @param color {Number} the color to use to tint the sprite with * @return {HTMLCanvasElement} The tinted canvas @@ -59,6 +61,7 @@ * Tint a texture using the "multiply" operation. * * @method tintWithMultiply + * @static * @param texture {Texture} the texture to tint * @param color {Number} the color to use to tint the sprite with * @param canvas {HTMLCanvasElement} the current canvas @@ -105,6 +108,7 @@ * Tint a texture using the "overlay" operation. * * @method tintWithOverlay + * @static * @param texture {Texture} the texture to tint * @param color {Number} the color to use to tint the sprite with * @param canvas {HTMLCanvasElement} the current canvas @@ -140,6 +144,7 @@ * Tint a texture pixel per pixel. * * @method tintPerPixel + * @static * @param texture {Texture} the texture to tint * @param color {Number} the color to use to tint the sprite with * @param canvas {HTMLCanvasElement} the current canvas @@ -185,6 +190,7 @@ * Rounds the specified color according to the PIXI.CanvasTinter.cacheStepsPerColorChannel. * * @method roundColor + * @static * @param color {number} the color to round, should be a hex color */ PIXI.CanvasTinter.roundColor = function(color) @@ -203,8 +209,9 @@ /** * Number of steps which will be used as a cap when rounding colors. * - * @property cacheStepsPerColorChannel + * @property cacheStepsPerColorChannel * @type Number + * @static */ PIXI.CanvasTinter.cacheStepsPerColorChannel = 8; @@ -213,6 +220,7 @@ * * @property convertTintToImage * @type Boolean + * @static */ PIXI.CanvasTinter.convertTintToImage = false; @@ -221,6 +229,7 @@ * * @property canUseMultiply * @type Boolean + * @static */ PIXI.CanvasTinter.canUseMultiply = PIXI.canUseNewCanvasBlendModes(); @@ -228,5 +237,6 @@ * The tinting method that will be used. * * @method tintMethod + * @static */ PIXI.CanvasTinter.tintMethod = PIXI.CanvasTinter.canUseMultiply ? PIXI.CanvasTinter.tintWithMultiply : PIXI.CanvasTinter.tintWithPerPixel; diff --git a/src/pixi/Pixi.js b/src/pixi/Pixi.js index 2672346..66cae42 100644 --- a/src/pixi/Pixi.js +++ b/src/pixi/Pixi.js @@ -3,23 +3,63 @@ */ /** + * The [pixi.js](http://www.pixijs.com/) module/namespace. + * * @module PIXI */ + +/** + * Namespace-class for [pixi.js](http://www.pixijs.com/). + * + * Contains assorted static properties and enumerations. + * + * @class PIXI + * @static + */ var PIXI = PIXI || {}; -/* -* -* This file contains a lot of pixi consts which are used across the rendering engine -* @class Consts -*/ +/** + * @property {Integer} WEBGL_RENDERER + * @protected + * @static + */ PIXI.WEBGL_RENDERER = 0; +/** + * @property {Integer} CANVAS_RENDERER + * @protected + * @static + */ PIXI.CANVAS_RENDERER = 1; -// useful for testing against if your lib is using pixi. +/** + * Version of pixi that is loaded. + * @property {String} VERSION + * @static + */ PIXI.VERSION = "v2.1.0"; - -// the various blend modes supported by pixi +/** + * Various blend modes supported by pixi. + * @property {Object} blendModes + * @property {Integer} blendModes.NORMAL + * @property {Integer} blendModes.ADD + * @property {Integer} blendModes.MULTIPLY + * @property {Integer} blendModes.SCREEN + * @property {Integer} blendModes.OVERLAY + * @property {Integer} blendModes.DARKEN + * @property {Integer} blendModes.LIGHTEN + * @property {Integer} blendModes.COLOR_DODGE + * @property {Integer} blendModes.COLOR_BURN + * @property {Integer} blendModes.HARD_LIGHT + * @property {Integer} blendModes.SOFT_LIGHT + * @property {Integer} blendModes.DIFFERENCE + * @property {Integer} blendModes.EXCLUSION + * @property {Integer} blendModes.HUE + * @property {Integer} blendModes.SATURATION + * @property {Integer} blendModes.COLOR + * @property {Integer} blendModes.LUMINOSITY + * @static + */ PIXI.blendModes = { NORMAL:0, ADD:1, @@ -40,7 +80,18 @@ LUMINOSITY:16 }; -// the scale modes +/** + * The scale modes that are supported by pixi. + * + * The DEFAULT scale mode affects the default scaling mode of future operrations. + * It can be user-reassigned to either LINEAR or NEAREST, depending upon need. + * + * @property {Object} scaleModes + * @property {Integer} scaleModes.DEFAULT=LINEAR + * @property {Integer} scaleModes.LINEAR Smooth scaling + * @property {Integer} scaleModes.NEAREST Pixelating scaling + * @static + */ PIXI.scaleModes = { DEFAULT:0, LINEAR:0, @@ -65,19 +116,58 @@ PIXI.INTERACTION_FREQUENCY = 30; PIXI.AUTO_PREVENT_DEFAULT = true; +/** + * @property {Number} PI_2 + * @static + */ PIXI.PI_2 = Math.PI * 2; + +/** + * @property {Number} RAD_TO_DEG + * @static + */ PIXI.RAD_TO_DEG = 180 / Math.PI; + +/** + * @property {Number} DEG_TO_RAD + * @static + */ PIXI.DEG_TO_RAD = Math.PI / 180; +/** + * @property {String} RETINA_PREFIX + * @protected + * @static + */ PIXI.RETINA_PREFIX = "@2x"; //PIXI.SCALE_PREFIX "@x%%"; +/** + * If true the default pixi startup (console) banner message will be suppressed. + * + * @property {Boolean} dontSayHello + * @default false + * @static + */ PIXI.dontSayHello = false; - +/** + * The default render options if none are supplied to + * {{#crossLink "WebGLRenderer"}}{{/crossLink}} or {{#crossLink "CanvasRenderer"}}{{/crossLink}}. + * + * @property {Object} defaultRenderOptions + * @property {Object} defaultRenderOptions.view=null + * @property {Boolean} defaultRenderOptions.transparent=false + * @property {Boolean} defaultRenderOptions.antialias=false + * @property {Boolean} defaultRenderOptions.preserveDrawingBuffer=false + * @property {Number} defaultRenderOptions.resolution=1 + * @property {Boolean} defaultRenderOptions.clearBeforeRender=true + * @property {Boolean} defaultRenderOptions.autoResize=false + * @static + */ PIXI.defaultRenderOptions = { - view:null, - transparent:false, + view:null, + transparent:false, antialias:false, preserveDrawingBuffer:false, resolution:1, @@ -104,8 +194,6 @@ 'color: #ff2424; background: #fff' ]; - - console.log.apply(console, args); } else if (window['console']) diff --git a/src/pixi/renderers/canvas/utils/CanvasTinter.js b/src/pixi/renderers/canvas/utils/CanvasTinter.js index 33da9e1..dd50b06 100644 --- a/src/pixi/renderers/canvas/utils/CanvasTinter.js +++ b/src/pixi/renderers/canvas/utils/CanvasTinter.js @@ -3,8 +3,9 @@ */ /** + * Utility methods for Sprite/Texture tinting. + * * @class CanvasTinter - * @constructor * @static */ PIXI.CanvasTinter = function() @@ -15,6 +16,7 @@ * Basically this method just needs a sprite and a color and tints the sprite with the given color. * * @method getTintedTexture + * @static * @param sprite {Sprite} the sprite to tint * @param color {Number} the color to use to tint the sprite with * @return {HTMLCanvasElement} The tinted canvas @@ -59,6 +61,7 @@ * Tint a texture using the "multiply" operation. * * @method tintWithMultiply + * @static * @param texture {Texture} the texture to tint * @param color {Number} the color to use to tint the sprite with * @param canvas {HTMLCanvasElement} the current canvas @@ -105,6 +108,7 @@ * Tint a texture using the "overlay" operation. * * @method tintWithOverlay + * @static * @param texture {Texture} the texture to tint * @param color {Number} the color to use to tint the sprite with * @param canvas {HTMLCanvasElement} the current canvas @@ -140,6 +144,7 @@ * Tint a texture pixel per pixel. * * @method tintPerPixel + * @static * @param texture {Texture} the texture to tint * @param color {Number} the color to use to tint the sprite with * @param canvas {HTMLCanvasElement} the current canvas @@ -185,6 +190,7 @@ * Rounds the specified color according to the PIXI.CanvasTinter.cacheStepsPerColorChannel. * * @method roundColor + * @static * @param color {number} the color to round, should be a hex color */ PIXI.CanvasTinter.roundColor = function(color) @@ -203,8 +209,9 @@ /** * Number of steps which will be used as a cap when rounding colors. * - * @property cacheStepsPerColorChannel + * @property cacheStepsPerColorChannel * @type Number + * @static */ PIXI.CanvasTinter.cacheStepsPerColorChannel = 8; @@ -213,6 +220,7 @@ * * @property convertTintToImage * @type Boolean + * @static */ PIXI.CanvasTinter.convertTintToImage = false; @@ -221,6 +229,7 @@ * * @property canUseMultiply * @type Boolean + * @static */ PIXI.CanvasTinter.canUseMultiply = PIXI.canUseNewCanvasBlendModes(); @@ -228,5 +237,6 @@ * The tinting method that will be used. * * @method tintMethod + * @static */ PIXI.CanvasTinter.tintMethod = PIXI.CanvasTinter.canUseMultiply ? PIXI.CanvasTinter.tintWithMultiply : PIXI.CanvasTinter.tintWithPerPixel; diff --git a/src/pixi/textures/VideoTexture.js b/src/pixi/textures/VideoTexture.js index aba9700..ab73e5e 100644 --- a/src/pixi/textures/VideoTexture.js +++ b/src/pixi/textures/VideoTexture.js @@ -1,4 +1,14 @@ - +/** + * A texture of a [playing] Video. + * + * See the ["deus" demo](http://www.goodboydigital.com/pixijs/examples/deus/). + * + * @class VideoTexture + * @extends BaseTexture + * @constructor + * @param source {HTMLVideoElement} + * @param scaleMode {Integer} See {{#crossLink "PIXI/scaleModes:property"}}{{/crossLink}} for possible values + */ PIXI.VideoTexture = function( source, scaleMode ) { if( !source ){ @@ -83,11 +93,27 @@ } }; +PIXI.VideoTexture.prototype.destroy = function() +{ + if( this.source && this.source._pixiId ) + { + PIXI.BaseTextureCache[ this.source._pixiId ] = null; + delete PIXI.BaseTextureCache[ this.source._pixiId ]; + + this.source._pixiId = null; + delete this.source._pixiId; + } + + PIXI.BaseTexture.prototype.destroy.call( this ); +}; /** * Mimic Pixi BaseTexture.from.... method. - * @param video - * @param scaleMode + * + * @name baseTextureFromVideo + * @static + * @param video {HTMLVideoElement} + * @param scaleMode {Integer} See {{#crossLink "PIXI/scaleModes:property"}}{{/crossLink}} for possible values * @returns {PIXI.VideoTexture} */ PIXI.VideoTexture.baseTextureFromVideo = function( video, scaleMode ) @@ -108,25 +134,13 @@ return baseTexture; }; - -PIXI.VideoTexture.prototype.destroy = function() -{ - if( this.source && this.source._pixiId ) - { - PIXI.BaseTextureCache[ this.source._pixiId ] = null; - delete PIXI.BaseTextureCache[ this.source._pixiId ]; - - this.source._pixiId = null; - delete this.source._pixiId; - } - - PIXI.BaseTexture.prototype.destroy.call( this ); -}; - /** - * Mimic PIXI Texture.from... method. - * @param video - * @param scaleMode + * Mimic Pixi BaseTexture.from.... method. + * + * @name textureFromVideo + * @static + * @param video {HTMLVideoElement} + * @param scaleMode {Integer} See {{#crossLink "PIXI/scaleModes:property"}}{{/crossLink}} for possible values * @returns {PIXI.Texture} */ PIXI.VideoTexture.textureFromVideo = function( video, scaleMode ) @@ -135,6 +149,15 @@ return new PIXI.Texture( baseTexture ); }; +/** + * Mimic Pixi BaseTexture.from.... method. + * + * @name fromUrl + * @static + * @param videoSrc {Url} + * @param scaleMode {Integer} See {{#crossLink "PIXI/scaleModes:property"}}{{/crossLink}} for possible values + * @returns {PIXI.Texture} + */ PIXI.VideoTexture.fromUrl = function( videoSrc, scaleMode ) { var video = document.createElement('video'); @@ -143,4 +166,3 @@ video.play(); return PIXI.VideoTexture.textureFromVideo( video, scaleMode); }; - diff --git a/src/pixi/Pixi.js b/src/pixi/Pixi.js index 2672346..66cae42 100644 --- a/src/pixi/Pixi.js +++ b/src/pixi/Pixi.js @@ -3,23 +3,63 @@ */ /** + * The [pixi.js](http://www.pixijs.com/) module/namespace. + * * @module PIXI */ + +/** + * Namespace-class for [pixi.js](http://www.pixijs.com/). + * + * Contains assorted static properties and enumerations. + * + * @class PIXI + * @static + */ var PIXI = PIXI || {}; -/* -* -* This file contains a lot of pixi consts which are used across the rendering engine -* @class Consts -*/ +/** + * @property {Integer} WEBGL_RENDERER + * @protected + * @static + */ PIXI.WEBGL_RENDERER = 0; +/** + * @property {Integer} CANVAS_RENDERER + * @protected + * @static + */ PIXI.CANVAS_RENDERER = 1; -// useful for testing against if your lib is using pixi. +/** + * Version of pixi that is loaded. + * @property {String} VERSION + * @static + */ PIXI.VERSION = "v2.1.0"; - -// the various blend modes supported by pixi +/** + * Various blend modes supported by pixi. + * @property {Object} blendModes + * @property {Integer} blendModes.NORMAL + * @property {Integer} blendModes.ADD + * @property {Integer} blendModes.MULTIPLY + * @property {Integer} blendModes.SCREEN + * @property {Integer} blendModes.OVERLAY + * @property {Integer} blendModes.DARKEN + * @property {Integer} blendModes.LIGHTEN + * @property {Integer} blendModes.COLOR_DODGE + * @property {Integer} blendModes.COLOR_BURN + * @property {Integer} blendModes.HARD_LIGHT + * @property {Integer} blendModes.SOFT_LIGHT + * @property {Integer} blendModes.DIFFERENCE + * @property {Integer} blendModes.EXCLUSION + * @property {Integer} blendModes.HUE + * @property {Integer} blendModes.SATURATION + * @property {Integer} blendModes.COLOR + * @property {Integer} blendModes.LUMINOSITY + * @static + */ PIXI.blendModes = { NORMAL:0, ADD:1, @@ -40,7 +80,18 @@ LUMINOSITY:16 }; -// the scale modes +/** + * The scale modes that are supported by pixi. + * + * The DEFAULT scale mode affects the default scaling mode of future operrations. + * It can be user-reassigned to either LINEAR or NEAREST, depending upon need. + * + * @property {Object} scaleModes + * @property {Integer} scaleModes.DEFAULT=LINEAR + * @property {Integer} scaleModes.LINEAR Smooth scaling + * @property {Integer} scaleModes.NEAREST Pixelating scaling + * @static + */ PIXI.scaleModes = { DEFAULT:0, LINEAR:0, @@ -65,19 +116,58 @@ PIXI.INTERACTION_FREQUENCY = 30; PIXI.AUTO_PREVENT_DEFAULT = true; +/** + * @property {Number} PI_2 + * @static + */ PIXI.PI_2 = Math.PI * 2; + +/** + * @property {Number} RAD_TO_DEG + * @static + */ PIXI.RAD_TO_DEG = 180 / Math.PI; + +/** + * @property {Number} DEG_TO_RAD + * @static + */ PIXI.DEG_TO_RAD = Math.PI / 180; +/** + * @property {String} RETINA_PREFIX + * @protected + * @static + */ PIXI.RETINA_PREFIX = "@2x"; //PIXI.SCALE_PREFIX "@x%%"; +/** + * If true the default pixi startup (console) banner message will be suppressed. + * + * @property {Boolean} dontSayHello + * @default false + * @static + */ PIXI.dontSayHello = false; - +/** + * The default render options if none are supplied to + * {{#crossLink "WebGLRenderer"}}{{/crossLink}} or {{#crossLink "CanvasRenderer"}}{{/crossLink}}. + * + * @property {Object} defaultRenderOptions + * @property {Object} defaultRenderOptions.view=null + * @property {Boolean} defaultRenderOptions.transparent=false + * @property {Boolean} defaultRenderOptions.antialias=false + * @property {Boolean} defaultRenderOptions.preserveDrawingBuffer=false + * @property {Number} defaultRenderOptions.resolution=1 + * @property {Boolean} defaultRenderOptions.clearBeforeRender=true + * @property {Boolean} defaultRenderOptions.autoResize=false + * @static + */ PIXI.defaultRenderOptions = { - view:null, - transparent:false, + view:null, + transparent:false, antialias:false, preserveDrawingBuffer:false, resolution:1, @@ -104,8 +194,6 @@ 'color: #ff2424; background: #fff' ]; - - console.log.apply(console, args); } else if (window['console']) diff --git a/src/pixi/renderers/canvas/utils/CanvasTinter.js b/src/pixi/renderers/canvas/utils/CanvasTinter.js index 33da9e1..dd50b06 100644 --- a/src/pixi/renderers/canvas/utils/CanvasTinter.js +++ b/src/pixi/renderers/canvas/utils/CanvasTinter.js @@ -3,8 +3,9 @@ */ /** + * Utility methods for Sprite/Texture tinting. + * * @class CanvasTinter - * @constructor * @static */ PIXI.CanvasTinter = function() @@ -15,6 +16,7 @@ * Basically this method just needs a sprite and a color and tints the sprite with the given color. * * @method getTintedTexture + * @static * @param sprite {Sprite} the sprite to tint * @param color {Number} the color to use to tint the sprite with * @return {HTMLCanvasElement} The tinted canvas @@ -59,6 +61,7 @@ * Tint a texture using the "multiply" operation. * * @method tintWithMultiply + * @static * @param texture {Texture} the texture to tint * @param color {Number} the color to use to tint the sprite with * @param canvas {HTMLCanvasElement} the current canvas @@ -105,6 +108,7 @@ * Tint a texture using the "overlay" operation. * * @method tintWithOverlay + * @static * @param texture {Texture} the texture to tint * @param color {Number} the color to use to tint the sprite with * @param canvas {HTMLCanvasElement} the current canvas @@ -140,6 +144,7 @@ * Tint a texture pixel per pixel. * * @method tintPerPixel + * @static * @param texture {Texture} the texture to tint * @param color {Number} the color to use to tint the sprite with * @param canvas {HTMLCanvasElement} the current canvas @@ -185,6 +190,7 @@ * Rounds the specified color according to the PIXI.CanvasTinter.cacheStepsPerColorChannel. * * @method roundColor + * @static * @param color {number} the color to round, should be a hex color */ PIXI.CanvasTinter.roundColor = function(color) @@ -203,8 +209,9 @@ /** * Number of steps which will be used as a cap when rounding colors. * - * @property cacheStepsPerColorChannel + * @property cacheStepsPerColorChannel * @type Number + * @static */ PIXI.CanvasTinter.cacheStepsPerColorChannel = 8; @@ -213,6 +220,7 @@ * * @property convertTintToImage * @type Boolean + * @static */ PIXI.CanvasTinter.convertTintToImage = false; @@ -221,6 +229,7 @@ * * @property canUseMultiply * @type Boolean + * @static */ PIXI.CanvasTinter.canUseMultiply = PIXI.canUseNewCanvasBlendModes(); @@ -228,5 +237,6 @@ * The tinting method that will be used. * * @method tintMethod + * @static */ PIXI.CanvasTinter.tintMethod = PIXI.CanvasTinter.canUseMultiply ? PIXI.CanvasTinter.tintWithMultiply : PIXI.CanvasTinter.tintWithPerPixel; diff --git a/src/pixi/textures/VideoTexture.js b/src/pixi/textures/VideoTexture.js index aba9700..ab73e5e 100644 --- a/src/pixi/textures/VideoTexture.js +++ b/src/pixi/textures/VideoTexture.js @@ -1,4 +1,14 @@ - +/** + * A texture of a [playing] Video. + * + * See the ["deus" demo](http://www.goodboydigital.com/pixijs/examples/deus/). + * + * @class VideoTexture + * @extends BaseTexture + * @constructor + * @param source {HTMLVideoElement} + * @param scaleMode {Integer} See {{#crossLink "PIXI/scaleModes:property"}}{{/crossLink}} for possible values + */ PIXI.VideoTexture = function( source, scaleMode ) { if( !source ){ @@ -83,11 +93,27 @@ } }; +PIXI.VideoTexture.prototype.destroy = function() +{ + if( this.source && this.source._pixiId ) + { + PIXI.BaseTextureCache[ this.source._pixiId ] = null; + delete PIXI.BaseTextureCache[ this.source._pixiId ]; + + this.source._pixiId = null; + delete this.source._pixiId; + } + + PIXI.BaseTexture.prototype.destroy.call( this ); +}; /** * Mimic Pixi BaseTexture.from.... method. - * @param video - * @param scaleMode + * + * @name baseTextureFromVideo + * @static + * @param video {HTMLVideoElement} + * @param scaleMode {Integer} See {{#crossLink "PIXI/scaleModes:property"}}{{/crossLink}} for possible values * @returns {PIXI.VideoTexture} */ PIXI.VideoTexture.baseTextureFromVideo = function( video, scaleMode ) @@ -108,25 +134,13 @@ return baseTexture; }; - -PIXI.VideoTexture.prototype.destroy = function() -{ - if( this.source && this.source._pixiId ) - { - PIXI.BaseTextureCache[ this.source._pixiId ] = null; - delete PIXI.BaseTextureCache[ this.source._pixiId ]; - - this.source._pixiId = null; - delete this.source._pixiId; - } - - PIXI.BaseTexture.prototype.destroy.call( this ); -}; - /** - * Mimic PIXI Texture.from... method. - * @param video - * @param scaleMode + * Mimic Pixi BaseTexture.from.... method. + * + * @name textureFromVideo + * @static + * @param video {HTMLVideoElement} + * @param scaleMode {Integer} See {{#crossLink "PIXI/scaleModes:property"}}{{/crossLink}} for possible values * @returns {PIXI.Texture} */ PIXI.VideoTexture.textureFromVideo = function( video, scaleMode ) @@ -135,6 +149,15 @@ return new PIXI.Texture( baseTexture ); }; +/** + * Mimic Pixi BaseTexture.from.... method. + * + * @name fromUrl + * @static + * @param videoSrc {Url} + * @param scaleMode {Integer} See {{#crossLink "PIXI/scaleModes:property"}}{{/crossLink}} for possible values + * @returns {PIXI.Texture} + */ PIXI.VideoTexture.fromUrl = function( videoSrc, scaleMode ) { var video = document.createElement('video'); @@ -143,4 +166,3 @@ video.play(); return PIXI.VideoTexture.textureFromVideo( video, scaleMode); }; - diff --git a/src/pixi/utils/Detector.js b/src/pixi/utils/Detector.js index 33a97a9..fe38f04 100644 --- a/src/pixi/utils/Detector.js +++ b/src/pixi/utils/Detector.js @@ -6,7 +6,9 @@ * This helper function will automatically detect which renderer you should be using. * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by * the browser then this function will return a canvas renderer - * @class autoDetectRenderer + * + * @method autoDetectRenderer + * @for PIXI * @static * @param width=800 {Number} the width of the renderers view * @param height=600 {Number} the height of the renderers view @@ -47,7 +49,8 @@ * Even thought both android chrome supports webGL the canvas implementation perform better at the time of writing. * This function will likely change and update as webGL performance improves on these devices. * - * @class autoDetectRecommendedRenderer + * @method autoDetectRecommendedRenderer + * @for PIXI * @static * @param width=800 {Number} the width of the renderers view * @param height=600 {Number} the height of the renderers view