@pixi/canvas-renderer
Advanced tools
Comparing version 5.0.0-alpha.3 to 5.0.0-rc
/*! | ||
* @pixi/canvas-renderer - v5.0.0-alpha.3 | ||
* Compiled Tue, 03 Jul 2018 04:08:21 UTC | ||
* @pixi/canvas-renderer - v5.0.0-rc | ||
* Compiled Fri, 01 Feb 2019 04:50:10 UTC | ||
* | ||
@@ -8,7 +8,7 @@ * @pixi/canvas-renderer is licensed under the MIT License. | ||
*/ | ||
import { AbstractRenderer, BaseTexture, Renderer } from '@pixi/core'; | ||
import { CanvasRenderTarget, isWebGLSupported, sayHello } from '@pixi/utils'; | ||
import { AbstractRenderer, Renderer, BaseTexture } from '@pixi/core'; | ||
import { CanvasRenderTarget, sayHello, isWebGLSupported } from '@pixi/utils'; | ||
import { SHAPES } from '@pixi/math'; | ||
import { BLEND_MODES, RENDERER_TYPE, SCALE_MODES } from '@pixi/constants'; | ||
import { settings as settings$1 } from '@pixi/settings'; | ||
import { BLEND_MODES, SCALE_MODES, RENDERER_TYPE } from '@pixi/constants'; | ||
import { settings } from '@pixi/settings'; | ||
@@ -18,2 +18,4 @@ /** | ||
* | ||
* Sprite masking is not supported on the CanvasRenderer. | ||
* | ||
* @class | ||
@@ -70,3 +72,4 @@ * @memberof PIXI | ||
var context = this.renderer.context; | ||
var len = graphics.graphicsData.length; | ||
var graphicsData = graphics.geometry.graphicsData; | ||
var len = graphicsData.length; | ||
@@ -82,3 +85,3 @@ if (len === 0) | ||
{ | ||
var data = graphics.graphicsData[i]; | ||
var data = graphicsData[i]; | ||
var shape = data.shape; | ||
@@ -210,2 +213,3 @@ | ||
* | ||
* @private | ||
* @return {boolean} whether they are supported | ||
@@ -305,2 +309,14 @@ */ | ||
// composite operations | ||
array[BLEND_MODES.SRC_IN] = 'source-in'; | ||
array[BLEND_MODES.SRC_OUT] = 'source-out'; | ||
array[BLEND_MODES.SRC_ATOP] = 'source-atop'; | ||
array[BLEND_MODES.DST_OVER] = 'destination-over'; | ||
array[BLEND_MODES.DST_IN] = 'destination-in'; | ||
array[BLEND_MODES.DST_OUT] = 'destination-out'; | ||
array[BLEND_MODES.DST_ATOP] = 'destination-atop'; | ||
// SUBTRACT from flash, does not exist in canvas | ||
array[BLEND_MODES.SUBTRACT] = 'source-over'; | ||
return array; | ||
@@ -310,6 +326,7 @@ } | ||
/** | ||
* The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should | ||
* be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to | ||
* your DOM or you will not see anything :) | ||
* The CanvasRenderer draws the scene and all its content onto a 2d canvas. | ||
* | ||
* This renderer should be used for browsers that do not support WebGL. | ||
* Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! | ||
* | ||
* @class | ||
@@ -319,3 +336,3 @@ * @memberof PIXI | ||
*/ | ||
var CanvasRenderer = (function (AbstractRenderer$$1) { | ||
var CanvasRenderer = /*@__PURE__*/(function (AbstractRenderer$$1) { | ||
function CanvasRenderer(options, arg2, arg3) | ||
@@ -384,4 +401,10 @@ { | ||
/** | ||
* Tracks the blend modes useful for this renderer. | ||
* | ||
* @member {object<number, string>} | ||
*/ | ||
this.blendModes = mapCanvasBlendModesToPixi(); | ||
this._activeBlendMode = null; | ||
this._outerBlend = false; | ||
@@ -392,4 +415,2 @@ this.renderingToScreen = false; | ||
this.resize(this.options.width, this.options.height); | ||
/** | ||
@@ -406,2 +427,4 @@ * Fired after rendering finishes. | ||
*/ | ||
this.resize(this.options.width, this.options.height); | ||
} | ||
@@ -420,3 +443,3 @@ | ||
* @param {boolean} [clear=false] - Whether to clear the canvas before drawing | ||
* @param {PIXI.Transform} [transform] - A transformation to be applied | ||
* @param {PIXI.Matrix} [transform] - A transformation to be applied | ||
* @param {boolean} [skipUpdateTransform=false] - Whether to skip the update transform | ||
@@ -497,2 +520,3 @@ */ | ||
this._activeBlendMode = BLEND_MODES.NORMAL; | ||
this._outerBlend = false; | ||
context.globalCompositeOperation = this.blendModes[BLEND_MODES.NORMAL]; | ||
@@ -564,5 +588,17 @@ | ||
* @param {number} blendMode - See {@link PIXI.BLEND_MODES} for valid values. | ||
* @param {boolean} [readyForOuterBlend=false] - Some blendModes are dangerous, they affect outer space of sprite. | ||
* Pass `true` only if you are ready to use them. | ||
*/ | ||
CanvasRenderer.prototype.setBlendMode = function setBlendMode (blendMode) | ||
CanvasRenderer.prototype.setBlendMode = function setBlendMode (blendMode, readyForOuterBlend) | ||
{ | ||
var outerBlend = blendMode === BLEND_MODES.SRC_IN | ||
|| blendMode === BLEND_MODES.SRC_OUT | ||
|| blendMode === BLEND_MODES.DST_IN | ||
|| blendMode === BLEND_MODES.DST_ATOP; | ||
if (!readyForOuterBlend && outerBlend) | ||
{ | ||
blendMode = BLEND_MODES.NORMAL; | ||
} | ||
if (this._activeBlendMode === blendMode) | ||
@@ -574,2 +610,3 @@ { | ||
this._activeBlendMode = blendMode; | ||
this._outerBlend = outerBlend; | ||
this.context.globalCompositeOperation = this.blendModes[blendMode]; | ||
@@ -614,3 +651,3 @@ }; | ||
{ | ||
this.rootContext[this.smoothProperty] = (settings$1.SCALE_MODE === SCALE_MODES.LINEAR); | ||
this.rootContext[this.smoothProperty] = (settings.SCALE_MODE === SCALE_MODES.LINEAR); | ||
} | ||
@@ -656,6 +693,5 @@ }; | ||
// eslint-disable-next-line valid-jsdoc | ||
/** | ||
* 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 | ||
* 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 | ||
@@ -681,4 +717,2 @@ * | ||
* @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present | ||
* @param {boolean} [options.roundPixels=false] - If true PixiJS will Math.floor() x/y values when rendering, | ||
* stopping pixel interpolation. | ||
* @param {boolean} [options.forceFXAA=false] - forces FXAA antialiasing to be used over native. | ||
@@ -713,3 +747,3 @@ * FXAA is faster, but may not always look as great **webgl only** | ||
* @memberof PIXI.BaseTexture# | ||
* @return {CanvasImageSource} Source to render with CanvasRenderer | ||
* @return {ICanvasImageSource} Source to render with CanvasRenderer | ||
*/ | ||
@@ -716,0 +750,0 @@ BaseTexture.prototype.getDrawableSource = function getDrawableSource() |
/*! | ||
* @pixi/canvas-renderer - v5.0.0-alpha.3 | ||
* Compiled Tue, 03 Jul 2018 04:08:21 UTC | ||
* @pixi/canvas-renderer - v5.0.0-rc | ||
* Compiled Fri, 01 Feb 2019 04:50:10 UTC | ||
* | ||
@@ -21,2 +21,4 @@ * @pixi/canvas-renderer is licensed under the MIT License. | ||
* | ||
* Sprite masking is not supported on the CanvasRenderer. | ||
* | ||
* @class | ||
@@ -73,3 +75,4 @@ * @memberof PIXI | ||
var context = this.renderer.context; | ||
var len = graphics.graphicsData.length; | ||
var graphicsData = graphics.geometry.graphicsData; | ||
var len = graphicsData.length; | ||
@@ -85,3 +88,3 @@ if (len === 0) | ||
{ | ||
var data = graphics.graphicsData[i]; | ||
var data = graphicsData[i]; | ||
var shape = data.shape; | ||
@@ -213,2 +216,3 @@ | ||
* | ||
* @private | ||
* @return {boolean} whether they are supported | ||
@@ -308,2 +312,14 @@ */ | ||
// composite operations | ||
array[constants.BLEND_MODES.SRC_IN] = 'source-in'; | ||
array[constants.BLEND_MODES.SRC_OUT] = 'source-out'; | ||
array[constants.BLEND_MODES.SRC_ATOP] = 'source-atop'; | ||
array[constants.BLEND_MODES.DST_OVER] = 'destination-over'; | ||
array[constants.BLEND_MODES.DST_IN] = 'destination-in'; | ||
array[constants.BLEND_MODES.DST_OUT] = 'destination-out'; | ||
array[constants.BLEND_MODES.DST_ATOP] = 'destination-atop'; | ||
// SUBTRACT from flash, does not exist in canvas | ||
array[constants.BLEND_MODES.SUBTRACT] = 'source-over'; | ||
return array; | ||
@@ -313,6 +329,7 @@ } | ||
/** | ||
* The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should | ||
* be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to | ||
* your DOM or you will not see anything :) | ||
* The CanvasRenderer draws the scene and all its content onto a 2d canvas. | ||
* | ||
* This renderer should be used for browsers that do not support WebGL. | ||
* Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! | ||
* | ||
* @class | ||
@@ -322,6 +339,6 @@ * @memberof PIXI | ||
*/ | ||
var CanvasRenderer = (function (AbstractRenderer$$1) { | ||
var CanvasRenderer = /*@__PURE__*/(function (AbstractRenderer) { | ||
function CanvasRenderer(options, arg2, arg3) | ||
{ | ||
AbstractRenderer$$1.call(this, 'Canvas', options, arg2, arg3); | ||
AbstractRenderer.call(this, 'Canvas', options, arg2, arg3); | ||
@@ -387,4 +404,10 @@ this.type = constants.RENDERER_TYPE.CANVAS; | ||
/** | ||
* Tracks the blend modes useful for this renderer. | ||
* | ||
* @member {object<number, string>} | ||
*/ | ||
this.blendModes = mapCanvasBlendModesToPixi(); | ||
this._activeBlendMode = null; | ||
this._outerBlend = false; | ||
@@ -395,4 +418,2 @@ this.renderingToScreen = false; | ||
this.resize(this.options.width, this.options.height); | ||
/** | ||
@@ -409,6 +430,8 @@ * Fired after rendering finishes. | ||
*/ | ||
this.resize(this.options.width, this.options.height); | ||
} | ||
if ( AbstractRenderer$$1 ) CanvasRenderer.__proto__ = AbstractRenderer$$1; | ||
CanvasRenderer.prototype = Object.create( AbstractRenderer$$1 && AbstractRenderer$$1.prototype ); | ||
if ( AbstractRenderer ) CanvasRenderer.__proto__ = AbstractRenderer; | ||
CanvasRenderer.prototype = Object.create( AbstractRenderer && AbstractRenderer.prototype ); | ||
CanvasRenderer.prototype.constructor = CanvasRenderer; | ||
@@ -423,3 +446,3 @@ | ||
* @param {boolean} [clear=false] - Whether to clear the canvas before drawing | ||
* @param {PIXI.Transform} [transform] - A transformation to be applied | ||
* @param {PIXI.Matrix} [transform] - A transformation to be applied | ||
* @param {boolean} [skipUpdateTransform=false] - Whether to skip the update transform | ||
@@ -500,2 +523,3 @@ */ | ||
this._activeBlendMode = constants.BLEND_MODES.NORMAL; | ||
this._outerBlend = false; | ||
context.globalCompositeOperation = this.blendModes[constants.BLEND_MODES.NORMAL]; | ||
@@ -567,5 +591,17 @@ | ||
* @param {number} blendMode - See {@link PIXI.BLEND_MODES} for valid values. | ||
* @param {boolean} [readyForOuterBlend=false] - Some blendModes are dangerous, they affect outer space of sprite. | ||
* Pass `true` only if you are ready to use them. | ||
*/ | ||
CanvasRenderer.prototype.setBlendMode = function setBlendMode (blendMode) | ||
CanvasRenderer.prototype.setBlendMode = function setBlendMode (blendMode, readyForOuterBlend) | ||
{ | ||
var outerBlend = blendMode === constants.BLEND_MODES.SRC_IN | ||
|| blendMode === constants.BLEND_MODES.SRC_OUT | ||
|| blendMode === constants.BLEND_MODES.DST_IN | ||
|| blendMode === constants.BLEND_MODES.DST_ATOP; | ||
if (!readyForOuterBlend && outerBlend) | ||
{ | ||
blendMode = constants.BLEND_MODES.NORMAL; | ||
} | ||
if (this._activeBlendMode === blendMode) | ||
@@ -577,2 +613,3 @@ { | ||
this._activeBlendMode = blendMode; | ||
this._outerBlend = outerBlend; | ||
this.context.globalCompositeOperation = this.blendModes[blendMode]; | ||
@@ -589,3 +626,3 @@ }; | ||
// call the base destroy | ||
AbstractRenderer$$1.prototype.destroy.call(this, removeView); | ||
AbstractRenderer.prototype.destroy.call(this, removeView); | ||
@@ -612,3 +649,3 @@ this.context = null; | ||
{ | ||
AbstractRenderer$$1.prototype.resize.call(this, screenWidth, screenHeight); | ||
AbstractRenderer.prototype.resize.call(this, screenWidth, screenHeight); | ||
@@ -660,6 +697,5 @@ // reset the scale mode.. oddly this seems to be reset when the canvas is resized. | ||
// eslint-disable-next-line valid-jsdoc | ||
/** | ||
* 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 | ||
* 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 | ||
@@ -685,4 +721,2 @@ * | ||
* @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present | ||
* @param {boolean} [options.roundPixels=false] - If true PixiJS will Math.floor() x/y values when rendering, | ||
* stopping pixel interpolation. | ||
* @param {boolean} [options.forceFXAA=false] - forces FXAA antialiasing to be used over native. | ||
@@ -717,3 +751,3 @@ * FXAA is faster, but may not always look as great **webgl only** | ||
* @memberof PIXI.BaseTexture# | ||
* @return {CanvasImageSource} Source to render with CanvasRenderer | ||
* @return {ICanvasImageSource} Source to render with CanvasRenderer | ||
*/ | ||
@@ -720,0 +754,0 @@ core.BaseTexture.prototype.getDrawableSource = function getDrawableSource() |
{ | ||
"name": "@pixi/canvas-renderer", | ||
"version": "5.0.0-alpha.3", | ||
"version": "5.0.0-rc", | ||
"main": "lib/canvas-renderer.js", | ||
"module": "lib/canvas-renderer.es.js", | ||
"description": "PixiJS Application", | ||
"description": "Rendering using the Canvas API", | ||
"author": "Mat Groves", | ||
@@ -28,11 +28,12 @@ "contributors": [ | ||
"dependencies": { | ||
"@pixi/constants": "^5.0.0-alpha.3", | ||
"@pixi/core": "^5.0.0-alpha.3", | ||
"@pixi/math": "^5.0.0-alpha.3", | ||
"@pixi/settings": "^5.0.0-alpha.3", | ||
"@pixi/utils": "^5.0.0-alpha.3" | ||
"@pixi/constants": "^5.0.0-rc", | ||
"@pixi/core": "^5.0.0-rc", | ||
"@pixi/math": "^5.0.0-rc", | ||
"@pixi/settings": "^5.0.0-rc", | ||
"@pixi/utils": "^5.0.0-rc" | ||
}, | ||
"devDependencies": { | ||
"floss": "^2.1.3" | ||
} | ||
"floss": "^2.1.5" | ||
}, | ||
"gitHead": "9026a1bbca9a9d86b7a3b6d5eb4fa2c3145c2b85" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133798
1268
Updated@pixi/constants@^5.0.0-rc
Updated@pixi/core@^5.0.0-rc
Updated@pixi/math@^5.0.0-rc
Updated@pixi/settings@^5.0.0-rc
Updated@pixi/utils@^5.0.0-rc