Socket
Socket
Sign inDemoInstall

@pixi/core

Package Overview
Dependencies
Maintainers
2
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/core - npm Package Compare versions

Comparing version 7.1.2 to 7.2.0-beta

29

global.d.ts

@@ -53,31 +53,32 @@ declare namespace GlobalMixins

{
/** @deprecated */
/** @deprecated since 7.1.0 */
FILTER_RESOLUTION: number;
/** @deprecated */
/** @deprecated since 7.1.0 */
FILTER_MULTISAMPLE: import('@pixi/constants').MSAA_QUALITY;
/** @deprecated */
/** @deprecated since 7.1.0 */
SPRITE_MAX_TEXTURES: number;
/** @deprecated */
/** @deprecated since 7.1.0 */
SPRITE_BATCH_SIZE: number;
/** @deprecated */
/** @deprecated since 7.1.0 */
MIPMAP_TEXTURES: import('@pixi/constants').MIPMAP_MODES;
/** @deprecated */
/** @deprecated since 7.1.0 */
ANISOTROPIC_LEVEL: number;
/** @deprecated */
/** @deprecated since 7.1.0 */
WRAP_MODE: import('@pixi/constants').WRAP_MODES;
/** @deprecated */
/** @deprecated since 7.1.0 */
SCALE_MODE: import('@pixi/constants').SCALE_MODES;
/** @deprecated */
/** @deprecated since 7.1.0 */
CAN_UPLOAD_SAME_BUFFER: boolean;
/** @deprecated */
/** @deprecated since 7.1.0 */
PRECISION_VERTEX: import('@pixi/constants').PRECISION,
/** @deprecated */
/** @deprecated since 7.1.0 */
PRECISION_FRAGMENT: import('@pixi/constants').PRECISION,
/** @deprecated */
/** @deprecated since 7.1.0 */
GC_MODE: import('@pixi/constants').GC_MODES,
/** @deprecated */
/** @deprecated since 7.1.0 */
GC_MAX_IDLE: number,
/** @deprecated */
/** @deprecated since 7.1.0 */
GC_MAX_CHECK_COUNT: number,
RENDER_OPTIONS: import('@pixi/core').IRendererOptions;
STRICT_TEXTURE_CACHE: boolean;

@@ -84,0 +85,0 @@ PREFER_ENV: import('@pixi/constants').ENV;

@@ -8,7 +8,11 @@ import type { ICanvas } from '@pixi/settings';

export interface IRendererOptionsAuto extends IRendererOptions {
/**
* Force CanvasRenderer even if WebGL is supported. Only available with **pixi.js-legacy**.
* @default false
*/
forceCanvas?: boolean;
}
export interface IRendererConstructor<VIEW extends ICanvas = ICanvas> {
test(options?: IRendererOptionsAuto): boolean;
new (options?: IRendererOptionsAuto): IRenderer<VIEW>;
test(options?: Partial<IRendererOptionsAuto>): boolean;
new (options?: Partial<IRendererOptionsAuto>): IRenderer<VIEW>;
}

@@ -21,44 +25,4 @@ /**

* @function autoDetectRenderer
* @param {PIXI.IRendererOptionsAuto} [options] - The optional renderer parameters.
* @param {boolean} [options.antialias=false] -
* **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.
* @param {boolean} [options.autoDensity=false] -
* Whether the CSS dimensions of the renderer's view should be resized automatically.
* @param {number|string} [options.background] - Alias for `options.backgroundColor`.
* @param {number} [options.backgroundAlpha=1] -
* Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).
* @param {number|string} [options.backgroundColor=0x000000] -
* The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`),
* hex strings (e.g. `'#f00'` or `'#ff0000'`) or color names (e.g. `'red'`).
* @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.
* @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.
* @param {boolean} [options.forceCanvas=false] -
* Force using {@link PIXI.CanvasRenderer}, even if WebGL is available. This option only is available when
* using **pixi.js-legacy** or **@pixi/canvas-renderer** packages, otherwise it will throw an error.
* @param {number} [options.height=600] - The height of the renderer's view.
* @param {boolean} [options.hello=false] - Whether to log the version and type information of renderer to console.
* @param {string} [options.powerPreference] -
* **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,
* can be `'default'`, `'high-performance'` or `'low-power'`.
* Setting to `'high-performance'` will prioritize rendering performance over power consumption,
* while setting to `'low-power'` will prioritize power saving over rendering performance.
* @param {boolean} [options.premultipliedAlpha=true] -
* **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.
* @param {boolean} [options.preserveDrawingBuffer=false] -
* **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve
* its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.
* @param {number} [options.resolution=PIXI.settings.RESOLUTION] -
* The resolution / device pixel ratio of the renderer.
* @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -
* **Deprecated since 7.0.0, use `premultipliedAlpha` and `backgroundAlpha` instead.** \
* Pass-through value for canvas' context attribute `alpha`. This option is for cases where the
* canvas needs to be opaque, possibly for performance reasons on some older devices.
* If you want to set transparency, please use `backgroundAlpha`. \
* **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be
* set to `true` and `premultipliedAlpha` will be to `false`.
* @param {PIXI.ICanvas} [options.view=null] -
* The canvas to use as the view. If omitted, a new canvas will be created.
* @param {number} [options.width=800] - The width of the renderer's view.
* @returns Returns {@link PIXI.Renderer} if WebGL is available, otherwise {@link PIXI.CanvasRenderer}.
* @param options - Options to use.
*/
export declare function autoDetectRenderer<VIEW extends ICanvas = ICanvas>(options?: IRendererOptionsAuto): IRenderer<VIEW>;
export declare function autoDetectRenderer<VIEW extends ICanvas = ICanvas>(options?: Partial<IRendererOptionsAuto>): IRenderer<VIEW>;

@@ -0,9 +1,25 @@

import { Color } from '@pixi/color';
import type { ColorSource } from '@pixi/color';
import type { ExtensionMetadata } from '@pixi/extensions';
import type { ISystem } from '../system/ISystem';
export interface BackgroundOptions {
/** the main canvas background alpha. From 0 (fully transparent) to 1 (fully opaque). */
alpha: number;
/** the main canvas background color. */
color: number | string;
/** sets if the renderer will clear the canvas or not before the new render pass. */
export interface BackgroundSytemOptions {
/**
* The background color used to clear the canvas. See {@link PIXI.ColorSource} for accepted color values.
* @memberof PIXI.IRendererOptions
*/
backgroundColor: ColorSource;
/**
* Alias for {@link PIXI.IRendererOptions.backgroundColor}
* @memberof PIXI.IRendererOptions
*/
background?: ColorSource;
/**
* Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).
* @memberof PIXI.IRendererOptions
*/
backgroundAlpha: number;
/**
* Whether to clear the canvas before new render passes.
* @memberof PIXI.IRendererOptions
*/
clearBeforeRender: boolean;

@@ -15,3 +31,4 @@ }

*/
export declare class BackgroundSystem implements ISystem<BackgroundOptions> {
export declare class BackgroundSystem implements ISystem<BackgroundSytemOptions> {
static defaultOptions: BackgroundSytemOptions;
/** @ignore */

@@ -29,4 +46,3 @@ static extension: ExtensionMetadata;

clearBeforeRender: boolean;
private _backgroundColorString;
private _backgroundColorRgba;
/** Reference to the internal color */
private _backgroundColor;

@@ -36,11 +52,11 @@ constructor();

* initiates the background system
* @param {BackgroundOptions} options - the options for the background colors
* @param {PIXI.IRendererOptions} options - the options for the background colors
*/
init(options: BackgroundOptions): void;
init(options: BackgroundSytemOptions): void;
/**
* The background color to fill if not transparent
* @member {number}
* The background color to fill if not transparent.
* @member {PIXI.ColorSource}
*/
get color(): number;
set color(value: number);
get color(): ColorSource;
set color(value: ColorSource);
/**

@@ -52,15 +68,5 @@ * The background color alpha. Setting this to 0 will make the canvas transparent.

set alpha(value: number);
/**
* The background color as an [R, G, B, A] array.
* @member {number[]}
* @protected
*/
get colorRgba(): number[];
/**
* The background color as a string.
* @member {string}
* @protected
*/
get colorString(): string;
/** The background color object. */
get backgroundColor(): Color;
destroy(): void;
}

@@ -5,4 +5,4 @@ 'use strict';

var color = require('@pixi/color');
var extensions = require('@pixi/extensions');
var utils = require('@pixi/utils');

@@ -12,6 +12,3 @@ class BackgroundSystem {

this.clearBeforeRender = true;
this._backgroundColor = 0;
this._backgroundColorRgba = [0, 0, 0, 1];
this._backgroundColorString = "#000000";
this.color = this._backgroundColor;
this._backgroundColor = new color.Color(0);
this.alpha = 1;

@@ -21,30 +18,32 @@ }

this.clearBeforeRender = options.clearBeforeRender;
if (options.color) {
this.color = typeof options.color === "string" ? utils.string2hex(options.color) : options.color;
const { backgroundColor, background, backgroundAlpha } = options;
const color = background ?? backgroundColor;
if (color !== void 0) {
this.color = color;
}
this.alpha = options.alpha;
this.alpha = backgroundAlpha;
}
get color() {
return this._backgroundColor;
return this._backgroundColor.value;
}
set color(value) {
this._backgroundColor = value;
this._backgroundColorString = utils.hex2string(value);
utils.hex2rgb(value, this._backgroundColorRgba);
this._backgroundColor.setValue(value);
}
get alpha() {
return this._backgroundColorRgba[3];
return this._backgroundColor.alpha;
}
set alpha(value) {
this._backgroundColorRgba[3] = value;
this._backgroundColor.setAlpha(value);
}
get colorRgba() {
return this._backgroundColorRgba;
get backgroundColor() {
return this._backgroundColor;
}
get colorString() {
return this._backgroundColorString;
}
destroy() {
}
}
BackgroundSystem.defaultOptions = {
backgroundAlpha: 1,
backgroundColor: 0,
clearBeforeRender: true
};
BackgroundSystem.extension = {

@@ -51,0 +50,0 @@ type: [

@@ -5,2 +5,3 @@ 'use strict';

var color = require('@pixi/color');
var constants = require('@pixi/constants');

@@ -338,3 +339,3 @@ var extensions = require('@pixi/extensions');

const alpha = Math.min(element.worldAlpha, 1);
const argb = alpha < 1 && element._texture.baseTexture.alphaMode ? utils.premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24);
const argb = color.Color.shared.setValue(element._tintRGB).toPremultiplied(alpha);
for (let i = 0; i < vertexData.length; i += 2) {

@@ -341,0 +342,0 @@ float32View[aIndex++] = vertexData[i];

@@ -7,17 +7,49 @@ import type { ExtensionMetadata } from '@pixi/extensions';

import type { WebGLExtensions } from './WebGLExtensions';
export interface ISupportDict {
uint32Indices: boolean;
}
export interface ContextOptions {
context?: IRenderingContext;
export interface ContextSystemOptions {
/**
* Use premultipliedAlpha instead
* **Deprecated since 7.0.0, use `premultipliedAlpha` and `backgroundAlpha` instead.**
*
* Pass-through value for canvas' context attribute `alpha`. This option is for cases where the
* canvas needs to be opaque, possibly for performance reasons on some older devices.
* If you want to set transparency, please use `backgroundAlpha`.
*
* **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be
* set to `true` and `premultipliedAlpha` will be to `false`.
* @deprecated since 7.0.0
* @memberof PIXI.IRendererOptions
*/
useContextAlpha?: boolean | 'notMultiplied';
premultipliedAlpha?: boolean;
powerPreference?: WebGLPowerPreference;
preserveDrawingBuffer?: boolean;
antialias?: boolean;
/**
* **WebGL Only.** User-provided WebGL rendering context object.
* @memberof PIXI.IRendererOptions
*/
context: IRenderingContext | null;
/**
* **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.
* @memberof PIXI.IRendererOptions
*/
antialias: boolean;
/**
* **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,
* can be `'default'`, `'high-performance'` or `'low-power'`.
* Setting to `'high-performance'` will prioritize rendering performance over power consumption,
* while setting to `'low-power'` will prioritize power saving over rendering performance.
* @memberof PIXI.IRendererOptions
*/
powerPreference: WebGLPowerPreference;
/**
* **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.
* @memberof PIXI.IRendererOptions
*/
premultipliedAlpha: boolean;
/**
* **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve
* its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.
* @memberof PIXI.IRendererOptions
*/
preserveDrawingBuffer: boolean;
}
export interface ISupportDict {
uint32Indices: boolean;
}
/**

@@ -27,4 +59,6 @@ * System plugin to the renderer to manage the context.

*/
export declare class ContextSystem implements ISystem<ContextOptions> {
export declare class ContextSystem implements ISystem<ContextSystemOptions> {
/** @ignore */
static defaultOptions: ContextSystemOptions;
/** @ignore */
static extension: ExtensionMetadata;

@@ -79,3 +113,3 @@ /**

protected contextChange(gl: IRenderingContext): void;
init(options: ContextOptions): void;
init(options: ContextSystemOptions): void;
/**

@@ -82,0 +116,0 @@ * Initializes the context.

@@ -157,2 +157,9 @@ 'use strict';

}
ContextSystem.defaultOptions = {
context: null,
antialias: false,
premultipliedAlpha: true,
preserveDrawingBuffer: false,
powerPreference: "default"
};
ContextSystem.extension = {

@@ -159,0 +166,0 @@ type: extensions.ExtensionType.RendererSystem,

@@ -106,3 +106,3 @@ import { CLEAR_MODES, MSAA_QUALITY } from '@pixi/constants';

*
* This should be called only by {@link Filter#apply}.
* This should be called only by {@link PIXI.Filter#apply}.
* @param filter - The filter to draw.

@@ -109,0 +109,0 @@ * @param input - The input render target.

@@ -5,5 +5,6 @@ import { BUFFER_TYPE } from '@pixi/constants';

/**
* Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer
* Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer.
*
* Same as ArrayBuffer in typescript lib, defined here just for documentation
* Same as ArrayBuffer in typescript lib, defined here just for documentation.
* @memberof PIXI
*/

@@ -16,4 +17,5 @@ export interface IArrayBuffer extends ArrayBuffer {

*
* Gives access to indexing and `length` field
* Gives access to indexing and `length` field.
* - @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)
* @memberof PIXI
*/

@@ -20,0 +22,0 @@ export interface ITypedArray extends IArrayBuffer {

@@ -64,3 +64,3 @@ import { Runner } from '@pixi/runner';

* @param normalized - should the data be normalized.
* @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available
* @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available
* @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)

@@ -67,0 +67,0 @@ * @param [start=0] - How far into the array to start reading values (used for interleaving data)

@@ -11,2 +11,3 @@ /// <reference path="../global.d.ts" />

export declare const VERSION = "$_VERSION";
export * from '@pixi/color';
export * from '@pixi/constants';

@@ -13,0 +14,0 @@ export * from '@pixi/extensions';

@@ -6,2 +6,3 @@ 'use strict';

require('./settings.js');
var color = require('@pixi/color');
var constants = require('@pixi/constants');

@@ -117,3 +118,3 @@ var extensions = require('@pixi/extensions');

const VERSION = "7.1.2";
const VERSION = "7.2.0-beta";

@@ -204,2 +205,8 @@ exports.utils = utils__namespace;

exports.VERSION = VERSION;
Object.keys(color).forEach(function (k) {
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function () { return color[k]; }
});
});
Object.keys(constants).forEach(function (k) {

@@ -206,0 +213,0 @@ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {

@@ -8,2 +8,3 @@ import type { RENDERER_TYPE } from '@pixi/constants';

import type { SystemManager } from './system/SystemManager';
import type { BackgroundSytemOptions, ContextSystemOptions, StartupSystemOptions, ViewSystemOptions } from './systems';
import type { ImageSource } from './textures/BaseTexture';

@@ -61,87 +62,9 @@ /**

*/
export interface IRendererOptions extends GlobalMixins.IRendererOptions {
/** The canvas to use as the view. If omitted, a new canvas will be created. */
view?: ICanvas;
/**
* The width of the renderer's view.
* @default 800
*/
width?: number;
/**
* The height of the renderer's view.
* @default 600
*/
height?: number;
/**
* The resolution / device pixel ratio of the renderer.
* @default PIXI.settings.RESOLUTION
*/
resolution?: number;
/**
* Whether the CSS dimensions of the renderer's view should be resized automatically.
* @default false
*/
autoDensity?: boolean;
/**
* The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`),
* hex strings (e.g. `'#f00'` or `'#ff0000'`) or color names (e.g. `'red'`).
* @default 0x000000
*/
backgroundColor?: number | string;
/** Alias for `backgroundColor`. */
background?: number | string;
/**
* Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).
* @default 1
*/
backgroundAlpha?: number;
/**
* **Deprecated since 7.0.0, use `premultipliedAlpha` and `backgroundAlpha` instead.**
*
* Pass-through value for canvas' context attribute `alpha`. This option is for cases where the
* canvas needs to be opaque, possibly for performance reasons on some older devices.
* If you want to set transparency, please use `backgroundAlpha`.
*
* **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be
* set to `true` and `premultipliedAlpha` will be to `false`.
* @default true
* @deprecated since 7.0.0
*/
useContextAlpha?: boolean | 'notMultiplied';
/**
* Whether to clear the canvas before new render passes.
* @default true
*/
clearBeforeRender?: boolean;
/** **WebGL Only.** User-provided WebGL rendering context object. */
context?: IRenderingContext;
/**
* **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.
* @default false
*/
antialias?: boolean;
/**
* **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,
* can be `'default'`, `'high-performance'` or `'low-power'`.
* Setting to `'high-performance'` will prioritize rendering performance over power consumption,
* while setting to `'low-power'` will prioritize power saving over rendering performance.
*/
powerPreference?: WebGLPowerPreference;
/**
* **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.
* @default true
*/
premultipliedAlpha?: boolean;
/**
* **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve
* its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.
* @default false
*/
preserveDrawingBuffer?: boolean;
/**
* Whether to log the version and type information of renderer to console.
* @default false
*/
hello?: boolean;
export interface IRendererOptions extends GlobalMixins.IRendererOptions, BackgroundSytemOptions, ContextSystemOptions, ViewSystemOptions, StartupSystemOptions {
}
/**
* @deprecated since 7.2.0
* @see PIXI.IRendererOptions
*/
export declare type IRenderOptions = IRendererOptions;
export interface IRendererRenderOptions {

@@ -148,0 +71,0 @@ renderTexture?: RenderTexture;

@@ -36,3 +36,3 @@ import { MASK_TYPES } from '@pixi/constants';

pooled: boolean;
/** Indicator of the type (always true for {@link MaskData} objects) */
/** Indicator of the type (always true for {@link PIXI.MaskData} objects) */
isMaskData: boolean;

@@ -39,0 +39,0 @@ /**

@@ -11,5 +11,7 @@ import type { ExtensionMetadata } from '@pixi/extensions';

*/
export declare class PluginSystem implements ISystem<IRendererPlugins> {
export declare class PluginSystem implements ISystem {
/** @ignore */
static extension: ExtensionMetadata;
/** @ignore */
rendererPlugins: IRendererPlugins;
/**

@@ -26,6 +28,5 @@ * Collection of plugins.

* @protected
* @param {object} staticMap - The dictionary of statically saved plugins.
*/
init(staticMap: IRendererPlugins): void;
init(): void;
destroy(): void;
}

@@ -36,3 +36,4 @@ 'use strict';

}
init(staticMap) {
init() {
const staticMap = this.rendererPlugins;
for (const o in staticMap) {

@@ -39,0 +40,0 @@ this.plugins[o] = new staticMap[o](this.renderer);

@@ -76,3 +76,4 @@ import { Matrix } from '@pixi/math';

*
* NOTE-2: {@link RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture. It is expected
* NOTE-2: {@link PIXI.RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture.
* It is expected
* that you dirty the current bindings when calling this manually.

@@ -79,0 +80,0 @@ * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas,

import { UniformGroup } from './shader/UniformGroup';
import { SystemManager } from './system/SystemManager';
import type { ColorSource } from '@pixi/color';
import type { MSAA_QUALITY, RENDERER_TYPE } from '@pixi/constants';

@@ -69,3 +70,2 @@ import type { ExtensionMetadata } from '@pixi/extensions';

* | ------------------------------------ | ----------------------------------------------------------------------------- |
* | {@link PIXI.RenderSystem} | This adds the ability to render a PIXI.DisplayObject |
* | {@link PIXI.GenerateTextureSystem} | This adds the ability to generate textures from any PIXI.DisplayObject |

@@ -75,4 +75,4 @@ * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. |

* | {@link PIXI.MaskSystem} | This manages masking operations. |
* | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link MaskSystem} |
* | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link MaskSystem} |
* | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link PIXI.MaskSystem} |
* | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link PIXI.MaskSystem} |
* | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. |

@@ -238,43 +238,7 @@ * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. |

*/
static test(options?: IRendererOptions): boolean;
static test(options?: Partial<IRendererOptions>): boolean;
/**
* @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.
* @param {boolean} [options.antialias=false] -
* **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.
* @param {boolean} [options.autoDensity=false] -
* Whether the CSS dimensions of the renderer's view should be resized automatically.
* @param {number|string} [options.background] - Alias for `options.backgroundColor`.
* @param {number} [options.backgroundAlpha=1] -
* Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).
* @param {number|string} [options.backgroundColor=0x000000] -
* The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`),
* hex strings (e.g. `'#f00'` or `'#ff0000'`) or color names (e.g. `'red'`).
* @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.
* @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.
* @param {number} [options.height=600] - The height of the renderer's view.
* @param {boolean} [options.hello=false] - Whether to log the version and type information of renderer to console.
* @param {string} [options.powerPreference] -
* **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,
* can be `'default'`, `'high-performance'` or `'low-power'`.
* Setting to `'high-performance'` will prioritize rendering performance over power consumption,
* while setting to `'low-power'` will prioritize power saving over rendering performance.
* @param {boolean} [options.premultipliedAlpha=true] -
* **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.
* @param {boolean} [options.preserveDrawingBuffer=false] -
* **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve
* its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.
* @param {number} [options.resolution=PIXI.settings.RESOLUTION] -
* The resolution / device pixel ratio of the renderer.
* @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -
* **Deprecated since 7.0.0, use `premultipliedAlpha` and `backgroundAlpha` instead.** \
* Pass-through value for canvas' context attribute `alpha`. This option is for cases where the
* canvas needs to be opaque, possibly for performance reasons on some older devices.
* If you want to set transparency, please use `backgroundAlpha`. \
* **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be
* set to `true` and `premultipliedAlpha` will be to `false`.
* @param {PIXI.ICanvas} [options.view=null] -
* The canvas to use as the view. If omitted, a new canvas will be created.
* @param {number} [options.width=800] - The width of the renderer's view.
* @param {PIXI.IRendererOptions} [options] - See {@link PIXI.settings.RENDER_OPTIONS} for defaults.
*/
constructor(options?: IRendererOptions);
constructor(options?: Partial<IRendererOptions>);
/**

@@ -368,4 +332,4 @@ * Renders the object to its WebGL view.

*/
get backgroundColor(): number;
set backgroundColor(value: number);
get backgroundColor(): ColorSource;
set backgroundColor(value: ColorSource);
/**

@@ -372,0 +336,0 @@ * The background color alpha. Setting this to 0 will make the canvas transparent.

@@ -65,27 +65,5 @@ 'use strict';

}
const startupOptions = {
hello: options.hello,
_plugin: _Renderer.__plugins,
background: {
alpha: options.backgroundAlpha,
color: options.background ?? options.backgroundColor,
clearBeforeRender: options.clearBeforeRender
},
_view: {
height: options.height,
width: options.width,
autoDensity: options.autoDensity,
resolution: options.resolution,
view: options.view
},
context: {
antialias: options.antialias,
context: options.context,
powerPreference: options.powerPreference,
premultipliedAlpha: options.premultipliedAlpha,
preserveDrawingBuffer: options.preserveDrawingBuffer
}
};
this._plugin.rendererPlugins = _Renderer.__plugins;
this.options = options;
this.startup.run(startupOptions);
this.startup.run(this.options);
}

@@ -178,3 +156,3 @@ static test(options) {

utils.deprecation("7.0.0", "renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead.");
return this.background.color;
return this.background.alpha;
}

@@ -181,0 +159,0 @@ set backgroundAlpha(value) {

@@ -0,3 +1,5 @@

import { Color } from '@pixi/color';
import { Framebuffer } from '../framebuffer/Framebuffer';
import { BaseTexture } from '../textures/BaseTexture';
import type { ColorSource } from '@pixi/color';
import type { MaskData } from '../mask/MaskData';

@@ -41,3 +43,3 @@ import type { IBaseTextureOptions } from '../textures/BaseTexture';

export declare class BaseRenderTexture extends BaseTexture {
clearColor: number[];
_clear: Color;
framebuffer: Framebuffer;

@@ -59,3 +61,12 @@ /** The data structure for the stencil masks. */

constructor(options?: IBaseTextureOptions);
/** Color when clearning the texture. */
set clearColor(value: ColorSource);
get clearColor(): ColorSource;
/**
* Color object when clearning the texture.
* @readonly
* @since 7.2.0
*/
get clear(): Color;
/**
* Resizes the BaseRenderTexture.

@@ -62,0 +73,0 @@ * @param desiredWidth - The desired width to resize to.

@@ -5,2 +5,3 @@ 'use strict';

var color = require('@pixi/color');
var constants = require('@pixi/constants');

@@ -25,3 +26,3 @@ var Framebuffer = require('../framebuffer/Framebuffer.js');

this.valid = true;
this.clearColor = [0, 0, 0, 0];
this._clear = new color.Color([0, 0, 0, 0]);
this.framebuffer = new Framebuffer.Framebuffer(this.realWidth, this.realHeight).addColorTexture(0, this);

@@ -32,2 +33,11 @@ this.framebuffer.multisample = options.multisample;

}
set clearColor(value) {
this._clear.setValue(value);
}
get clearColor() {
return this._clear.value;
}
get clear() {
return this._clear;
}
resize(desiredWidth, desiredHeight) {

@@ -34,0 +44,0 @@ this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution);

import { Rectangle } from '@pixi/math';
import type { ColorSource } from '@pixi/color';
import type { BUFFER_BITS } from '@pixi/constants';

@@ -47,3 +48,3 @@ import type { ExtensionMetadata } from '@pixi/extensions';

*
* See {@link PIXI.Projection#destinationFrame} for more details.
* See {@link PIXI.ProjectionSystem#destinationFrame} for more details.
*/

@@ -75,3 +76,3 @@ readonly destinationFrame: Rectangle;

*/
clear(clearColor?: number[], mask?: BUFFER_BITS): void;
clear(clearColor?: ColorSource, mask?: BUFFER_BITS): void;
resize(): void;

@@ -78,0 +79,0 @@ /** Resets render-texture state. */

@@ -5,2 +5,3 @@ 'use strict';

var color = require('@pixi/color');
var extensions = require('@pixi/extensions');

@@ -75,7 +76,4 @@ var math = require('@pixi/math');

clear(clearColor, mask) {
if (this.current) {
clearColor = clearColor || this.current.baseTexture.clearColor;
} else {
clearColor = clearColor || this.renderer.background.colorRgba;
}
const fallbackColor = this.current ? this.current.baseTexture.clear : this.renderer.background.backgroundColor;
const color$1 = clearColor ? color.Color.shared.setValue(clearColor) : fallbackColor;
const destinationFrame = this.destinationFrame;

@@ -93,3 +91,3 @@ const baseFrame = this.current ? this.current.baseTexture : this.renderer._view.screen;

}
this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);
this.renderer.framebuffer.clear(color$1.red, color$1.green, color$1.blue, color$1.alpha, mask);
if (clearMask) {

@@ -96,0 +94,0 @@ this.renderer.scissor.pop();

@@ -11,2 +11,6 @@ 'use strict';

var BaseTexture = require('./textures/BaseTexture.js');
var ContextSystem = require('./context/ContextSystem.js');
var BackgroundSystem = require('./background/BackgroundSystem.js');
var ViewSystem = require('./view/ViewSystem.js');
var StartupSystem = require('./startup/StartupSystem.js');
var TextureGCSystem = require('./textures/TextureGCSystem.js');

@@ -16,2 +20,8 @@

settings.settings.STRICT_TEXTURE_CACHE = false;
settings.settings.RENDER_OPTIONS = {
...ContextSystem.ContextSystem.defaultOptions,
...BackgroundSystem.BackgroundSystem.defaultOptions,
...ViewSystem.ViewSystem.defaultOptions,
...StartupSystem.StartupSystem.defaultOptions
};
Object.defineProperties(settings.settings, {

@@ -18,0 +28,0 @@ WRAP_MODE: {

@@ -107,2 +107,47 @@ 'use strict';

{
test: (data, uniform) => data.type === "vec4" && data.size === 1 && !data.isArray && uniform.red !== void 0,
code: (name) => `
cv = ud["${name}"].value;
v = uv["${name}"];
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
{
cv[0] = v.red;
cv[1] = v.green;
cv[2] = v.blue;
cv[3] = v.alpha;
gl.uniform4f(ud["${name}"].location, v.red, v.green, v.blue, v.alpha)
}`,
codeUbo: (name) => `
v = uv.${name};
data[offset] = v.red;
data[offset+1] = v.green;
data[offset+2] = v.blue;
data[offset+3] = v.alpha;
`
},
{
test: (data, uniform) => data.type === "vec3" && data.size === 1 && !data.isArray && uniform.red !== void 0,
code: (name) => `
cv = ud["${name}"].value;
v = uv["${name}"];
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
{
cv[0] = v.red;
cv[1] = v.green;
cv[2] = v.blue;
gl.uniform3f(ud["${name}"].location, v.red, v.green, v.blue)
}`,
codeUbo: (name) => `
v = uv.${name};
data[offset] = v.red;
data[offset+1] = v.green;
data[offset+2] = v.blue;
`
},
{
test: (data) => data.type === "vec4" && data.size === 1 && !data.isArray,

@@ -109,0 +154,0 @@ code: (name) => `

import type { ExtensionMetadata } from '@pixi/extensions';
import type { BackgroundOptions } from '../background/BackgroundSystem';
import type { IRenderer } from '../IRenderer';
import type { IRendererPlugins } from '../plugin/PluginSystem';
import type { ISystem } from '../system/ISystem';
import type { ContextOptions } from '../systems';
import type { ViewOptions } from '../view/ViewSystem';
export interface StartupOptions extends Record<string, unknown> {
export interface StartupSystemOptions {
/**
* Whether to log the version and type information of renderer to console.
* @memberof PIXI.IRendererOptions
*/
hello: boolean;
_plugin: IRendererPlugins;
background: BackgroundOptions;
_view: ViewOptions;
context?: ContextOptions;
}

@@ -18,4 +14,7 @@ /**

* @memberof PIXI
*/ export declare class StartupSystem implements ISystem {
*/
export declare class StartupSystem implements ISystem<StartupSystemOptions> {
/** @ignore */
static defaultOptions: StartupSystemOptions;
/** @ignore */
static extension: ExtensionMetadata;

@@ -28,4 +27,4 @@ readonly renderer: IRenderer;

*/
run(options: StartupOptions): void;
run(options: StartupSystemOptions): void;
destroy(): void;
}

@@ -12,8 +12,8 @@ 'use strict';

run(options) {
const renderer = this.renderer;
renderer.emitWithCustomOptions(renderer.runners.init, options);
const { renderer } = this;
renderer.runners.init.emit(renderer.options);
if (options.hello) {
console.log(`PixiJS ${"7.1.2"} - ${renderer.rendererLogId} - https://pixijs.com`);
console.log(`PixiJS ${"7.2.0-beta"} - ${renderer.rendererLogId} - https://pixijs.com`);
}
renderer.resize(this.renderer.screen.width, this.renderer.screen.height);
renderer.resize(renderer.screen.width, renderer.screen.height);
}

@@ -23,2 +23,5 @@ destroy() {

}
StartupSystem.defaultOptions = {
hello: false
};
StartupSystem.extension = {

@@ -25,0 +28,0 @@ type: [

@@ -6,6 +6,6 @@ import type { Renderer } from '../Renderer';

*/
export interface ISystem<INIT_OPTIONS = null, DESTROY_OPTIONS = null> {
init?(options?: INIT_OPTIONS): void;
export interface ISystem<InitOptions = null, DestroyOptions = null> {
init?(options?: InitOptions): void;
/** Generic destroy methods to be overridden by the subclass */
destroy?(options?: DESTROY_OPTIONS): void;
destroy?(options?: DestroyOptions): void;
}

@@ -12,0 +12,0 @@ /**

@@ -48,4 +48,4 @@ import { Resource } from './Resource';

update(): void;
/** Destroy this {@link BaseImageResource} */
/** Destroy this {@link PIXI.BaseImageResource} */
dispose(): void;
}

@@ -7,5 +7,2 @@ import { Resource } from './Resource';

/**
* @interface SharedArrayBuffer
*/
/**
* Buffer resource with data of typed array.

@@ -37,5 +34,5 @@ * @memberof PIXI

* @param {*} source - The source object
* @returns {boolean} `true` if <canvas>
* @returns {boolean} `true` if \<canvas\>
*/
static test(source: unknown): source is Float32Array | Uint8Array | Uint32Array;
}
import { BaseImageResource } from './BaseImageResource';
import type { ICanvas } from '@pixi/settings';
/**
* @interface OffscreenCanvas
*/
/**
* Resource type for HTMLCanvasElement and OffscreenCanvas.

@@ -8,0 +5,0 @@ * @memberof PIXI

@@ -8,3 +8,6 @@ import { AbstractMultiResource } from './AbstractMultiResource';

import type { Resource } from './Resource';
/** Constructor options for CubeResource */
/**
* Constructor options for CubeResource.
* @memberof PIXI
*/
export interface ICubeResourceOptions extends ISize {

@@ -11,0 +14,0 @@ /** Whether to auto-load resources */

@@ -41,3 +41,3 @@ import { ALPHA_MODES } from '@pixi/constants';

/**
* The ImageBitmap element created for a {@code HTMLImageElement}.
* The ImageBitmap element created for a {@link HTMLImageElement}.
* @default null

@@ -44,0 +44,0 @@ */

@@ -14,3 +14,3 @@ import { BaseImageResource } from './BaseImageResource';

/**
* Resource type for {@code HTMLVideoElement}.
* Resource type for {@link HTMLVideoElement}.
* @memberof PIXI

@@ -17,0 +17,0 @@ */

@@ -12,2 +12,17 @@ import { Point, Rectangle } from '@pixi/math';

export declare type TextureSource = string | BaseTexture | ImageSource;
/**
* Stores the width of the non-scalable borders, for example when used with {@link PIXI.NineSlicePlane} texture.
* @memberof PIXI
* @since 7.2.0
*/
export interface ITextureBorders {
/** left border in pixels */
left: number;
/** top border in pixels */
top: number;
/** right border in pixels */
right: number;
/** bottom border in pixels */
bottom: number;
}
export interface Texture extends GlobalMixins.Texture, EventEmitter {

@@ -83,2 +98,8 @@ }

defaultAnchor: Point;
/**
* Default width of the non-scalable border that is used if 9-slice plane is created with this texture.
* @since 7.2.0
* @see PIXI.NineSlicePlane
*/
defaultBorders?: ITextureBorders;
/** Default TextureMatrix instance for this texture. By default, that object is not created because its heavy. */

@@ -116,4 +137,5 @@ uvMatrix: TextureMatrix;

* @param anchor - Default anchor point used for sprite placement / rotation
* @param borders - Default borders used for 9-slice scaling. See {@link PIXI.NineSlicePlane}
*/
constructor(baseTexture: BaseTexture<R>, frame?: Rectangle, orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData);
constructor(baseTexture: BaseTexture<R>, frame?: Rectangle, orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData, borders?: ITextureBorders);
/**

@@ -120,0 +142,0 @@ * Updates this texture on the gpu.

@@ -24,3 +24,3 @@ 'use strict';

class Texture extends utils.EventEmitter {
constructor(baseTexture, frame, orig, trim, rotate, anchor) {
constructor(baseTexture, frame, orig, trim, rotate, anchor, borders) {
super();

@@ -49,2 +49,3 @@ this.noFrame = false;

this.defaultAnchor = anchor ? new math.Point(anchor.x, anchor.y) : new math.Point(0, 0);
this.defaultBorders = borders;
this._updateID = 0;

@@ -108,3 +109,3 @@ this.textureCacheIds = [];

const clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone();
const clonedTexture = new Texture(this.baseTexture, !this.noFrame && clonedFrame, clonedOrig, this.trim?.clone(), this.rotate, this.defaultAnchor);
const clonedTexture = new Texture(this.baseTexture, !this.noFrame && clonedFrame, clonedOrig, this.trim?.clone(), this.rotate, this.defaultAnchor, this.defaultBorders);
if (this.noFrame) {

@@ -111,0 +112,0 @@ clonedTexture._frame = clonedFrame;

@@ -6,17 +6,28 @@ import { Rectangle } from '@pixi/math';

import type { ISystem } from '../system/ISystem';
/**
* Options passed to the ViewSystem
* @memberof PIXI
*/
export interface ViewOptions {
/** The width of the screen. */
width: number;
/** The height of the screen. */
height: number;
/** The canvas to use as a view, optional. */
export interface ViewSystemOptions {
/**
* The canvas to use as the view. If omitted, a new canvas will be created.
* @memberof PIXI.IRendererOptions
*/
view?: ICanvas;
/** Resizes renderer view in CSS pixels to allow for resolutions other than 1. */
/**
* The width of the renderer's view.
* @memberof PIXI.IRendererOptions
*/
width?: number;
/**
* The height of the renderer's view.
* @memberof PIXI.IRendererOptions
*/
height?: number;
/**
* The resolution / device pixel ratio of the renderer.
* @memberof PIXI.IRendererOptions
*/
resolution?: number;
/**
* Whether the CSS dimensions of the renderer's view should be resized automatically.
* @memberof PIXI.IRendererOptions
*/
autoDensity?: boolean;
/** The resolution / device pixel ratio of the renderer. */
resolution?: number;
}

@@ -28,4 +39,32 @@ /**

*/
export declare class ViewSystem implements ISystem<ViewOptions, boolean> {
export declare class ViewSystem implements ISystem<ViewSystemOptions, boolean> {
/** @ignore */
static defaultOptions: {
/**
* {@link PIXI.IRendererOptions.width}
* @default 800
* @memberof PIXI.settings.RENDER_OPTIONS
*/
width: number;
/**
* {@link PIXI.IRendererOptions.height}
* @default 600
* @memberof PIXI.settings.RENDER_OPTIONS
*/
height: number;
/**
* {@link PIXI.IRendererOptions.resolution}
* @type {number}
* @default PIXI.settings.RESOLUTION
* @memberof PIXI.settings.RENDER_OPTIONS
*/
resolution: number;
/**
* {@link PIXI.IRendererOptions.autoDensity}
* @default false
* @memberof PIXI.settings.RENDER_OPTIONS
*/
autoDensity: boolean;
};
/** @ignore */
static extension: ExtensionMetadata;

@@ -61,3 +100,3 @@ private renderer;

*/
init(options: ViewOptions): void;
init(options: ViewSystemOptions): void;
/**

@@ -64,0 +103,0 @@ * Resizes the screen and canvas to the specified dimensions.

@@ -42,2 +42,8 @@ 'use strict';

}
ViewSystem.defaultOptions = {
width: 800,
height: 600,
resolution: settings.settings.RESOLUTION,
autoDensity: false
};
ViewSystem.extension = {

@@ -44,0 +50,0 @@ type: [

{
"name": "@pixi/core",
"version": "7.1.2",
"version": "7.2.0-beta",
"main": "lib/index.js",

@@ -43,12 +43,12 @@ "module": "lib/index.mjs",

"dependencies": {
"@pixi/constants": "7.1.2",
"@pixi/extensions": "7.1.2",
"@pixi/math": "7.1.2",
"@pixi/runner": "7.1.2",
"@pixi/settings": "7.1.2",
"@pixi/ticker": "7.1.2",
"@pixi/utils": "7.1.2",
"@pixi/color": "7.2.0-beta",
"@pixi/constants": "7.2.0-beta",
"@pixi/extensions": "7.2.0-beta",
"@pixi/math": "7.2.0-beta",
"@pixi/runner": "7.2.0-beta",
"@pixi/settings": "7.2.0-beta",
"@pixi/ticker": "7.2.0-beta",
"@pixi/utils": "7.2.0-beta",
"@types/offscreencanvas": "^2019.6.4"
},
"gitHead": "27e65c73bb36a06fd00d6da5bf460bbee9f6c984"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc