Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// xy
vertexData[2] = (a * w0) + (c * h1) + tx;
vertexData[3] = (d * h1) + (b * w0) + ty;
// xy
vertexData[4] = (a * w0) + (c * h0) + tx;
vertexData[5] = (d * h0) + (b * w0) + ty;
// xy
vertexData[6] = (a * w1) + (c * h0) + tx;
vertexData[7] = (d * h0) + (b * w1) + ty;
if (this._roundPixels)
{
const resolution = settings.RESOLUTION;
for (let i = 0; i < vertexData.length; ++i)
{
vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);
}
}
}
this.screen = new Rectangle(0, 0, options.width, options.height);
/**
* The canvas element that everything is drawn to.
*
* @member {HTMLCanvasElement}
*/
this.view = options.view || document.createElement('canvas');
/**
* The resolution / device pixel ratio of the renderer.
*
* @member {number}
* @default 1
*/
this.resolution = options.resolution || settings.RESOLUTION;
/**
* Whether the render view is transparent.
*
* @member {boolean}
*/
this.transparent = options.transparent;
/**
* Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.
*
* @member {boolean}
*/
this.autoDensity = options.autoDensity || options.autoResize || false;
// autoResize is deprecated, provides fallback support
*/
this.canvas = canvas;
/**
* The canvas 2d context that everything is drawn with
* @member {CanvasRenderingContext2D}
*/
this.context = this.canvas.getContext('2d');
/**
* The resolution / device pixel ratio of the canvas.
* This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.
* @member {number}
* @default 1
*/
this._resolution = settings.RESOLUTION;
this._autoResolution = true;
/**
* Private tracker for the current text.
*
* @member {string}
* @private
*/
this._text = null;
/**
* Private tracker for the current style.
*
* @member {object}
* @private
*/
{
/**
* The Canvas object that belongs to this CanvasRenderTarget.
*
* @member {HTMLCanvasElement}
*/
this.canvas = document.createElement('canvas');
/**
* A CanvasRenderingContext2D object representing a two-dimensional rendering context.
*
* @member {CanvasRenderingContext2D}
*/
this.context = this.canvas.getContext('2d');
this.resolution = resolution || settings.RESOLUTION;
this.resize(width, height);
}
if (arguments[4] !== undefined) {
options.alpha = arguments[4];
}
}
options = Object.assign({
rotation: 45,
distance: 5,
color: 0x000000,
alpha: 0.5,
shadowOnly: false,
kernels: null,
blur: 2,
quality: 3,
pixelSize: 1,
resolution: settings.RESOLUTION,
}, options);
super();
const { kernels, blur, quality, pixelSize, resolution } = options;
this._tintFilter = new Filter(vertex, fragment);
this._tintFilter.uniforms.color = new Float32Array(4);
this._tintFilter.uniforms.shift = new Point();
this._tintFilter.resolution = resolution;
this._blurFilter = kernels ?
new KawaseBlurFilter(kernels) :
new KawaseBlurFilter(blur, quality);
this.pixelSize = pixelSize;
this.resolution = resolution;
constructor(strength, quality, resolution, kernelSize)
{
super();
this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize);
this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize);
this.resolution = resolution || settings.RESOLUTION;
this.quality = quality || 4;
this.blur = strength || 8;
this.repeatEdgePixels = false;
}
/**
* The height of the base texture set when the image has loaded
*
* @readonly
* @member {number}
*/
this.height = height || 0;
/**
* The resolution / device pixel ratio of the texture
*
* @member {number}
* @default PIXI.settings.RESOLUTION
*/
this.resolution = resolution || settings.RESOLUTION;
/**
* Mipmap mode of the texture, affects downscaled images
*
* @member {PIXI.MIPMAP_MODES}
* @default PIXI.settings.MIPMAP_TEXTURES
*/
this.mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;
/**
* Anisotropic filtering level of texture
*
* @member {number}
* @default PIXI.settings.ANISOTROPIC_LEVEL
*/
this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;
* @member {HTMLCanvasElement}
*/
this.canvas = canvas;
/**
* The canvas 2d context that everything is drawn with
* @member {CanvasRenderingContext2D}
*/
this.context = this.canvas.getContext('2d');
/**
* The resolution / device pixel ratio of the canvas. This is set automatically by the renderer.
* @member {number}
* @default 1
*/
this.resolution = settings.RESOLUTION;
/**
* Private tracker for the current text.
*
* @member {string}
* @private
*/
this._text = null;
/**
* Private tracker for the current style.
*
* @member {object}
* @private
*/
this._style = null;
constructor(blur = 2, quality = 4, resolution = settings.RESOLUTION, kernelSize = 5) {
super();
let blurX;
let blurY;
if (typeof blur === 'number') {
blurX = blur;
blurY = blur;
}
else if (blur instanceof Point) {
blurX = blur.x;
blurY = blur.y;
}
else if (Array.isArray(blur)) {
blurX = blur[0];
blurY = blur[1];
this.clearColor = [0, 0, 0, 0];
/**
* The size of the object as a rectangle
*
* @member {PIXI.Rectangle}
*/
this.size = new Rectangle(0, 0, 1, 1);
/**
* The current resolution / device pixel ratio
*
* @member {number}
* @default 1
*/
this.resolution = resolution || settings.RESOLUTION;
/**
* The projection matrix
*
* @member {PIXI.Matrix}
*/
this.projectionMatrix = new Matrix();
/**
* The object's transform
*
* @member {PIXI.Matrix}
*/
this.transform = null;
/**