| keyof U> &
+ WithPointLike
+ > & U & InteractionEvents & { ref?: React.Ref };
+
+ type IContainer = Container;
+ type ISprite = Container;
+ type IText = Container;
+ type IGraphics = Container {
+ * g.beginFill(0xff0000);
+ * g.drawRect(0,0,100,100);
+ * g.endFill();
+ * }}
+ */
+ draw?(graphics: PIXI.Graphics): void;
+ }>;
+
+ type IBitmapText = Container<
+ PIXI.BitmapText,
+ {
+ /**
+ * Set the style object
+ *
+ * @example
+ *
+ * style={{ font: '50px Desyrel' }}
+ */
+ style?: ConstructorParameters[1];
+ }
+ >;
+
+ type INineSlicePlane = Container;
+ type IParticleContainer = Container<
+ PIXI.ParticleContainer,
+ {
+ maxSize?: ConstructorParameters[0];
+ properties?: ConstructorParameters[1];
+ batchSize?: ConstructorParameters[2];
+ autoResize?: ConstructorParameters[3];
+ }
+ >;
+
+ type ITilingSprite = Container<
+ PIXI.TilingSprite,
+ WithSource & {
+ tileScale?: PointLike;
+ tilePosition: PointLike;
+ }
+ >;
+
+ type ISimpleRope = Container;
+ type ISimpleMesh = Container<
+ PIXI.SimpleMesh,
+ WithSource & {
+ uvs?: ConstructorParameters[2];
+ indices?: ConstructorParameters[3];
+ }
+ >;
+
+ type IAnimatedSprite = Container<
+ PIXI.AnimatedSprite,
+ WithSource & {
+ isPlaying: boolean;
+ images?: string[];
+ initialFrame?: number;
+ }
+ >;
+
+ type IStage = React.CanvasHTMLAttributes & {
+ /**
+ * Width of the Stage and canvas
+ */
+ width?: number;
+
+ /**
+ * Height of the Stage and canvas
+ */
+ height?: number;
+
+ /**
+ * Enable the {@see PIXI.Application} ticker? [default=true].
+ * Automatically renders the stage on request animation frame.
+ */
+ raf?: boolean;
+
+ /**
+ * Render the PIXI stage on React component changes.
+ * You'll need to set raf={false}.
+ */
+ renderOnComponentChange?: boolean;
+
+ /**
+ * The PIXI application options.
+ *
+ * @see PIXI.ApplicationOptions
+ * @example
+ *
+ * options={{ antialias: true, roundPixels: true }}
+ */
+ options?: ApplicationOptions;
+
+ /**
+ * Callback when the component is successfully mounted
+ *
+ * @param {PIXI.Application} app
+ */
+ onMount?(app: PIXI.Application): void;
+
+ /**
+ * Callback when the component is successfully unmounted
+ *
+ * @param {PIXI.Application} app
+ */
+ onUnmount?(app: PIXI.Application): void;
+ };
+
+ interface ICustomComponent<
+ P extends { [key: string]: any },
+ PixiInstance extends PIXI.DisplayObject
+ > {
+ /**
+ * Create the PIXI instance
+ * The component is created during React reconciliation.
+ *
+ * @param props passed down props
+ * @returns {PIXI.DisplayObject}
+ */
+ create(props: P): PixiInstance;
+
+ /**
+ * Instance mounted
+ * This is called during React reconciliation.
+ *
+ * @param {PIXI.DisplayObject} instance
+ * @param {PIXI.Container} parent
+ */
+ didMount?(instance: PixiInstance, parent: PIXI.Container): void;
+
+ /**
+ * Instance will unmount
+ * This is called during React reconciliation.
+ *
+ * @param {PIXI.DisplayObject} instance
+ * @param {PIXI.Container} parent
+ */
+ willUnmount?(instance: PixiInstance, parent: PIXI.Container): void;
+
+ /**
+ * Apply props for this custom component.
+ * This is called during React reconciliation.
+ *
+ * @param {PIXI.DisplayObject} instance
+ * @param oldProps
+ * @param newProps
+ */
+ applyProps?(
+ instance: PixiInstance,
+ oldProps: Readonly,
+ newProps: Readonly
+ ): void;
+
+ /**
+ * Reconcile config
+ */
+ config?: {
+ /**
+ * Destroy instance on unmount?
+ * @default true
+ */
+ destroy?: boolean;
+
+ /**
+ * Destroy child instances?
+ * @default true
+ */
+ destroyChildren?: boolean
+ };
+ }
+}
+
+// components
+export const Text: React.FC<_ReactPixi.IText>;
+export const Sprite: React.FC<_ReactPixi.ISprite>;
+export const Container: React.FC<_ReactPixi.IContainer>;
+export const Graphics: React.FC<_ReactPixi.IGraphics>;
+export const BitmapText: React.FC<_ReactPixi.IBitmapText>;
+export const NineSlicePlane: React.FC<_ReactPixi.INineSlicePlane>;
+export const ParticleContainer: React.FC<_ReactPixi.IParticleContainer>;
+export const TilingSprite: React.FC<_ReactPixi.ITilingSprite>;
+export const SimpleRope: React.FC<_ReactPixi.ISimpleRope>;
+export const SimpleMesh: React.FC<_ReactPixi.ISimpleMesh>;
+export const AnimatedSprite: React.FC<_ReactPixi.IAnimatedSprite>;
+
+// renderer
+export const render: (
+ element: React.ReactElement | React.ReactElement[] | React.Factory,
+ container: PIXI.Container,
+ callback?: (...args: any) => void
+) => any;
+
+// unmount component
+export const unmountComponentAtNode: (container: PIXI.Container) => void;
+
+// context
+export const AppContext: React.Context;
+export const AppProvider: React.ComponentType>;
+export const AppConsumer: React.ComponentType>;
+
+// fiber
+export const PixiFiber: (
+ eventsMap?: { [P in keyof ReconcilerConfig]: (...args: any) => void }
+) => Reconciler;
+
+// stage
+export class Stage extends React.Component<_ReactPixi.IStage> {}
+
+/**
+ * Create a Custom PIXI Component
+ *
+ * @example
+ *
+ * type RectangleProps = { x: number, y: number, color: number };
+ *
+ * const Rectangle = PixiComponent('Rectangle', {
+ * create() {
+ * return new PIXI.Graphics();
+ * }
+ * applyProps(ins: PIXI.Graphics, oldProps: RectangleProps, newProps: RectangleProps) {
+ * ins.clear();
+ * ins.beginFill(newProps.color);
+ * ins.drawRect(newProps.x, newProps.y, 100, 100);
+ * ins.endFill();
+ * }
+ * });
+ */
+export const PixiComponent: (
+ componentName: string,
+ lifecycle: _ReactPixi.ICustomComponent
+) => React.FC }>;
+
+/**
+ * Tap into the {PIXI.Application} ticker raf.
+ *
+ * @example
+ *
+ * const MyComponent = () => {
+ * const [x, setX] = useState(0);
+ * useTick(() => setX(x + 1));
+ *
+ * return
+ * }
+ */
+export const useTick: (
+ tick: (this: PIXI.Ticker, delta: number, ticker: PIXI.Ticker) => void,
+ enabled?: boolean
+) => void;
+
+/**
+ * Get the {} {PIXI.Application} instance.
+ *
+ * @example
+ *
+ * const MyComponent = () => {
+ * const app = useApp(); // app = PIXI.Application
+ *
+ * return
+ * }
+ *
+ */
+export const useApp: () => PIXI.Application;
+
+/**
+ * Higher Order Component to attach the {PIXI.Application} to `app` prop.
+ *
+ * @example
+ *
+ * interface Props {
+ * app: PIXI.Application
+ * }
+ *
+ * export default withPixiApp(
+ * ({ app }) => (
+ * //
+ * )
+ * );
+ */
+export const withPixiApp: (
+ WrappedComponent: React.ComponentType
+) => React.ComponentClass>;
+
+/**
+ * Apply default props. Useful in Custom Components.
+ *
+ * @example
+ *
+ * const Rectangle = PixiComponent('Rectangle', {
+ * create() {
+ * return new PIXI.Graphics();
+ * },
+ * applyProps(instance, oldProps, newProps) {
+ * applyDefaultProps(instance, oldProps, newProps);
+ * }
+ * });
+ */
+export const applyDefaultProps: (
+ instance: PIXI.DisplayObject,
+ oldProps: P,
+ newProps: P
+) => void;
+
+/**
+ * Create a filter wrapper to easily facilitate filter arguments as props
+ * in a declarative way.
+ *
+ * @example
+ *
+ * render() {
+ * return (
+ *
+ *
+ *
+ *
+ *
+ * )
+ * }
+ */
+export const withFilters: <
+ Component extends React.ComponentType<
+ _ReactPixi.Container
+ >,
+ Filters extends { [filterKey: string]: any }
+ >(
+ WrapperComponent: Component,
+ filters: Filters
+) => React.ComponentType<
+ React.ComponentProps &
+ Partial<
+ {
+ [P in keyof Filters]: Partial & { construct: ConstructorParameters }>
+ }
+ >
+ >
+
+/**
+ * Get the component instance ref
+ *
+ * @example
+ *
+ * const App = () => {
+ * const containerRef = React.useRef>(null);
+ *
+ * return
+ * };
+ */
+export type PixiRef> = Extract<
+ React.ComponentProps['ref'],
+ React.RefObject
+ > extends React.Ref
+ ? R
+ : never;
diff --git a/Typescript/types/pixi/accessibility/global.d.ts b/Typescript/types/pixi/accessibility/global.d.ts
new file mode 100644
index 0000000..22ba585
--- /dev/null
+++ b/Typescript/types/pixi/accessibility/global.d.ts
@@ -0,0 +1,8 @@
+declare namespace GlobalMixins
+{
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
+ interface DisplayObject extends Partial
+ {
+
+ }
+}
diff --git a/Typescript/types/pixi/accessibility/index.d.ts b/Typescript/types/pixi/accessibility/index.d.ts
new file mode 100644
index 0000000..01f4ff4
--- /dev/null
+++ b/Typescript/types/pixi/accessibility/index.d.ts
@@ -0,0 +1,185 @@
+///
+
+import type { AbstractRenderer } from 'pixi/core';
+import type { DisplayObject } from 'pixi/display';
+import type { ExtensionMetadata } from 'pixi/core';
+import type { Rectangle } from 'pixi/math';
+import type { Renderer } from 'pixi/core';
+
+/**
+ * The Accessibility manager recreates the ability to tab and have content read by screen readers.
+ * This is very important as it can possibly help people with disabilities access PixiJS content.
+ *
+ * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the
+ * events as if the mouse was being used, minimizing the effort required to implement.
+ *
+ * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility`
+ * @class
+ * @memberof PIXI
+ */
+export declare class AccessibilityManager {
+ /** @ignore */
+ static extension: ExtensionMetadata;
+ /** Setting this to true will visually show the divs. */
+ debug: boolean;
+ /**
+ * The renderer this accessibility manager works for.
+ * @type {PIXI.CanvasRenderer|PIXI.Renderer}
+ */
+ renderer: AbstractRenderer | Renderer;
+ /** Internal variable, see isActive getter. */
+ private _isActive;
+ /** Internal variable, see isMobileAccessibility getter. */
+ private _isMobileAccessibility;
+ /** Button element for handling touch hooks. */
+ private _hookDiv;
+ /** This is the dom element that will sit over the PixiJS element. This is where the div overlays will go. */
+ private div;
+ /** A simple pool for storing divs. */
+ private pool;
+ /** This is a tick used to check if an object is no longer being rendered. */
+ private renderId;
+ /** The array of currently active accessible items. */
+ private children;
+ /** Count to throttle div updates on android devices. */
+ private androidUpdateCount;
+ /** The frequency to update the div elements. */
+ private androidUpdateFrequency;
+ /**
+ * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer
+ */
+ constructor(renderer: AbstractRenderer | Renderer);
+ /**
+ * Value of `true` if accessibility is currently active and accessibility layers are showing.
+ * @member {boolean}
+ * @readonly
+ */
+ get isActive(): boolean;
+ /**
+ * Value of `true` if accessibility is enabled for touch devices.
+ * @member {boolean}
+ * @readonly
+ */
+ get isMobileAccessibility(): boolean;
+ /**
+ * Creates the touch hooks.
+ * @private
+ */
+ private createTouchHook;
+ /**
+ * Destroys the touch hooks.
+ * @private
+ */
+ private destroyTouchHook;
+ /**
+ * Activating will cause the Accessibility layer to be shown.
+ * This is called when a user presses the tab key.
+ * @private
+ */
+ private activate;
+ /**
+ * Deactivating will cause the Accessibility layer to be hidden.
+ * This is called when a user moves the mouse.
+ * @private
+ */
+ private deactivate;
+ /**
+ * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.
+ * @private
+ * @param {PIXI.Container} displayObject - The DisplayObject to check.
+ */
+ private updateAccessibleObjects;
+ /**
+ * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects.
+ * @private
+ */
+ private update;
+ /**
+ * private function that will visually add the information to the
+ * accessability div
+ * @param {HTMLElement} div -
+ */
+ updateDebugHTML(div: IAccessibleHTMLElement): void;
+ /**
+ * Adjust the hit area based on the bounds of a display object
+ * @param {PIXI.Rectangle} hitArea - Bounds of the child
+ */
+ capHitArea(hitArea: Rectangle): void;
+ /**
+ * Adds a DisplayObject to the accessibility manager
+ * @private
+ * @param {PIXI.DisplayObject} displayObject - The child to make accessible.
+ */
+ private addChild;
+ /**
+ * Maps the div button press to pixi's InteractionManager (click)
+ * @private
+ * @param {MouseEvent} e - The click event.
+ */
+ private _onClick;
+ /**
+ * Maps the div focus events to pixi's InteractionManager (mouseover)
+ * @private
+ * @param {FocusEvent} e - The focus event.
+ */
+ private _onFocus;
+ /**
+ * Maps the div focus events to pixi's InteractionManager (mouseout)
+ * @private
+ * @param {FocusEvent} e - The focusout event.
+ */
+ private _onFocusOut;
+ /**
+ * Is called when a key is pressed
+ * @private
+ * @param {KeyboardEvent} e - The keydown event.
+ */
+ private _onKeyDown;
+ /**
+ * Is called when the mouse moves across the renderer element
+ * @private
+ * @param {MouseEvent} e - The mouse event.
+ */
+ private _onMouseMove;
+ /** Destroys the accessibility manager */
+ destroy(): void;
+}
+
+/**
+ * Default property values of accessible objects
+ * used by {@link PIXI.AccessibilityManager}.
+ * @private
+ * @function accessibleTarget
+ * @memberof PIXI
+ * @type {object}
+ * @example
+ * function MyObject() {}
+ *
+ * Object.assign(
+ * MyObject.prototype,
+ * PIXI.accessibleTarget
+ * );
+ */
+export declare const accessibleTarget: IAccessibleTarget;
+
+export declare interface IAccessibleHTMLElement extends HTMLElement {
+ type?: string;
+ displayObject?: DisplayObject;
+}
+
+export declare interface IAccessibleTarget {
+ accessible: boolean;
+ accessibleTitle: string;
+ accessibleHint: string;
+ tabIndex: number;
+ _accessibleActive: boolean;
+ _accessibleDiv: IAccessibleHTMLElement;
+ accessibleType: string;
+ accessiblePointerEvents: PointerEvents;
+ accessibleChildren: boolean;
+ renderId: number;
+}
+
+export declare type PointerEvents = 'auto' | 'none' | 'visiblePainted' | 'visibleFill' | 'visibleStroke' | 'visible' | 'painted' | 'fill' | 'stroke' | 'all' | 'inherit';
+
+export { }
diff --git a/Typescript/types/pixi/app/global.d.ts b/Typescript/types/pixi/app/global.d.ts
new file mode 100644
index 0000000..7be0741
--- /dev/null
+++ b/Typescript/types/pixi/app/global.d.ts
@@ -0,0 +1,15 @@
+declare namespace GlobalMixins
+{
+ interface Application
+ {
+ resizeTo: Window | HTMLElement;
+ resize(): void;
+ queueResize: () => void;
+ cancelResize: () => void;
+ }
+
+ interface IApplicationOptions
+ {
+ resizeTo?: Window | HTMLElement;
+ }
+}
diff --git a/Typescript/types/pixi/app/index.d.ts b/Typescript/types/pixi/app/index.d.ts
new file mode 100644
index 0000000..8c84cff
--- /dev/null
+++ b/Typescript/types/pixi/app/index.d.ts
@@ -0,0 +1,183 @@
+///
+
+import type { AbstractRenderer } from 'pixi/core';
+import { Container } from 'pixi/display';
+import type { ExtensionMetadata } from 'pixi/core';
+import type { IDestroyOptions } from 'pixi/display';
+import type { IRendererOptionsAuto } from 'pixi/core';
+import type { Rectangle } from 'pixi/math';
+import type { Renderer } from 'pixi/core';
+
+export declare interface Application extends GlobalMixins.Application {
+}
+
+/**
+ * Convenience class to create a new PIXI application.
+ *
+ * This class automatically creates the renderer, ticker and root container.
+ * @example
+ * // Create the application
+ * const app = new PIXI.Application();
+ *
+ * // Add the view to the DOM
+ * document.body.appendChild(app.view);
+ *
+ * // ex, add display objects
+ * app.stage.addChild(PIXI.Sprite.from('something.png'));
+ * @class
+ * @memberof PIXI
+ */
+export declare class Application {
+ /** Collection of installed plugins. */
+ static _plugins: IApplicationPlugin[];
+ /**
+ * The root display container that's rendered.
+ * @member {PIXI.Container}
+ */
+ stage: Container;
+ /**
+ * WebGL renderer if available, otherwise CanvasRenderer.
+ * @member {PIXI.Renderer|PIXI.CanvasRenderer}
+ */
+ renderer: Renderer | AbstractRenderer;
+ /**
+ * @param {PIXI.IApplicationOptions} [options] - The optional application and 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 {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction.
+ * **Note**: Setting this parameter to false does NOT stop the shared ticker even if you set
+ * `options.sharedTicker` to `true` in case that it is already started. Stop it by your own.
+ * @param {number} [options.backgroundAlpha=1] -
+ * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).
+ * @param {number} [options.backgroundColor=0x000000] -
+ * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).
+ * @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 is ignored.
+ * @param {number} [options.height=600] - The height of the renderer's view.
+ * @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 {Window|HTMLElement} [options.resizeTo] - Element to automatically resize stage to.
+ * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -
+ * The resolution / device pixel ratio of the renderer.
+ * @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.Loader.shared, `false` to create new Loader.
+ * @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.Ticker.shared, `false` to create new ticker.
+ * If set to `false`, you cannot register a handler to occur before anything that runs on the shared ticker.
+ * The system ticker will always run before both the shared ticker and the app ticker.
+ * @param {boolean} [options.transparent] -
+ * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \
+ * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.
+ * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -
+ * 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 {HTMLCanvasElement} [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.
+ */
+ constructor(options?: IApplicationOptions);
+ /**
+ * Use the {@link PIXI.extensions.add} API to register plugins.
+ * @deprecated since 6.5.0
+ * @static
+ * @param {PIXI.IApplicationPlugin} plugin - Plugin being installed
+ */
+ static registerPlugin(plugin: IApplicationPlugin): void;
+ /** Render the current stage. */
+ render(): void;
+ /**
+ * Reference to the renderer's canvas element.
+ * @member {HTMLCanvasElement}
+ * @readonly
+ */
+ get view(): HTMLCanvasElement;
+ /**
+ * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.
+ * @member {PIXI.Rectangle}
+ * @readonly
+ */
+ get screen(): Rectangle;
+ /**
+ * Destroy and don't use after this.
+ * @param {boolean} [removeView=false] - Automatically remove canvas from DOM.
+ * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options
+ * have been set to that value
+ * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy
+ * method called as well. 'stageOptions' will be passed on to those calls.
+ * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set
+ * to true. Should it destroy the texture of the child sprite
+ * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set
+ * to true. Should it destroy the base texture of the child sprite
+ */
+ destroy(removeView?: boolean, stageOptions?: IDestroyOptions | boolean): void;
+}
+
+/**
+ * Application options supplied to constructor.
+ * @memberof PIXI
+ */
+export declare interface IApplicationOptions extends IRendererOptionsAuto, GlobalMixins.IApplicationOptions {
+}
+
+/**
+ * Any plugin that's usable for Application should contain these methods.
+ * @memberof PIXI
+ */
+export declare interface IApplicationPlugin {
+ /**
+ * Called when Application is constructed, scoped to Application instance.
+ * Passes in `options` as the only argument, which are Application constructor options.
+ * @param {object} options - Application options.
+ */
+ init(options: IApplicationOptions): void;
+ /** Called when destroying Application, scoped to Application instance. */
+ destroy(): void;
+}
+
+declare type ResizeableRenderer = Pick;
+
+/**
+ * Middleware for for Application's resize functionality
+ * @private
+ * @class
+ */
+export declare class ResizePlugin {
+ /** @ignore */
+ static extension: ExtensionMetadata;
+ static resizeTo: Window | HTMLElement;
+ static resize: () => void;
+ static renderer: ResizeableRenderer;
+ static queueResize: () => void;
+ private static _resizeId;
+ private static _resizeTo;
+ private static cancelResize;
+ /**
+ * Initialize the plugin with scope of application instance
+ * @static
+ * @private
+ * @param {object} [options] - See application options
+ */
+ static init(options?: IApplicationOptions): void;
+ /**
+ * Clean up the ticker, scoped to application
+ * @static
+ * @private
+ */
+ static destroy(): void;
+}
+
+export { }
diff --git a/Typescript/types/pixi/assets/index.d.ts b/Typescript/types/pixi/assets/index.d.ts
new file mode 100644
index 0000000..df2e052
--- /dev/null
+++ b/Typescript/types/pixi/assets/index.d.ts
@@ -0,0 +1,1123 @@
+import { BitmapFont } from 'pixi/text-bitmap';
+import type { ExtensionMetadata } from 'pixi/core';
+import type { IBaseTextureOptions } from 'pixi/core';
+import { Resource } from 'pixi/core';
+import { Spritesheet } from 'pixi/spritesheet';
+import { Texture } from 'pixi/core';
+
+export declare function addFormats(...format: string[]): (formats: string[]) => Promise;
+
+/**
+ * Initialization options object for Asset Class.
+ * @memberof PIXI
+ */
+export declare interface AssetInitOptions {
+ /** a base path for any assets loaded */
+ basePath?: string;
+ /**
+ * a manifest to tell the asset loader upfront what all your assets are
+ * this can be the manifest object itself, or a URL to the manifest.
+ */
+ manifest?: string | ResolverManifest;
+ /**
+ * optional preferences for which textures preferences you have when resolving assets
+ * for example you might set the resolution to 0.5 if the user is on a rubbish old phone
+ * or you might set the resolution to 2 if the user is on a retina display
+ */
+ texturePreference?: {
+ /** the resolution order you prefer, can be an array (priority order - first is prefered) or a single resolutions */
+ resolution?: number | number[];
+ /** the formats you prefer, by default this will be: ['avif', 'webp', 'png', 'jpg', 'jpeg'] */
+ format?: string | string[];
+ };
+ /** loader options to configure the loader with, currently only parsers! */
+ loader?: {
+ /** custom parsers can be added here, for example something that could load a sound or a 3D model */
+ parsers?: LoaderParser[];
+ };
+ /** resolver specific options */
+ resolver?: {
+ /**
+ * a list of urlParsers, these can read the URL and pick put the various options.
+ * for example there is a texture URL parser that picks our resolution and file format.
+ * You can add custom ways to read URLs and extract information here.
+ */
+ urlParsers?: ResolveURLParser[];
+ /**
+ * a list of preferOrders that let the resolver know which asset to pick.
+ * already built-in we have a texture preferOrders that let the resolve know which asset to prefer
+ * if it has multiple assets to pick from (resolution/formats etc)
+ */
+ preferOrders?: PreferOrder[];
+ };
+}
+
+export declare const Assets: AssetsClass;
+
+/**
+ * A one stop shop for all Pixi resource management!
+ * Super modern and easy to use, with enough flexibility to customize and do what you need!
+ * @memberof PIXI
+ * @namespace Assets
+ *
+ * Only one Asset Class exists accessed via the Global Asset object.
+ *
+ * It has four main responsibilities:
+ * 1. Allows users to map URLs to keys and resolve them according to the user's browser capabilities.
+ * 2. Loads the resources and transforms them into assets that developers understand.
+ * 3. Caches the assets and provides a way to access them.
+ * 4. Allow developers to unload assets and clear the cache.
+ *
+ * It also has a few advanced features:
+ * 1. Allows developers to provide a manifest upfront of all assets and help manage them via 'bundles'.
+ * 2. Allows users to background load assets. Shortening (or eliminating) load times and improving UX. With this feature,
+ * in-game loading bars can be a thing of the past!
+ *
+ *
+ * ### Setup
+ *
+ * As for PixiJS v6.x, `@pixi/assets` is an opt-in package, so you need to import it first.
+ *
+ * #### NPM Install
+ *
+ * ```sh
+ * npm install @pixi/assets@v6.x
+ * ```
+ *
+ * There is no default export. The correct way to import Assets is:
+ *
+ * ```js
+ * import { Assets } from 'pixi/assets';
+ * ```
+ *
+ * #### CDN Install
+ *
+ * Via jsDelivr:
+ *
+ * ```html
+ *
+ * ```
+ *
+ * Or via unpkg:
+ *
+ * ```html
+ *
+ * ```
+ *
+ * _Note: The version of `@pixi/assets` should be the same as the version of `pixi.js` you are using._
+ *
+ * ### Assets Loading
+ *
+ * Do not be afraid to load things multiple times - under the hood, it will NEVER load anything more than once.
+ *
+ * For example:
+ *
+ * ```
+ * promise1 = PIXI.Assets.load('bunny.png')
+ * promise2 = PIXI.Assets.load('bunny.png')
+ *
+ * // promise1 === promise2
+ * ```
+ *
+ * Here both promises will be the same. Once resolved... Forever resolved! It makes for really easy resource management!
+ *
+ * Out of the box it supports the following files:
+ * * textures (avif, webp, png, jpg, gif)
+ * * sprite sheets (json)
+ * * bitmap fonts (xml, fnt, txt)
+ * * web fonts (ttf, woff, woff2)
+ * * json files (json)
+ * * text files (txt)
+ *
+ * More types can be added fairly easily by creating additional loader parsers.
+ *
+ * ### Textures
+ * - Textures are loaded as ImageBitmap on a worker thread where possible.
+ * Leading to much less janky load + parse times.
+ * - By default, we will prefer to load AVIF and WebP image files if you specify them.
+ * But if the browser doesn't support AVIF or WebP we will fall back to png and jpg.
+ * - Textures can also be accessed via Texture.from(...) and now use this asset manager under the hood!
+ * - Don't worry if you set preferences for textures that don't exist (for example you prefer 2x resolutions images
+ * but only 1x is available for that texture, the Asset manager will pick that up as a fallback automatically)
+ * #### Sprite sheets
+ * - it's hard to know what resolution a sprite sheet is without loading it first, to address this
+ * there is a naming convention we have added that will let Pixi understand the image format and resolution
+ * of the spritesheet via its file name:
+ *
+ * `my-spritesheet{resolution}.{imageFormat}.json`
+ *
+ * for example:
+ *
+ * `my-spritesheet@2x.webp.json` // 2x resolution, WebP sprite sheet
+ * `my-spritesheet@0.5x.png.json` // 0.5x resolution, png sprite sheet
+ *
+ * This is optional! you can just load a sprite sheet as normal,
+ * This is only useful if you have a bunch of different res / formatted spritesheets
+ *
+ * ### Fonts
+ * * Web fonts will be loaded with all weights.
+ * it is possible to load only specific weights by doing the following:
+ *
+ * ```
+ * // load specific weights..
+ * await PIXI.Assets.load({
+ * data: {
+ * weights: ['normal'], // only loads the weight
+ * },
+ * src: `outfit.woff2`,
+ * });
+ *
+ * // load everything...
+ * await PIXI.Assets.load(`outfit.woff2`);
+ * ```
+ * ### Background Loading
+ * Background loading will load stuff for you passively behind the scenes. To minimize jank,
+ * it will only load one asset at a time. As soon as a developer calls `PIXI.Assets.load(...)` the
+ * background loader is paused and requested assets are loaded as a priority.
+ * Don't worry if something is in there that's already loaded, it will just get skipped!
+ *
+ * You still need to call `PIXI.Assets.load(...)` to get an asset that has been loaded in the background.
+ * It's just that this promise will resolve instantly if the asset
+ * has already been loaded.
+ *
+ * ### Manifest and Bundles
+ * - Manifest is a JSON file that contains a list of all assets and their properties.
+ * - Bundles are a way to group assets together.
+ *
+ * ```
+ * // manifest example
+ * const manifest = {
+ * bundles:[{
+ * name:'load-screen',
+ * assets:[
+ * {
+ * name: 'background',
+ * srcs: 'sunset.png',
+ * },
+ * {
+ * name: 'bar',
+ * srcs: 'load-bar.{png,webp}',
+ * }
+ * ]
+ * },
+ * {
+ * name:'game-screen',
+ * assets:[
+ * {
+ * name: 'character',
+ * srcs: 'robot.png',
+ * },
+ * {
+ * name: 'enemy',
+ * srcs: 'bad-guy.png',
+ * }
+ * ]
+ * }]
+ * }}
+ *
+ * await PIXI.Asset.init({
+ * manifest
+ * });
+ *
+ * // load a bundle..
+ * loadScreenAssets = await PIXI.Assets.loadBundle('load-screen');
+ * // load another..
+ * gameScreenAssets = await PIXI.Assets.loadBundle('game-screen');
+ * ```
+ * @example
+ * const bunny = await PIXI.Assets.load('bunny.png');
+ */
+export declare class AssetsClass {
+ /** the resolver to map various urls */
+ resolver: Resolver;
+ /**
+ * The loader, loads stuff!
+ * @type {PIXI.AssetLoader}
+ */
+ loader: Loader;
+ /**
+ * The global cache of all assets within PixiJS
+ * @type {PIXI.Cache}
+ */
+ cache: typeof Cache_2;
+ /** takes care of loading assets in the background */
+ private readonly _backgroundLoader;
+ private _detections;
+ private _initialized;
+ constructor();
+ /**
+ * Best practice is to call this function before any loading commences
+ * Initiating is the best time to add any customization to the way things are loaded.
+ *
+ * you do not need to call this for the Asset class to work, only if you want to set any initial properties
+ * @param options - options to initialize the Asset manager with
+ */
+ init(options?: AssetInitOptions): Promise;
+ /**
+ * Allows you to specify how to resolve any assets load requests.
+ * There are a few ways to add things here as shown below:
+ * @example
+ * // simple
+ * PIXI.Assets.add('bunnyBooBoo', 'bunny.png');
+ * const bunny = await PIXI.Assets.load('bunnyBooBoo');
+ *
+ * // multiple keys:
+ * PIXI.Assets.add(['burger', 'chicken'], 'bunny.png');
+ *
+ * const bunny = await PIXI.Assets.load('burger');
+ * const bunny2 = await PIXI.Assets.load('chicken');
+ *
+ * // passing options to to the object
+ * PIXI.Assets.add(
+ * 'bunnyBooBooSmooth',
+ * 'bunny{png,webp}',
+ * {scaleMode:SCALE_MODES.NEAREST} // base texture options
+ * );
+ *
+ * // multiple assets,
+ *
+ * // the following all do the same thing:
+ *
+ * PIXI.Assets.add('bunnyBooBoo', 'bunny{png,webp}');
+ *
+ * PIXI.Assets.add('bunnyBooBoo', [
+ * 'bunny.png',
+ * 'bunny.webp'
+ * ]);
+ *
+ * PIXI.Assets.add('bunnyBooBoo', [
+ * {
+ * format:'png',
+ * src:'bunny.png',
+ * },
+ * {
+ * format:'webp',
+ * src:'bunny.webp',
+ * }
+ * ]);
+ *
+ * const bunny = await PIXI.Assets.load('bunnyBooBoo'); // will try to load WebP if available
+ * @param keysIn - the key or keys that you will reference when loading this asset
+ * @param assetsIn - the asset or assets that will be chosen from when loading via the specified key
+ * @param data - asset-specific data that will be passed to the loaders
+ * - Useful if you want to initiate loaded objects with specific data
+ */
+ add(keysIn: string | string[], assetsIn: string | (ResolveAsset | string)[], data?: unknown): void;
+ /**
+ * Loads your assets! You pass in a key or URL and it will return a promise that
+ * resolves to the loaded asset. If multiple assets a requested, it will return a hash of assets.
+ *
+ * Don't worry about loading things multiple times, behind the scenes assets are only ever loaded
+ * once and the same promise reused behind the scenes so you can safely call this function multiple
+ * times with the same key and it will always return the same asset.
+ * @example
+ * // load a URL:
+ * const myImageTexture = await PIXI.Assets.load('http://some.url.com/image.png'); // => returns a texture
+ *
+ * PIXI.Assets.add('thumper', 'bunny.png');
+ * PIXI.Assets.add('chicko', 'chicken.png');
+ *
+ * // load multiple assets:
+ * const textures = await PIXI.Assets.load(['thumper', 'chicko']); // => {thumper: Texture, chicko: Texture}
+ * @param urls - the urls to load
+ * @param onProgress - optional function that is called when progress on asset loading is made.
+ * The function is passed a single parameter, `progress`, which represents the percentage
+ * (0.0 - 1.0) of the assets loaded.
+ * @returns - the assets that were loaded, either a single asset or a hash of assets
+ */
+ load(urls: string | string[] | LoadAsset | LoadAsset[], onProgress?: ProgressCallback): Promise>;
+ /**
+ * This adds a bundle of assets in one go so that you can load them as a group.
+ * For example you could add a bundle for each screen in you pixi app
+ * @example
+ * PIXI.Assets.addBundle('animals', {
+ * bunny: 'bunny.png',
+ * chicken: 'chicken.png',
+ * thumper: 'thumper.png',
+ * });
+ *
+ * const assets = await PIXI.Assets.loadBundle('animals');
+ * @param bundleId - the id of the bundle to add
+ * @param assets - a record of the asset or assets that will be chosen from when loading via the specified key
+ */
+ addBundle(bundleId: string, assets: ResolverBundle['assets']): void;
+ /**
+ * Bundles are a way to load multiple assets at once.
+ * If a manifest has been provided to the init function then you can load a bundle, or bundles.
+ * you can also add bundles via `addBundle`
+ * @example
+ * // manifest example
+ * const manifest = {
+ * bundles:[{
+ * name:'load-screen',
+ * assets:[
+ * {
+ * name: 'background',
+ * srcs: 'sunset.png',
+ * },
+ * {
+ * name: 'bar',
+ * srcs: 'load-bar.{png,webp}',
+ * }
+ * ]
+ * },
+ * {
+ * name:'game-screen',
+ * assets:[
+ * {
+ * name: 'character',
+ * srcs: 'robot.png',
+ * },
+ * {
+ * name: 'enemy',
+ * srcs: 'bad-guy.png',
+ * }
+ * ]
+ * }]
+ * }}
+ *
+ * await Asset.init({
+ * manifest
+ * });
+ *
+ * // load a bundle..
+ * loadScreenAssets = await PIXI.Assets.loadBundle('load-screen');
+ * // load another..
+ * gameScreenAssets = await PIXI.Assets.loadBundle('game-screen');
+ * @param bundleIds - the bundle id or ids to load
+ * @param onProgress - optional function that is called when progress on asset loading is made.
+ * The function is passed a single parameter, `progress`, which represents the percentage (0.0 - 1.0)
+ * of the assets loaded.
+ * @returns all the bundles assets or a hash of assets for each bundle specified
+ */
+ loadBundle(bundleIds: string | string[], onProgress?: ProgressCallback): Promise;
+ /**
+ * Initiate a background load of some assets. it will passively begin to load these assets in the background.
+ * So when you actually come to loading them you will get a promise that resolves to the loaded assets immediately
+ *
+ * An example of this might be that you would background load game assets after your inital load.
+ * then when you got to actually load your game screen assets when a player goes to the game - the loading
+ * would already have stared or may even be complete, saving you having to show an interim load bar.
+ * @example
+ * PIXI.Assets.backgroundLoad('bunny.png');
+ *
+ * // later on in your app...
+ * await PIXI.Assets.loadBundle('bunny.png'); // will resolve quicker as loading may have completed!
+ * @param urls - the url / urls you want to background load
+ */
+ backgroundLoad(urls: string | string[]): Promise;
+ /**
+ * Initiate a background of a bundle, works exactly like backgroundLoad but for bundles.
+ * this can only be used if the loader has been initiated with a manifest
+ * @example
+ * await PIXI.Assets.init({
+ * manifest: {
+ * bundles: [
+ * {
+ * name:'load-screen',
+ * assets:[...]
+ * }
+ * ...]
+ * }
+ * });
+ *
+ * PIXI.Assets.backgroundLoadBundle('load-screen');
+ *
+ * // later on in your app...
+ * await PIXI.Assets.loadBundle('load-screen'); // will resolve quicker as loading may have completed!
+ * @param bundleIds - the bundleId / bundleIds you want to background load
+ */
+ backgroundLoadBundle(bundleIds: string | string[]): Promise;
+ /**
+ * Only intended for development purposes.
+ * This will wipe the resolver and caches.
+ * You will need to reinitialize the Asset
+ */
+ reset(): void;
+ /**
+ * Instantly gets an asset already loaded from the cache. If the asset has not yet been loaded,
+ * it will return undefined. So it's on you! When in doubt just use `PIXI.Assets.load` instead.
+ * (remember, the loader will never load things more than once!)
+ * @param keys - The key or keys for the assets that you want to access
+ * @returns - The assets or hash of assets requested
+ */
+ get(keys: string | string[]): T | Record;
+ /**
+ * helper function to map resolved assets back to loaded assets
+ * @param resolveResults - the resolve results from the resolver
+ * @param onProgress - the progress callback
+ */
+ private _mapLoadToResolve;
+ /**
+ * Unload an asset or assets. As the Assets class is responsible for creating the assets via the `load` function
+ * this will make sure to destroy any assets and release them from memory.
+ * Once unloaded, you will need to load the asset again.
+ *
+ * Use this to help manage assets if you find that you have a large app and you want to free up memory.
+ *
+ * * it's up to you as the developer to make sure that textures are not actively being used when you unload them,
+ * Pixi won't break but you will end up with missing assets. Not a good look for the user!
+ * @example
+ * // load a URL:
+ * const myImageTexture = await PIXI.Assets.load('http://some.url.com/image.png'); // => returns a texture
+ *
+ * await PIXI.Assets.unload('http://some.url.com/image.png')
+ *
+ * myImageTexture <-- will now be destroyed.
+ *
+ * // unload multiple assets:
+ * const textures = await PIXI.Assets.unload(['thumper', 'chicko']);
+ * @param urls - the urls to unload
+ */
+ unload(urls: string | string[] | LoadAsset | LoadAsset[]): Promise;
+ /**
+ * Bundles are a way to manage multiple assets at once.
+ * this will unload all files in a bundle.
+ *
+ * once a bundle has been unloaded, you need to load it again to have access to the assets.
+ * @example
+ * PIXI.Assets.addBundle({
+ * 'thumper': 'http://some.url.com/thumper.png',
+ * })
+ *
+ * const assets = await PIXI.Assets.loadBundle('thumper');
+ *
+ * // now to unload..
+ *
+ * await await PIXI.Assets.unloadBundle('thumper');
+ *
+ * // all assets in the assets object will now have been destroyed and purged from the cache
+ * @param bundleIds - the bundle id or ids to unload
+ */
+ unloadBundle(bundleIds: string | string[]): Promise;
+ private _unloadFromResolved;
+ /** All the detection parsers currently added to the Assets class. */
+ get detections(): FormatDetectionParser[];
+}
+
+declare const Cache_2: CacheClass;
+export { Cache_2 as Cache }
+
+/**
+ * A single Cache for all assets.
+ *
+ * When assets are added to the cache via set they normally are added to the cache as key-value pairs.
+ *
+ * With this cache, you can add parsers that will take the object and convert it to a list of assets that can be cached.
+ * for example a cacheSprite Sheet parser will add all of the textures found within its sprite sheet directly to the cache.
+ *
+ * This gives devs the flexibility to cache any type of object however we want.
+ *
+ * It is not intended that this class is created by developers - it is part of the Asset package.
+ * This is the first major system of PixiJS' main Assets class.
+ * @memberof PIXI
+ * @class Cache
+ */
+declare class CacheClass {
+ private _parsers;
+ private readonly _cache;
+ private readonly _cacheMap;
+ /** Clear all entries. */
+ reset(): void;
+ /**
+ * Check if the key exists
+ * @param key - The key to check
+ */
+ has(key: string): boolean;
+ /**
+ * Fetch entry by key
+ * @param key - The key of the entry to get
+ */
+ get(key: string): T;
+ /**
+ * Set a value by key or keys name
+ * @param key - The key or keys to set
+ * @param value - The value to store in the cache or from which cacheable assets will be derived.
+ */
+ set(key: string | string[], value: unknown): void;
+ /**
+ * Remove entry by key
+ *
+ * This function will also remove any associated alias from the cache also.
+ * @param key - The key of the entry to remove
+ */
+ remove(key: string): void;
+ /** All loader parsers registered */
+ get parsers(): CacheParser[];
+}
+
+/**
+ * For every asset that is cached, it will call the parsers test function
+ * the flow is as follows:
+ *
+ * 1. `cacheParser.test()`: Test the asset.
+ * 2. `cacheParser.getCacheableAssets()`: If the test passes call the getCacheableAssets function with the asset
+ *
+ * Useful if you want to add more than just a raw asset to the cache
+ * (for example a spritesheet will want to make all its sub textures easily accessible in the cache)
+ */
+export declare interface CacheParser {
+ extension?: ExtensionMetadata;
+ /** A config to adjust the parser */
+ config?: Record;
+ /**
+ * Gets called by the cache when a dev caches an asset
+ * @param asset - the asset to test
+ */
+ test: (asset: T) => boolean;
+ /**
+ * If the test passes, this function is called to get the cacheable assets
+ * an example may be that a spritesheet object will return all the sub textures it has so they can
+ * be cached.
+ * @param keys - The keys to cache the assets under
+ * @param asset - The asset to get the cacheable assets from
+ * @returns A key-value pair of cacheable assets
+ */
+ getCacheableAssets: (keys: string[], asset: T) => Record;
+}
+
+export declare const cacheSpritesheet: CacheParser;
+
+export declare const cacheTextureArray: CacheParser;
+
+export declare const convertToList: (input: string | T | (string | T)[], transform?: (input: string) => T) => T[];
+
+/**
+ * Creates a list of all possible combinations of the given strings.
+ * @example
+ * const out2 = createStringVariations('name is {chicken,wolf,sheep}');
+ * console.log(out2); // [ 'name is chicken', 'name is wolf', 'name is sheep' ]
+ * @param string - The string to process
+ */
+export declare function createStringVariations(string: string): string[];
+
+export declare const detectAvif: FormatDetectionParser;
+
+export declare const detectBasis: FormatDetectionParser;
+
+export declare const detectCompressedTextures: FormatDetectionParser;
+
+export declare const detectWebp: FormatDetectionParser;
+
+export declare interface FormatDetectionParser {
+ extension?: ExtensionMetadata;
+ test: () => Promise;
+ add: (formats: string[]) => Promise;
+ remove: (formats: string[]) => Promise;
+}
+
+/**
+ * Return font face name from a file name
+ * Ex.: 'fonts/tital-one.woff' turns into 'Titan One'
+ * @param url - File url
+ */
+export declare function getFontFamilyName(url: string): string;
+
+/**
+ * Checks if the given value is an array.
+ * @param item - The item to test
+ */
+export declare const isSingleItem: (item: unknown) => boolean;
+
+export declare interface LoadAsset {
+ src: string;
+ data?: T;
+ alias?: string[];
+ format?: string;
+}
+
+/** Load BASIS textures! */
+export declare const loadBasis: LoaderParser | Texture[], IBaseTextureOptions>;
+
+/** simple loader plugin for loading in bitmap fonts! */
+export declare const loadBitmapFont: LoaderParser;
+
+/** Load our DDS textures! */
+export declare const loadDDS: LoaderParser;
+
+/**
+ * The Loader is responsible for loading all assets, such as images, spritesheets, audio files, etc.
+ * It does not do anything clever with URLs - it just loads stuff!
+ * Behind the scenes all things are cached using promises. This means it's impossible to load an asset more than once.
+ * Through the use of LoaderParsers, the loader can understand how to load any kind of file!
+ *
+ * It is not intended that this class is created by developers - its part of the Asset class
+ * This is the second major system of PixiJS' main Assets class
+ * @memberof PIXI
+ * @class AssetLoader
+ */
+export declare class Loader {
+ private _parsers;
+ /** Cache loading promises that ae currently active */
+ promiseCache: Record;
+ /** function used for testing */
+ reset(): void;
+ /**
+ * Used internally to generate a promise for the asset to be loaded.
+ * @param url - The URL to be loaded
+ * @param data - any custom additional information relevant to the asset being loaded
+ * @returns - a promise that will resolve to an Asset for example a Texture of a JSON object
+ */
+ private _getLoadPromiseAndParser;
+ /**
+ * Loads an asset(s) using the parsers added to the Loader.
+ * @example
+ * // single asset:
+ * const asset = await Loader.load('cool.png');
+ * console.log(asset);
+ * @example
+ * // multiple assets:
+ * const assets = await Loader.load(['cool.png', 'cooler.png']);
+ * console.log(assets);
+ * @param assetsToLoadIn - urls that you want to load, or a single one!
+ * @param onProgress - a function that gets called when the progress changes
+ */
+ load(assetsToLoadIn: string | string[] | LoadAsset | LoadAsset[], onProgress?: (progress: number) => void): Promise<{
+ [key: string]: any;
+ } | any>;
+ /**
+ * Unloads an asset(s). Any unloaded assets will be destroyed, freeing up memory for your app.
+ * The parser that created the asset, will be the one that unloads it.
+ * @example
+ * // single asset:
+ * const asset = await Loader.load('cool.png');
+ *
+ * await Loader.unload('cool.png');
+ *
+ * console.log(asset.destroyed); // true
+ * @param assetsToUnloadIn - urls that you want to unload, or a single one!
+ */
+ unload(assetsToUnloadIn: string | string[] | LoadAsset | LoadAsset[]): Promise;
+ /** All loader parsers registered */
+ get parsers(): LoaderParser[];
+}
+
+/**
+ * All functions are optional here. The flow:
+ *
+ * for every asset,
+ *
+ * 1. `parser.test()`: Test the asset url.
+ * 2. `parser.load()`: If test passes call the load function with the url
+ * 3. `parser.testParse()`: Test to see if the asset should be parsed by the plugin
+ * 4. `parse.parse()`: If test is parsed, then run the parse function on the asset.
+ *
+ * some plugins may only be used for parsing,
+ * some only for loading
+ * and some for both!
+ */
+export declare interface LoaderParser {
+ extension?: ExtensionMetadata;
+ /** A config to adjust the parser */
+ config?: Record;
+ /**
+ * each URL to load will be tested here,
+ * if the test is passed the assets are loaded using the load function below.
+ * Good place to test for things like file extensions!
+ * @param url - The URL to test
+ * @param loadAsset - Any custom additional information relevant to the asset being loaded
+ * @param loader - The loader instance
+ */
+ test?: (url: string, loadAsset?: LoadAsset, loader?: Loader) => boolean;
+ /**
+ * This is the promise that loads the URL provided
+ * resolves with a loaded asset if returned by the parser.
+ * @param url - The URL to load
+ * @param loadAsset - Any custom additional information relevant to the asset being loaded
+ * @param loader - The loader instance
+ */
+ load?: (url: string, loadAsset?: LoadAsset, loader?: Loader) => Promise;
+ /**
+ * This function is used to test if the parse function should be run on the asset
+ * If this returns true then parse is called with the asset
+ * @param asset - The loaded asset data
+ * @param loadAsset - Any custom additional information relevant to the asset being loaded
+ * @param loader - The loader instance
+ */
+ testParse?: (asset: ASSET, loadAsset?: LoadAsset, loader?: Loader) => Promise;
+ /**
+ * Gets called on the asset it testParse passes. Useful to convert a raw asset into something more useful than
+ * @param asset - The loaded asset data
+ * @param loadAsset - Any custom additional information relevant to the asset being loaded
+ * @param loader - The loader instance
+ */
+ parse?: (asset: ASSET, loadAsset?: LoadAsset, loader?: Loader) => Promise;
+ /**
+ * If an asset is parsed using this parser, the unload function will be called when the user requests an asset
+ * to be unloaded. This is useful for things like sounds or textures that can be unloaded from memory
+ * @param asset - The asset to unload/destroy
+ * @param loadAsset - Any custom additional information relevant to the asset being loaded
+ * @param loader - The loader instance
+ */
+ unload?: (asset: ASSET, loadAsset?: LoadAsset, loader?: Loader) => void;
+}
+
+export declare type LoadFontData = {
+ family: string;
+ display: string;
+ featureSettings: string;
+ stretch: string;
+ style: string;
+ unicodeRange: string;
+ variant: string;
+ weights: string[];
+};
+
+/**
+ * Returns a promise that resolves an ImageBitmaps.
+ * This function is designed to be used by a worker.
+ * Part of WorkerManager!
+ * @param url - The image to load an image bitmap for
+ */
+export declare function loadImageBitmap(url: string): Promise;
+
+/** simple loader plugin for loading json data */
+export declare const loadJson: LoaderParser;
+
+/** Loads KTX textures! */
+export declare const loadKTX: LoaderParser | Texture[], IBaseTextureOptions>;
+
+/**
+ * Loader plugin that parses sprite sheets!
+ * once the JSON has been loaded this checks to see if the JSON is spritesheet data.
+ * If it is, we load the spritesheets image and parse the data into PIXI.Spritesheet
+ * All textures in the sprite sheet are then added to the cache
+ */
+export declare const loadSpritesheet: LoaderParser;
+
+/** Loads SVG's into Textures */
+export declare const loadSVG: LoaderParser, IBaseTextureOptions>;
+
+/**
+ * Loads our textures!
+ * this makes use of imageBitmaps where available.
+ * We load the ImageBitmap on a different thread using the WorkerManager
+ * We can then use the ImageBitmap as a source for a Pixi Texture
+ */
+export declare const loadTextures: LoaderParser, IBaseTextureOptions>;
+
+/** Simple loader plugin for loading text data */
+export declare const loadTxt: LoaderParser;
+
+/** Web font loader plugin */
+export declare const loadWebFont: LoaderParser;
+
+/**
+ * A prefer order lets the resolver know which assets to prefere depending on the various parameters passed to it.
+ * @memberof PIXI
+ */
+export declare interface PreferOrder {
+ /** the importance order of the params */
+ priority?: string[];
+ params: {
+ [key: string]: any;
+ };
+}
+
+export declare type ProgressCallback = (progress: number) => void;
+
+export declare interface PromiseAndParser {
+ promise: Promise;
+ parser: LoaderParser;
+}
+
+export declare function removeFormats(...format: string[]): (formats: string[]) => Promise;
+
+/**
+ * the object returned when a key is resolved to an asset.
+ * it will contain any additional information passed in the asset was added.
+ * @memberof PIXI
+ */
+export declare interface ResolveAsset extends Record {
+ alias?: string[];
+ src: string;
+}
+
+export declare const resolveCompressedTextureUrl: ResolveURLParser;
+
+/**
+ * A class that is responsible for resolving mapping asset URLs to keys.
+ * At its most basic it can be used for Aliases:
+ *
+ * ```
+ * resolver.add('foo', 'bar');
+ * resolver.resolveUrl('foo') // => 'bar'
+ * ```
+ *
+ * It can also be used to resolve the most appropriate asset for a given URL:
+ *
+ * ```
+ * resolver.prefer({
+ * params:{
+ * format:'webp',
+ * resolution: 2,
+ * }
+ * })
+ *
+ * resolver.add('foo', ['bar@2x.webp', 'bar@2x.png', 'bar.webp', 'bar.png']);
+ *
+ * resolver.resolveUrl('foo') // => 'bar@2x.webp'
+ * ```
+ * Other features include:
+ * - Ability to process a manifest file to get the correct understanding of how to resolve all assets
+ * - Ability to add custom parsers for specific file types
+ * - Ability to add custom prefer rules
+ *
+ * This class only cares about the URL, not the loading of the asset itself.
+ *
+ * It is not intended that this class is created by developers - its part of the Asset class
+ * This is the third major system of PixiJS' main Assets class
+ * @memberof PIXI
+ */
+export declare class Resolver {
+ private _assetMap;
+ private _preferredOrder;
+ private _parsers;
+ private _resolverHash;
+ private _rootPath;
+ private _basePath;
+ private _manifest;
+ private _bundles;
+ /**
+ * Let the resolver know which assets you prefer to use when resolving assets.
+ * Multiple prefer user defined rules can be added.
+ * @example
+ * resolver.prefer({
+ * // first look for something with the correct format, and then then correct resolution
+ * priority: ['format', 'resolution'],
+ * params:{
+ * format:'webp', // prefer webp images
+ * resolution: 2, // prefer a resolution of 2
+ * }
+ * })
+ * resolver.add('foo', ['bar@2x.webp', 'bar@2x.png', 'bar.webp', 'bar.png']);
+ * resolver.resolveUrl('foo') // => 'bar@2x.webp'
+ * @param preferOrders - the prefer options
+ */
+ prefer(...preferOrders: PreferOrder[]): void;
+ /**
+ * Set the base path to prepend to all urls when resolving
+ * @example
+ * resolver.basePath = 'https://home.com/';
+ * resolver.add('foo', 'bar.ong');
+ * resolver.resolveUrl('foo', 'bar.png'); // => 'https://home.com/bar.png'
+ * @param basePath - the base path to use
+ */
+ set basePath(basePath: string);
+ get basePath(): string;
+ /**
+ * Set the root path for root-relative URLs. By default the `basePath`'s root is used. If no `basePath` is set, then the
+ * default value for browsers is `window.location.origin`
+ * @example
+ * // Application hosted on https://home.com/some-path/index.html
+ * resolver.basePath = 'https://home.com/some-path/';
+ * resolver.rootPath = 'https://home.com/';
+ * resolver.add('foo', '/bar.png');
+ * resolver.resolveUrl('foo', '/bar.png'); // => 'https://home.com/bar.png'
+ * @param rootPath - the root path to use
+ */
+ set rootPath(rootPath: string);
+ get rootPath(): string;
+ /**
+ * All the active URL parsers that help the parser to extract information and create
+ * an asset object-based on parsing the URL itself.
+ *
+ * Can be added using the extensions API
+ * @example
+ * resolver.add('foo', [
+ * {
+ * resolution:2,
+ * format:'png'
+ * src: 'image@2x.png'
+ * },
+ * {
+ * resolution:1,
+ * format:'png'
+ * src: 'image.png'
+ * }
+ * ]);
+ *
+ * // with a url parser the information such as resolution and file format could extracted from the url itself:
+ * extensions.add({
+ * extension: ExtensionType.ResolveParser,
+ * test: loadTextures.test, // test if url ends in an image
+ * parse: (value: string) =>
+ * ({
+ * resolution: parseFloat(settings.RETINA_PREFIX.exec(value)?.[1] ?? '1'),
+ * format: value.split('.').pop(),
+ * src: value,
+ * }),
+ * });
+ *
+ * // now resolution and format can be extracted from the url
+ * resolver.add('foo', [
+ * 'image@2x.png'
+ * 'image.png'
+ * ]);
+ * @
+ */
+ get parsers(): ResolveURLParser[];
+ /** Used for testing, this resets the resolver to its initial state */
+ reset(): void;
+ /**
+ * Add a manifest to the asset resolver. This is a nice way to add all the asset information in one go.
+ * generally a manifest would be built using a tool.
+ * @param manifest - the manifest to add to the resolver
+ */
+ addManifest(manifest: ResolverManifest): void;
+ /**
+ * This adds a bundle of assets in one go so that you can resolve them as a group.
+ * For example you could add a bundle for each screen in you pixi app
+ * @example
+ * resolver.addBundle('animals', {
+ * bunny: 'bunny.png',
+ * chicken: 'chicken.png',
+ * thumper: 'thumper.png',
+ * });
+ *
+ * const resolvedAssets = await resolver.resolveBundle('animals');
+ * @param bundleId - The id of the bundle to add
+ * @param assets - A record of the asset or assets that will be chosen from when loading via the specified key
+ */
+ addBundle(bundleId: string, assets: ResolverBundle['assets']): void;
+ /**
+ * Tells the resolver what keys are associated with witch asset.
+ * The most important thing the resolver does
+ * @example
+ * // single key, single asset:
+ * resolver.add('foo', 'bar.png');
+ * resolver.resolveUrl('foo') // => 'bar.png'
+ *
+ * // multiple keys, single asset:
+ * resolver.add(['foo', 'boo'], 'bar.png');
+ * resolver.resolveUrl('foo') // => 'bar.png'
+ * resolver.resolveUrl('boo') // => 'bar.png'
+ *
+ * // multiple keys, multiple assets:
+ * resolver.add(['foo', 'boo'], ['bar.png', 'bar.webp']);
+ * resolver.resolveUrl('foo') // => 'bar.png'
+ *
+ * // add custom data attached to the resolver
+ * Resolver.add(
+ * 'bunnyBooBooSmooth',
+ * 'bunny{png,webp}',
+ * {scaleMode:SCALE_MODES.NEAREST} // base texture options
+ * );
+ *
+ * resolver.resolve('bunnyBooBooSmooth') // => {src: 'bunny.png', data: {scaleMode: SCALE_MODES.NEAREST}}
+ * @param keysIn - The keys to map, can be an array or a single key
+ * @param assetsIn - The assets to associate with the key(s)
+ * @param data - The data that will be attached to the object that resolved object.
+ */
+ add(keysIn: string | string[], assetsIn: string | ResolveAsset | (ResolveAsset | string)[], data?: unknown): void;
+ /**
+ * If the resolver has had a manifest set via setManifest, this will return the assets urls for
+ * a given bundleId or bundleIds.
+ * @example
+ * // manifest example
+ * const manifest = {
+ * bundles:[{
+ * name:'load-screen',
+ * assets:[
+ * {
+ * name: 'background',
+ * srcs: 'sunset.png',
+ * },
+ * {
+ * name: 'bar',
+ * srcs: 'load-bar.{png,webp}',
+ * }
+ * ]
+ * },
+ * {
+ * name:'game-screen',
+ * assets:[
+ * {
+ * name: 'character',
+ * srcs: 'robot.png',
+ * },
+ * {
+ * name: 'enemy',
+ * srcs: 'bad-guy.png',
+ * }
+ * ]
+ * }]
+ * }}
+ * resolver.setManifest(manifest);
+ * const resolved = resolver.resolveBundle('load-screen');
+ * @param bundleIds - The bundle ids to resolve
+ * @returns All the bundles assets or a hash of assets for each bundle specified
+ */
+ resolveBundle(bundleIds: string | string[]): Record | Record>;
+ /**
+ * Does exactly what resolve does, but returns just the URL rather than the whole asset object
+ * @param key - The key or keys to resolve
+ * @returns - The URLs associated with the key(s)
+ */
+ resolveUrl(key: string | string[]): string | Record;
+ /**
+ * Resolves each key in the list to an asset object.
+ * Another key function of the resolver! After adding all the various key/asset pairs. this will run the logic
+ * of finding which asset to return based on any preferences set using the `prefer` function
+ * by default the same key passed in will be returned if nothing is matched by the resolver.
+ * @example
+ * resolver.add('boo', 'bunny.png');
+ *
+ * resolver.resolve('boo') // => {src:'bunny.png'}
+ *
+ * // will return the same string as no key was added for this value..
+ * resolver.resolve('another-thing.png') // => {src:'another-thing.png'}
+ * @param keys - key or keys to resolve
+ * @returns - the resolve asset or a hash of resolve assets for each key specified
+ */
+ resolve(keys: string | string[]): ResolveAsset | Record;
+ /**
+ * Internal function for figuring out what prefer criteria an asset should use.
+ * @param assets
+ */
+ private _getPreferredOrder;
+}
+
+export declare type ResolverAssetsArray = {
+ name: string | string[];
+ srcs: string | ResolveAsset[];
+}[];
+
+export declare type ResolverAssetsObject = Record;
+
+/**
+ * Structure of a bundle found in a manfest file
+ * @memberof PIXI
+ */
+export declare interface ResolverBundle {
+ name: string;
+ assets: ResolverAssetsArray | ResolverAssetsObject;
+}
+
+/**
+ * The expected format of a manifest. This would normally be auto generated ar made by the developer
+ * @memberof PIXI
+ */
+export declare type ResolverManifest = {
+ bundles: ResolverBundle[];
+};
+
+export declare const resolveSpriteSheetUrl: ResolveURLParser;
+
+export declare const resolveTextureUrl: ResolveURLParser;
+
+/**
+ * Format for url parser, will test a string and if it pass will then parse it, turning it into an ResolveAsset
+ * @memberof PIXI
+ */
+export declare interface ResolveURLParser {
+ extension?: ExtensionMetadata;
+ /** A config to adjust the parser */
+ config?: Record;
+ /** the test to perform on the url to determin if it should be parsed */
+ test: (url: string) => boolean;
+ /** the function that will convert the url into an object */
+ parse: (value: string) => ResolveAsset;
+}
+
+export { }
diff --git a/Typescript/types/pixi/basis/index.d.ts b/Typescript/types/pixi/basis/index.d.ts
new file mode 100644
index 0000000..3340d9d
--- /dev/null
+++ b/Typescript/types/pixi/basis/index.d.ts
@@ -0,0 +1,402 @@
+import { BufferResource } from 'pixi/core';
+import { CompressedTextureResource } from 'pixi/compressed-textures';
+import type { ExtensionMetadata } from 'pixi/core';
+import { INTERNAL_FORMATS } from 'pixi/compressed-textures';
+import { LoaderResource } from 'pixi/loaders';
+import { TYPES } from 'pixi/constants';
+
+/**
+ * Binding to basis_universal WebGL library.
+ * @see https://github.com/BinomialLLC/basis_universal/blob/master/webgl/transcoder/build/basis_transcoder.js
+ * @ignore
+ */
+export declare type BASIS = (opts?: {
+ wasmBinary: ArrayBuffer;
+}) => Promise;
+
+/**
+ * Maps {@link BASIS_FORMATS} to {@link PIXI.INTERNAL_FORMATS}
+ * @ignore
+ */
+export declare const BASIS_FORMAT_TO_INTERNAL_FORMAT: {
+ [id: number]: INTERNAL_FORMATS;
+};
+
+/**
+ * Maps {@link BASIS_FORMATS} to {@link PIXI.TYPES}. These formats are a fallback when the basis file cannot be transcoded
+ * to a valid compressed texture format.
+ *
+ * NOTE: {@link BASIS_FORMATS.cTFBGR565} is not supported, while {@link BASIS_FORMATS.cTFRGBA4444} is not implemented by
+ * [at]pixi/basis.
+ * @ignore
+ */
+export declare const BASIS_FORMAT_TO_TYPE: {
+ [id: number]: TYPES;
+};
+
+/**
+ * The transcoding formats provided by basis_universal.
+ *
+ * NOTE: Not all of these formats are supported on WebGL!
+ * @ignore
+ */
+export declare enum BASIS_FORMATS {
+ cTFETC1 = 0,
+ cTFETC2 = 1,
+ cTFBC1 = 2,
+ cTFBC3 = 3,
+ cTFBC4 = 4,
+ cTFBC5 = 5,
+ cTFBC7 = 6,
+ cTFPVRTC1_4_RGB = 8,
+ cTFPVRTC1_4_RGBA = 9,
+ cTFASTC_4x4 = 10,
+ cTFATC_RGB = 11,
+ cTFATC_RGBA_INTERPOLATED_ALPHA = 12,
+ cTFRGBA32 = 13,
+ cTFRGB565 = 14,
+ cTFBGR565 = 15,
+ cTFRGBA4444 = 16
+}
+
+/**
+ * Enumerates the basis formats with alpha components
+ * @ignore
+ */
+export declare const BASIS_FORMATS_ALPHA: {
+ [id: number]: boolean;
+};
+
+/**
+ * API provided by basis_universal WebGL library.
+ * @ignore
+ */
+export declare type BasisBinding = {
+ BasisFile: typeof BasisFile;
+ initializeBasis(): void;
+};
+
+/**
+ * Binding to C++ {@code BasisFile} wrapper class.
+ * @see https://github.com/BinomialLLC/basis_universal/blob/master/webgl/transcoder/basis_wrappers.cpp
+ * @private
+ */
+export declare class BasisFile {
+ constructor(buffer: Uint8Array);
+ getNumImages(): number;
+ getNumLevels(imageId: number): number;
+ getImageWidth(imageId: number, level: number): number;
+ getImageHeight(imageId: number, level: number): number;
+ getHasAlpha(): boolean;
+ startTranscoding(): boolean;
+ getImageTranscodedSizeInBytes(imageId: number, level: number, basisFormat: number): number;
+ transcodeImage(dstBuff: Uint8Array, imageId: number, level: number, basisFormat: BASIS_FORMATS, pvrtcWrapAddressing: boolean, getAlphaForOpaqueFormats: boolean): number;
+ close(): void;
+ delete(): void;
+}
+
+/**
+ * Loader plugin for handling BASIS supercompressed texture files.
+ *
+ * To use this loader, you must bind the basis_universal WebAssembly transcoder. There are two ways of
+ * doing this:
+ *
+ * 1. Adding a <script> tag to your HTML page to the transcoder bundle in this package, and serving
+ * the WASM binary from the same location.
+ *
+ * ```js
+ * // Copy ./node_modules/@pixi/basis/assets/basis_.wasm into your assets directory
+ * // as well, so it is served from the same folder as the JavaScript!
+ * <script src="./node_modules/@pixi/basis/assets/basis_transcoder.js" />
+ * ```
+ *
+ * NOTE: `basis_transcoder.js` expects the WebAssembly binary to be named `basis_transcoder.wasm`.
+ * NOTE-2: This method supports transcoding on the main-thread. Only use this if you have 1 or 2 *.basis
+ * files.
+ *
+ * 2. Loading the transcoder source from a URL.
+ *
+ * ```js
+ * // Use this if you to use the default CDN url for @pixi/basis
+ * BasisLoader.loadTranscoder();
+ *
+ * // Use this if you want to serve the transcoder on your own
+ * BasisLoader.loadTranscoder('./basis_transcoder.js', './basis_transcoder.wasm');
+ * ```
+ *
+ * NOTE: This can only be used with web-workers.
+ * @class
+ * @memberof PIXI
+ * @implements {PIXI.ILoaderPlugin}
+ */
+export declare class BasisLoader {
+ /** @ignore */
+ static extension: ExtensionMetadata;
+ /**
+ * Transcodes the *.basis data when the data is loaded. If the transcoder is not bound yet, it
+ * will hook transcoding to {@link BasisResource#onTranscoderInitialized}.
+ * @see PIXI.Loader.loaderMiddleware
+ * @param resource - loader resource that is checked to see if it is a basis file
+ * @param next - callback Function to call when done
+ */
+ static use(resource: LoaderResource, next: (...args: any[]) => void): void;
+ /**
+ * Creates textures and adds them to the texture cache
+ * @private
+ * @param url - url of the texture to be used as its ID for the texture cache
+ * @param resources - the transcoded resources
+ * @param metadata - resource metadata
+ */
+ private static registerTextures;
+ /**
+ * Binds the basis_universal transcoder to decompress *.basis files. You must initialize the transcoder library yourself.
+ *
+ * ```js
+ * import { BasisLoader } from 'pixi/basis';
+ * import { Loader } from 'pixi/loaders';
+ *
+ * // window.BASIS() returns a Promise-like object
+ * window.BASIS().then((basisLibrary) =>
+ * {
+ * // Initialize basis-library; otherwise, transcoded results maybe corrupt!
+ * basisLibrary.initializeBasis();
+ *
+ * // Bind BasisLoader to the transcoder
+ * BasisLoader.bindTranscoder(basisLibrary);
+ * });
+ * ```
+ * @param basisLibrary - the initialized transcoder library
+ * @private
+ */
+ static bindTranscoder(basisLibrary: BasisBinding): void;
+ /**
+ * Loads the transcoder source code for use in {@link PIXI.BasisLoader.TranscoderWorker}.
+ * @private
+ * @param jsURL - URL to the javascript basis transcoder
+ * @param wasmURL - URL to the wasm basis transcoder
+ */
+ static loadTranscoder(jsURL: string, wasmURL: string): Promise<[void, void]>;
+ /**
+ * Set the transcoder source code directly
+ * @private
+ * @param jsSource - source for the javascript basis transcoder
+ * @param wasmSource - source for the wasm basis transcoder
+ */
+ static setTranscoder(jsSource: string, wasmSource: ArrayBuffer): void;
+}
+
+/**
+ * Loader plugin for handling BASIS supercompressed texture files.
+ *
+ * To use this loader, you must bind the basis_universal WebAssembly transcoder. There are two ways of
+ * doing this:
+ *
+ * 1. Adding a <script> tag to your HTML page to the transcoder bundle in this package, and serving
+ * the WASM binary from the same location.
+ *
+ * ```js
+ * // Copy ./node_modules/@pixi/basis/assets/basis_.wasm into your assets directory
+ * // as well, so it is served from the same folder as the JavaScript!
+ * <script src="./node_modules/@pixi/basis/assets/basis_transcoder.js" />
+ * ```
+ *
+ * NOTE: `basis_transcoder.js` expects the WebAssembly binary to be named `basis_transcoder.wasm`.
+ * NOTE-2: This method supports transcoding on the main-thread. Only use this if you have 1 or 2 *.basis
+ * files.
+ *
+ * 2. Loading the transcoder source from a URL.
+ *
+ * ```js
+ * // Use this if you to use the default CDN url for @pixi/basis
+ * BasisParser.loadTranscoder();
+ *
+ * // Use this if you want to serve the transcoder on your own
+ * BasisParser.loadTranscoder('./basis_transcoder.js', './basis_transcoder.wasm');
+ * ```
+ *
+ * NOTE: This can only be used with web-workers.
+ * @class
+ * @memberof PIXI
+ * @implements {PIXI.ILoaderPlugin}
+ */
+export declare class BasisParser {
+ /** @ignore */
+ static extension: ExtensionMetadata;
+ static basisBinding: BasisBinding;
+ private static defaultRGBFormat;
+ private static defaultRGBAFormat;
+ private static fallbackMode;
+ private static workerPool;
+ /**
+ * Runs transcoding and populates {@link imageArray}. It will run the transcoding in a web worker
+ * if they are available.
+ * @private
+ */
+ static transcode(arrayBuffer: ArrayBuffer): Promise;
+ /**
+ * Finds a suitable worker for transcoding and sends a transcoding request
+ * @private
+ * @async
+ */
+ static transcodeAsync(arrayBuffer: ArrayBuffer): Promise;
+ /**
+ * Runs transcoding on the main thread.
+ * @private
+ */
+ static transcodeSync(arrayBuffer: ArrayBuffer): TranscodedResourcesArray;
+ /**
+ * Detects the available compressed texture formats on the device.
+ * @param extensions - extensions provided by a WebGL context
+ * @ignore
+ */
+ static autoDetectFormats(extensions?: Partial): void;
+ /**
+ * Binds the basis_universal transcoder to decompress *.basis files. You must initialize the transcoder library yourself.
+ *
+ * ```js
+ * import { BasisParser } from 'pixi/basis';
+ * import { Loader } from 'pixi/loaders';
+ *
+ * // window.BASIS() returns a Promise-like object
+ * window.BASIS().then((basisLibrary) =>
+ * {
+ * // Initialize basis-library; otherwise, transcoded results maybe corrupt!
+ * basisLibrary.initializeBasis();
+ *
+ * // Bind BasisParser to the transcoder
+ * BasisParser.bindTranscoder(basisLibrary);
+ * });
+ * ```
+ * @param basisLibrary - the initialized transcoder library
+ * @private
+ */
+ static bindTranscoder(basisLibrary: BasisBinding): void;
+ /**
+ * Loads the transcoder source code for use in {@link PIXI.BasisParser.TranscoderWorker}.
+ * @private
+ * @param jsURL - URL to the javascript basis transcoder
+ * @param wasmURL - URL to the wasm basis transcoder
+ */
+ static loadTranscoder(jsURL: string, wasmURL: string): Promise<[void, void]>;
+ /**
+ * Set the transcoder source code directly
+ * @private
+ * @param jsSource - source for the javascript basis transcoder
+ * @param wasmSource - source for the wasm basis transcoder
+ */
+ static setTranscoder(jsSource: string, wasmSource: ArrayBuffer): void;
+ static TranscoderWorker: typeof TranscoderWorker;
+ static get TRANSCODER_WORKER_POOL_LIMIT(): number;
+ static set TRANSCODER_WORKER_POOL_LIMIT(limit: number);
+}
+
+/**
+ * Compressed texture extensions relevant to the formats into which Basis can decompress into.
+ * @ignore
+ */
+export declare type BasisTextureExtensions = {
+ s3tc?: WEBGL_compressed_texture_s3tc;
+ s3tc_sRGB: WEBGL_compressed_texture_s3tc_srgb;
+ etc: any;
+ etc1: any;
+ pvrtc: any;
+ atc: any;
+ astc: WEBGL_compressed_texture_astc;
+};
+
+/**
+ * Maps {@link PIXI.INTERNAL_FORMATS} to {@link BASIS_FORMATS}
+ * @ignore
+ */
+export declare const INTERNAL_FORMAT_TO_BASIS_FORMAT: {
+ [id: number]: number;
+};
+
+/**
+ * Response format for {@link TranscoderWorker}.
+ * @ignore
+ */
+declare interface ITranscodeResponse {
+ type: 'init' | 'transcode';
+ requestID?: number;
+ success: boolean;
+ basisFormat?: BASIS_FORMATS;
+ imageArray?: Array<{
+ imageID: number;
+ levelArray: Array<{
+ levelID: number;
+ levelWidth: number;
+ levelHeight: number;
+ levelBuffer: Uint8Array;
+ }>;
+ width: number;
+ height: number;
+ }>;
+}
+
+export declare type TranscodedResourcesArray = (Array | Array) & {
+ basisFormat: BASIS_FORMATS;
+};
+
+/**
+ * Worker class for transcoding *.basis files in background threads.
+ *
+ * To enable asynchronous transcoding, you need to provide the URL to the basis_universal transcoding
+ * library.
+ * @memberof PIXI.BasisLoader
+ */
+export declare class TranscoderWorker {
+ /** URL for the script containing the basis_universal library. */
+ static bindingURL: string;
+ static jsSource: string;
+ static wasmSource: ArrayBuffer;
+ private static _onTranscoderInitializedResolve;
+ /** a promise that when reslved means the transcoder is ready to be used */
+ static onTranscoderInitialized: Promise;
+ isInit: boolean;
+ load: number;
+ requests: {
+ [id: number]: {
+ resolve: (data: ITranscodeResponse) => void;
+ reject: () => void;
+ };
+ };
+ private static _workerURL;
+ private static _tempID;
+ /** Generated URL for the transcoder worker script. */
+ static get workerURL(): string;
+ protected worker: Worker;
+ protected initPromise: Promise;
+ protected onInit: () => void;
+ constructor();
+ /** @returns a promise that is resolved when the web-worker is initialized */
+ initAsync(): Promise;
+ /**
+ * Creates a promise that will resolve when the transcoding of a *.basis file is complete.
+ * @param basisData - *.basis file contents
+ * @param rgbaFormat - transcoding format for RGBA files
+ * @param rgbFormat - transcoding format for RGB files
+ * @returns a promise that is resolved with the transcoding response of the web-worker
+ */
+ transcodeAsync(basisData: Uint8Array, rgbaFormat: BASIS_FORMATS, rgbFormat: BASIS_FORMATS): Promise;
+ /**
+ * Handles responses from the web-worker
+ * @param e - a message event containing the transcoded response
+ */
+ protected onMessage: (e: MessageEvent) => void;
+ /**
+ * Loads the transcoder source code
+ * @param jsURL - URL to the javascript basis transcoder
+ * @param wasmURL - URL to the wasm basis transcoder
+ * @returns A promise that resolves when both the js and wasm transcoders have been loaded.
+ */
+ static loadTranscoder(jsURL: string, wasmURL: string): Promise<[void, void]>;
+ /**
+ * Set the transcoder source code directly
+ * @param jsSource - source for the javascript basis transcoder
+ * @param wasmSource - source for the wasm basis transcoder
+ */
+ static setTranscoder(jsSource: string, wasmSource: ArrayBuffer): void;
+}
+
+export { }
diff --git a/Typescript/types/pixi/canvas-display/global.d.ts b/Typescript/types/pixi/canvas-display/global.d.ts
new file mode 100644
index 0000000..5132647
--- /dev/null
+++ b/Typescript/types/pixi/canvas-display/global.d.ts
@@ -0,0 +1,7 @@
+declare namespace GlobalMixins
+{
+ interface Container
+ {
+ _renderCanvas(renderer: import('pixi/canvas-renderer').CanvasRenderer): void;
+ }
+}
diff --git a/Typescript/types/pixi/canvas-display/index.d.ts b/Typescript/types/pixi/canvas-display/index.d.ts
new file mode 100644
index 0000000..505f4e8
--- /dev/null
+++ b/Typescript/types/pixi/canvas-display/index.d.ts
@@ -0,0 +1,3 @@
+///
+
+export { }
diff --git a/Typescript/types/pixi/canvas-extract/index.d.ts b/Typescript/types/pixi/canvas-extract/index.d.ts
new file mode 100644
index 0000000..7589ebe
--- /dev/null
+++ b/Typescript/types/pixi/canvas-extract/index.d.ts
@@ -0,0 +1,63 @@
+import type { CanvasRenderer } from 'pixi/canvas-renderer';
+import type { DisplayObject } from 'pixi/display';
+import type { ExtensionMetadata } from 'pixi/core';
+import { Rectangle } from 'pixi/math';
+import { RenderTexture } from 'pixi/core';
+
+/**
+ * The extract manager provides functionality to export content from the renderers.
+ *
+ * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract`
+ * @class
+ * @memberof PIXI
+ */
+export declare class CanvasExtract {
+ /** @ignore */
+ static extension: ExtensionMetadata;
+ /** A reference to the current renderer */
+ renderer: CanvasRenderer;
+ /**
+ * @param renderer - A reference to the current renderer
+ */
+ constructor(renderer: CanvasRenderer);
+ /**
+ * Will return a HTML Image of the target
+ * @param target - A displayObject or renderTexture
+ * to convert. If left empty will use the main renderer
+ * @param format - Image format, e.g. "image/jpeg" or "image/webp".
+ * @param quality - JPEG or Webp compression from 0 to 1. Default is 0.92.
+ * @returns HTML Image of the target
+ */
+ image(target?: DisplayObject | RenderTexture, format?: string, quality?: number): HTMLImageElement;
+ /**
+ * Will return a base64 encoded string of this target. It works by calling
+ * `CanvasExtract.getCanvas` and then running toDataURL on that.
+ * @param target - A displayObject or renderTexture
+ * to convert. If left empty will use the main renderer
+ * @param format - Image format, e.g. "image/jpeg" or "image/webp".
+ * @param quality - JPEG or Webp compression from 0 to 1. Default is 0.92.
+ * @returns A base64 encoded string of the texture.
+ */
+ base64(target?: DisplayObject | RenderTexture, format?: string, quality?: number): string;
+ /**
+ * Creates a Canvas element, renders this target to it and then returns it.
+ * @param target - A displayObject or renderTexture
+ * to convert. If left empty will use the main renderer
+ * @param frame - The frame the extraction is restricted to.
+ * @returns A Canvas element with the texture rendered on.
+ */
+ canvas(target?: DisplayObject | RenderTexture, frame?: Rectangle): HTMLCanvasElement;
+ /**
+ * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA
+ * order, with integer values between 0 and 255 (included).
+ * @param target - A displayObject or renderTexture
+ * to convert. If left empty will use the main renderer
+ * @param frame - The frame the extraction is restricted to.
+ * @returns One-dimensional array containing the pixel data of the entire texture
+ */
+ pixels(target?: DisplayObject | RenderTexture, frame?: Rectangle): Uint8ClampedArray;
+ /** Destroys the extract */
+ destroy(): void;
+}
+
+export { }
diff --git a/Typescript/types/pixi/canvas-graphics/global.d.ts b/Typescript/types/pixi/canvas-graphics/global.d.ts
new file mode 100644
index 0000000..4e17b8b
--- /dev/null
+++ b/Typescript/types/pixi/canvas-graphics/global.d.ts
@@ -0,0 +1,9 @@
+declare namespace GlobalMixins
+{
+ interface Graphics
+ {
+ _renderCanvas(renderer: import('pixi/canvas-renderer').CanvasRenderer): void;
+ generateCanvasTexture(scaleMode?: import('pixi/constants').SCALE_MODES, resolution?: number): Texture;
+ cachedGraphicsData: import('pixi/graphics').GraphicsData[];
+ }
+}
diff --git a/Typescript/types/pixi/canvas-graphics/index.d.ts b/Typescript/types/pixi/canvas-graphics/index.d.ts
new file mode 100644
index 0000000..b4a7d7d
--- /dev/null
+++ b/Typescript/types/pixi/canvas-graphics/index.d.ts
@@ -0,0 +1,77 @@
+///
+
+import type { CanvasRenderer } from 'pixi/canvas-renderer';
+import type { ExtensionMetadata } from 'pixi/core';
+import type { Graphics } from 'pixi/graphics';
+import { Matrix } from 'pixi/math';
+
+/**
+ * Renderer dedicated to drawing and batching graphics objects.
+ * @class
+ * @protected
+ * @memberof PIXI
+ */
+export declare class CanvasGraphicsRenderer {
+ /** @ignore */
+ static extension: ExtensionMetadata;
+ /** A reference to the current renderer */
+ renderer: CanvasRenderer;
+ private _svgMatrix;
+ private _tempMatrix;
+ /**
+ * @param renderer - A reference to the current renderer.
+ */
+ constructor(renderer: CanvasRenderer);
+ /**
+ * calculates fill/stroke style for canvas
+ * @private
+ * @param style - A graphics {@link PIXI.FILL_STYLE} where if `texture` is specified then a tinted CanvasPattern
+ * will be used for the fill.stroke
+ * @param tint - color to set the fill/stroke too.
+ */
+ private _calcCanvasStyle;
+ /**
+ * Renders a Graphics object to a canvas.
+ * @param graphics - the actual graphics object to render
+ */
+ render(graphics: Graphics): void;
+ /**
+ * Paint stroke for polygon and holes
+ * @private
+ * @param shape - Shape to be drawn
+ * @param lineStyle - Line style for the shape
+ * @param contextStrokeStyle - The strokeStyle for the canvas context
+ * @param holes - Holes to be added to the shape
+ * @param holesDirection -
+ * @param worldAlpha - The multiplied alpha of the displayObject
+ * @param context - The canvas context
+ */
+ private paintPolygonStroke;
+ /**
+ * Paint Ellipse
+ * @private
+ * @param shape - Shape to be drawn
+ * @param fillStyle - Fill for the shape
+ * @param lineStyle - Line style for the shape
+ * @param contextFillStyle - The canvas context fill style
+ * @param worldAlpha - The multiplied alpha of the displayObject
+ * @param context - The canvas context
+ */
+ private paintEllipse;
+ /**
+ * Paint Rounded Rectangle
+ * @private
+ * @param shape - Shape to be drawn
+ * @param fillStyle - Fill for the shape
+ * @param lineStyle - Line style for the shape
+ * @param contextFillStyle - The canvas context fill style
+ * @param worldAlpha - The multiplied alpha of the displayObject
+ * @param context - The canvas context
+ */
+ private paintRoundedRectangle;
+ setPatternTransform(pattern: CanvasPattern, matrix: Matrix): void;
+ /** destroy graphics object */
+ destroy(): void;
+}
+
+export { }
diff --git a/Typescript/types/pixi/canvas-mesh/global.d.ts b/Typescript/types/pixi/canvas-mesh/global.d.ts
new file mode 100644
index 0000000..520a23c
--- /dev/null
+++ b/Typescript/types/pixi/canvas-mesh/global.d.ts
@@ -0,0 +1,24 @@
+declare namespace GlobalMixins
+{
+ interface Mesh
+ {
+ _renderCanvas(renderer: import('pixi/canvas-renderer').CanvasRenderer): void;
+ _canvasPadding: number;
+ canvasPadding: number;
+ _cachedTint: number;
+ _tintedCanvas: HTMLCanvasElement;
+ _cachedTexture: import('pixi/core').Texture;
+ }
+
+ interface MeshMaterial
+ {
+ _renderCanvas(renderer: import('pixi/canvas-renderer').CanvasRenderer, mesh: import('pixi/mesh').Mesh): void;
+ }
+
+ interface NineSlicePlane
+ {
+ _cachedTint: number;
+ _tintedCanvas: HTMLCanvasElement;
+ _canvasUvs: number[];
+ }
+}
diff --git a/Typescript/types/pixi/canvas-mesh/index.d.ts b/Typescript/types/pixi/canvas-mesh/index.d.ts
new file mode 100644
index 0000000..13399aa
--- /dev/null
+++ b/Typescript/types/pixi/canvas-mesh/index.d.ts
@@ -0,0 +1,56 @@
+///
+
+import type { CanvasRenderer } from 'pixi/canvas-renderer';
+import type { ExtensionMetadata } from 'pixi/core';
+import type { Mesh } from 'pixi/mesh';
+
+/**
+ * Renderer dedicated to meshes.
+ * @class
+ * @protected
+ * @memberof PIXI
+ */
+export declare class CanvasMeshRenderer {
+ /** @ignore */
+ static extension: ExtensionMetadata;
+ /** A reference to the current renderer */
+ renderer: CanvasRenderer;
+ /** @param renderer - A reference to the current renderer */
+ constructor(renderer: CanvasRenderer);
+ /**
+ * Renders the Mesh
+ * @param mesh - the Mesh to render
+ */
+ render(mesh: Mesh): void;
+ /**
+ * Draws the object in Triangle Mesh mode
+ * @private
+ * @param mesh - the Mesh to render
+ */
+ private _renderTriangleMesh;
+ /**
+ * Draws the object in triangle mode using canvas
+ * @private
+ * @param mesh - the current mesh
+ */
+ private _renderTriangles;
+ /**
+ * Draws one of the triangles that from the Mesh
+ * @private
+ * @param mesh - the current mesh
+ * @param index0 - the index of the first vertex
+ * @param index1 - the index of the second vertex
+ * @param index2 - the index of the third vertex
+ */
+ private _renderDrawTriangle;
+ /**
+ * Renders a flat Mesh
+ * @private
+ * @param mesh - The Mesh to render
+ */
+ renderMeshFlat(mesh: Mesh): void;
+ /** destroy the renderer */
+ destroy(): void;
+}
+
+export { }
diff --git a/Typescript/types/pixi/canvas-particle-container/index.d.ts b/Typescript/types/pixi/canvas-particle-container/index.d.ts
new file mode 100644
index 0000000..f0a766d
--- /dev/null
+++ b/Typescript/types/pixi/canvas-particle-container/index.d.ts
@@ -0,0 +1 @@
+export { }
diff --git a/Typescript/types/pixi/canvas-prepare/index.d.ts b/Typescript/types/pixi/canvas-prepare/index.d.ts
new file mode 100644
index 0000000..a75ebf4
--- /dev/null
+++ b/Typescript/types/pixi/canvas-prepare/index.d.ts
@@ -0,0 +1,37 @@
+import { BasePrepare } from 'pixi/prepare';
+import type { CanvasRenderer } from 'pixi/canvas-renderer';
+import type { ExtensionMetadata } from 'pixi/core';
+
+/**
+ * The prepare manager provides functionality to upload content to the GPU.
+ *
+ * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing
+ * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU.
+ *
+ * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare`
+ * @class
+ * @extends PIXI.BasePrepare
+ * @memberof PIXI
+ */
+export declare class CanvasPrepare extends BasePrepare {
+ /** @ignore */
+ static extension: ExtensionMetadata;
+ /**
+ * An offline canvas to render textures to
+ * @internal
+ */
+ canvas: HTMLCanvasElement;
+ /**
+ * The context to the canvas
+ * @internal
+ */
+ ctx: CanvasRenderingContext2D;
+ /**
+ * @param renderer - A reference to the current renderer
+ */
+ constructor(renderer: CanvasRenderer);
+ /** Destroys the plugin, don't use after this */
+ destroy(): void;
+}
+
+export { }
diff --git a/Typescript/types/pixi/canvas-renderer/global.d.ts b/Typescript/types/pixi/canvas-renderer/global.d.ts
new file mode 100644
index 0000000..88baaa0
--- /dev/null
+++ b/Typescript/types/pixi/canvas-renderer/global.d.ts
@@ -0,0 +1,51 @@
+declare namespace GlobalMixins
+{
+ interface BaseTexture
+ {
+ getDrawableSource?(): CanvasImageSource;
+ }
+
+ interface Texture
+ {
+ patternCache?: { [key: string]: CanvasPattern };
+ tintCache?: { [key: string]: HTMLCanvasElement | HTMLImageElement };
+ }
+
+ interface BaseRenderTexture
+ {
+ _canvasRenderTarget: import('pixi/utils').CanvasRenderTarget;
+ }
+
+ interface GlobalTintable
+ {
+ tintId?: number;
+ }
+
+ interface DisplayObject
+ {
+ renderCanvas?(renderer: import('pixi/canvas-renderer').CanvasRenderer): void;
+ }
+
+ interface IRendererOptions
+ {
+ forceCanvas?: boolean;
+ }
+}
+
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
+declare interface CanvasPattern extends GlobalMixins.GlobalTintable
+{
+
+}
+
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
+declare interface HTMLCanvasElement extends GlobalMixins.GlobalTintable
+{
+
+}
+
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
+declare interface HTMLImageElement extends GlobalMixins.GlobalTintable
+{
+
+}
diff --git a/Typescript/types/pixi/canvas-renderer/index.d.ts b/Typescript/types/pixi/canvas-renderer/index.d.ts
new file mode 100644
index 0000000..e732ca2
--- /dev/null
+++ b/Typescript/types/pixi/canvas-renderer/index.d.ts
@@ -0,0 +1,313 @@
+///
+
+import { AbstractRenderer } from 'pixi/core';
+import { BaseRenderTexture } from 'pixi/core';
+import { BLEND_MODES } from 'pixi/constants';
+import type { Container } from 'pixi/display';
+import type { DisplayObject } from 'pixi/display';
+import type { Graphics } from 'pixi/graphics';
+import type { IRendererOptions } from 'pixi/core';
+import type { IRendererPlugin } from 'pixi/core';
+import type { IRendererPlugins } from 'pixi/core';
+import type { IRendererRenderOptions } from 'pixi/core';
+import type { MaskData } from 'pixi/core';
+import { Matrix } from 'pixi/math';
+import { RenderTexture } from 'pixi/core';
+import type { Texture } from 'pixi/core';
+
+/**
+ * Checks whether the Canvas BlendModes are supported by the current browser
+ * @private
+ * @returns {boolean} whether they are supported
+ */
+export declare function canUseNewCanvasBlendModes(): boolean;
+
+/**
+ * A set of functions used to handle masking.
+ *
+ * Sprite masking is not supported on the CanvasRenderer.
+ * @class
+ * @memberof PIXI
+ */
+declare class CanvasMaskManager {
+ /** A reference to the current renderer */
+ private renderer;
+ private _foundShapes;
+ /** @param renderer - A reference to the current renderer */
+ constructor(renderer: CanvasRenderer);
+ /**
+ * This method adds it to the current stack of masks.
+ * @param maskData - the maskData that will be pushed
+ */
+ pushMask(maskData: MaskData | Graphics): void;
+ /**
+ * Renders all PIXI.Graphics shapes in a subtree.
+ * @param container - container to scan.
+ * @param out - where to put found shapes
+ */
+ recursiveFindShapes(container: Container, out: Array): void;
+ /**
+ * Renders a PIXI.Graphics shape.
+ * @param graphics - The object to render.
+ */
+ renderGraphicsShape(graphics: Graphics): void;
+ /**
+ * Restores the current drawing context to the state it was before the mask was applied.
+ * @param renderer - The renderer context to use.
+ */
+ popMask(renderer: CanvasRenderer): void;
+ /** Destroys this canvas mask manager. */
+ destroy(): void;
+}
+
+/**
+ * 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
+ * @memberof PIXI
+ * @extends PIXI.AbstractRenderer
+ */
+export declare class CanvasRenderer extends AbstractRenderer {
+ /**
+ * Fired after rendering finishes.
+ * @event PIXI.CanvasRenderer#postrender
+ */
+ /**
+ * Fired before rendering starts.
+ * @event PIXI.CanvasRenderer#prerender
+ */
+ /** The root canvas 2d context that everything is drawn with. */
+ readonly rootContext: CrossPlatformCanvasRenderingContext2D;
+ /** The currently active canvas 2d context (could change with renderTextures) */
+ context: CrossPlatformCanvasRenderingContext2D;
+ /** Boolean flag controlling canvas refresh. */
+ refresh: boolean;
+ /**
+ * Instance of a CanvasMaskManager, handles masking when using the canvas renderer.
+ * @member {PIXI.CanvasMaskManager}
+ */
+ maskManager: CanvasMaskManager;
+ /** The canvas property used to set the canvas smoothing property. */
+ smoothProperty: SmoothingEnabledProperties;
+ /** Tracks the blend modes useful for this renderer. */
+ readonly blendModes: string[];
+ renderingToScreen: boolean;
+ private _activeBlendMode;
+ /** Projection transform, passed in render() stored here */
+ private _projTransform;
+ /** @private */
+ _outerBlend: boolean;
+ /**
+ * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.
+ * @param {boolean} [options.autoDensity=false] -
+ * Whether the CSS dimensions of the renderer's view should be resized automatically.
+ * @param {number} [options.backgroundAlpha=1] -
+ * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).
+ * @param {number} [options.backgroundColor=0x000000] -
+ * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).
+ * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.
+ * @param {number} [options.height=600] - The height of the renderer's view.
+ * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -
+ * The resolution / device pixel ratio of the renderer.
+ * @param {boolean} [options.transparent] -
+ * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \
+ * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.
+ * @param {boolean} [options.useContextAlpha=true] -
+ * 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`.
+ * @param {HTMLCanvasElement} [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.
+ */
+ constructor(options?: IRendererOptions);
+ /** Adds a new system to the renderer. It does nothing in the CanvasRenderer. */
+ addSystem(): this;
+ /**
+ * Renders the object to its WebGL view.
+ * @param displayObject - The object to be rendered.
+ * @param options - Object to use for render options.
+ * @param {PIXI.RenderTexture} [options.renderTexture] - The render texture to render to.
+ * @param {boolean} [options.clear=true] - Should the canvas be cleared before the new render.
+ * @param {PIXI.Matrix} [options.transform] - A transform to apply to the render texture before rendering.
+ * @param {boolean} [options.skipUpdateTransform=false] - Should we skip the update transform pass?
+ */
+ render(displayObject: DisplayObject, options?: IRendererRenderOptions): void;
+ /**
+ * Please use the `option` render arguments instead.
+ * @deprecated Since 6.0.0
+ * @param displayObject - The object to be rendered.
+ * @param renderTexture - The render texture to render to.
+ * @param clear - Should the canvas be cleared before the new render.
+ * @param transform - A transform to apply to the render texture before rendering.
+ * @param skipUpdateTransform - Should we skip the update transform pass?
+ */
+ render(displayObject: DisplayObject, renderTexture?: RenderTexture | BaseRenderTexture, clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void;
+ /**
+ * Sets matrix of context.
+ * called only from render() methods
+ * takes care about resolution
+ * @param transform - world matrix of current element
+ * @param roundPixels - whether to round (tx,ty) coords
+ * @param localResolution - If specified, used instead of `renderer.resolution` for local scaling
+ */
+ setContextTransform(transform: Matrix, roundPixels?: boolean, localResolution?: number): void;
+ /**
+ * Clear the canvas of renderer.
+ * @param {string} [clearColor] - Clear the canvas with this color, except the canvas is transparent.
+ * @param {number} [alpha] - Alpha to apply to the background fill color.
+ */
+ clear(clearColor?: string, alpha?: number): void;
+ /**
+ * Sets the blend mode of the renderer.
+ * @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.
+ */
+ setBlendMode(blendMode: BLEND_MODES, readyForOuterBlend?: boolean): void;
+ /**
+ * Removes everything from the renderer and optionally removes the Canvas DOM element.
+ * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.
+ */
+ destroy(removeView?: boolean): void;
+ /**
+ * Resizes the canvas view to the specified width and height.
+ * @extends PIXI.AbstractRenderer#resize
+ * @param desiredScreenWidth - the desired width of the screen
+ * @param desiredScreenHeight - the desired height of the screen
+ */
+ resize(desiredScreenWidth: number, desiredScreenHeight: number): void;
+ /** Checks if blend mode has changed. */
+ invalidateBlendMode(): void;
+ static __plugins: IRendererPlugins;
+ /**
+ * Collection of installed plugins. These are included by default in PIXI, but can be excluded
+ * by creating a custom build. Consult the README for more information about creating custom
+ * builds and excluding plugins.
+ * @member {object} plugins
+ * @readonly
+ * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.
+ * @property {PIXI.CanvasExtract} extract Extract image data from renderer.
+ * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.
+ * @property {PIXI.CanvasPrepare} prepare Pre-render display objects.
+ */
+ /**
+ * Use the {@link PIXI.extensions.add} API to register plugins.
+ * @deprecated since 6.5.0
+ * @param pluginName - The name of the plugin.
+ * @param ctor - The constructor function or class for the plugin.
+ */
+ static registerPlugin(pluginName: string, ctor: ICanvasRendererPluginConstructor): void;
+}
+
+/**
+ * Utility methods for Sprite/Texture tinting.
+ *
+ * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture,
+ * so be aware of the performance implications.
+ * @namespace PIXI.canvasUtils
+ * @memberof PIXI
+ */
+export declare const canvasUtils: {
+ canvas: HTMLCanvasElement;
+ /**
+ * Basically this method just needs a sprite and a color and tints the sprite with the given color.
+ * @memberof PIXI.canvasUtils
+ * @param {PIXI.Sprite} sprite - the sprite to tint
+ * @param sprite.texture
+ * @param {number} color - the color to use to tint the sprite with
+ * @returns {HTMLCanvasElement} The tinted canvas
+ */
+ getTintedCanvas: (sprite: {
+ texture: Texture;
+ }, color: number) => HTMLCanvasElement | HTMLImageElement;
+ /**
+ * Basically this method just needs a sprite and a color and tints the sprite with the given color.
+ * @memberof PIXI.canvasUtils
+ * @param {PIXI.Texture} texture - the sprite to tint
+ * @param {number} color - the color to use to tint the sprite with
+ * @returns {HTMLCanvasElement} The tinted canvas
+ */
+ getTintedPattern: (texture: Texture, color: number) => CanvasPattern;
+ /**
+ * Tint a texture using the 'multiply' operation.
+ * @memberof PIXI.canvasUtils
+ * @param {PIXI.Texture} texture - the texture to tint
+ * @param {number} color - the color to use to tint the sprite with
+ * @param {HTMLCanvasElement} canvas - the current canvas
+ */
+ tintWithMultiply: (texture: Texture, color: number, canvas: HTMLCanvasElement) => void;
+ /**
+ * Tint a texture using the 'overlay' operation.
+ * @memberof PIXI.canvasUtils
+ * @param {PIXI.Texture} texture - the texture to tint
+ * @param {number} color - the color to use to tint the sprite with
+ * @param {HTMLCanvasElement} canvas - the current canvas
+ */
+ tintWithOverlay: (texture: Texture, color: number, canvas: HTMLCanvasElement) => void;
+ /**
+ * Tint a texture pixel per pixel.
+ * @memberof PIXI.canvasUtils
+ * @param {PIXI.Texture} texture - the texture to tint
+ * @param {number} color - the color to use to tint the sprite with
+ * @param {HTMLCanvasElement} canvas - the current canvas
+ */
+ tintWithPerPixel: (texture: Texture, color: number, canvas: HTMLCanvasElement) => void;
+ /**
+ * Rounds the specified color according to the canvasUtils.cacheStepsPerColorChannel.
+ * @memberof PIXI.canvasUtils
+ * @param {number} color - the color to round, should be a hex color
+ * @returns {number} The rounded color.
+ */
+ roundColor: (color: number) => number;
+ /**
+ * Number of steps which will be used as a cap when rounding colors.
+ * @memberof PIXI.canvasUtils
+ * @type {number}
+ */
+ cacheStepsPerColorChannel: number;
+ /**
+ * Tint cache boolean flag.
+ * @memberof PIXI.canvasUtils
+ * @type {boolean}
+ */
+ convertTintToImage: boolean;
+ /**
+ * Whether or not the Canvas BlendModes are supported, consequently the ability to tint using the multiply method.
+ * @memberof PIXI.canvasUtils
+ * @type {boolean}
+ */
+ canUseMultiply: boolean;
+ /**
+ * The tinting method that will be used.
+ * @memberof PIXI.canvasUtils
+ * @type {Function}
+ */
+ tintMethod: (texture: Texture, color: number, canvas: HTMLCanvasElement) => void;
+};
+
+/**
+ * Rendering context for all browsers. This includes platform-specific
+ * properties that are not included in the spec for CanvasRenderingContext2D
+ * @private
+ */
+export declare interface CrossPlatformCanvasRenderingContext2D extends CanvasRenderingContext2D {
+ webkitImageSmoothingEnabled: boolean;
+ mozImageSmoothingEnabled: boolean;
+ oImageSmoothingEnabled: boolean;
+ msImageSmoothingEnabled: boolean;
+}
+
+export declare interface ICanvasRendererPluginConstructor {
+ new (renderer: CanvasRenderer, options?: any): IRendererPlugin;
+}
+
+export declare interface ICanvasRendererPlugins {
+ [key: string]: any;
+}
+
+declare type SmoothingEnabledProperties = 'imageSmoothingEnabled' | 'webkitImageSmoothingEnabled' | 'mozImageSmoothingEnabled' | 'oImageSmoothingEnabled' | 'msImageSmoothingEnabled';
+
+export { }
diff --git a/Typescript/types/pixi/canvas-sprite-tiling/global.d.ts b/Typescript/types/pixi/canvas-sprite-tiling/global.d.ts
new file mode 100644
index 0000000..011547f
--- /dev/null
+++ b/Typescript/types/pixi/canvas-sprite-tiling/global.d.ts
@@ -0,0 +1,7 @@
+declare namespace GlobalMixins
+{
+ interface TilingSprite
+ {
+ _canvasPattern: CanvasPattern;
+ }
+}
diff --git a/Typescript/types/pixi/canvas-sprite-tiling/index.d.ts b/Typescript/types/pixi/canvas-sprite-tiling/index.d.ts
new file mode 100644
index 0000000..505f4e8
--- /dev/null
+++ b/Typescript/types/pixi/canvas-sprite-tiling/index.d.ts
@@ -0,0 +1,3 @@
+///
+
+export { }
diff --git a/Typescript/types/pixi/canvas-sprite/global.d.ts b/Typescript/types/pixi/canvas-sprite/global.d.ts
new file mode 100644
index 0000000..fba337d
--- /dev/null
+++ b/Typescript/types/pixi/canvas-sprite/global.d.ts
@@ -0,0 +1,8 @@
+declare namespace GlobalMixins
+{
+ interface Sprite
+ {
+ _tintedCanvas: HTMLCanvasElement | HTMLImageElement;
+ _renderCanvas(renderer: import('pixi/canvas-renderer').CanvasRenderer): void;
+ }
+}
diff --git a/Typescript/types/pixi/canvas-sprite/index.d.ts b/Typescript/types/pixi/canvas-sprite/index.d.ts
new file mode 100644
index 0000000..f983059
--- /dev/null
+++ b/Typescript/types/pixi/canvas-sprite/index.d.ts
@@ -0,0 +1,34 @@
+///
+
+import type { CanvasRenderer } from 'pixi/canvas-renderer';
+import type { ExtensionMetadata } from 'pixi/core';
+import type { Sprite } from 'pixi/sprite';
+
+/**
+ * Types that can be passed to drawImage
+ * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource
+ * @memberof PIXI
+ */
+/**
+ * Renderer dedicated to drawing and batching sprites.
+ * @class
+ * @protected
+ * @memberof PIXI
+ */
+export declare class CanvasSpriteRenderer {
+ /** @ignore */
+ static extension: ExtensionMetadata;
+ /** A reference to the current renderer */
+ protected renderer: CanvasRenderer;
+ /** @param renderer - A reference to the current renderer */
+ constructor(renderer: CanvasRenderer);
+ /**
+ * Renders the sprite object.
+ * @param sprite - the sprite to render when using this spritebatch
+ */
+ render(sprite: Sprite): void;
+ /** destroy the sprite object */
+ destroy(): void;
+}
+
+export { }
diff --git a/Typescript/types/pixi/canvas-text/index.d.ts b/Typescript/types/pixi/canvas-text/index.d.ts
new file mode 100644
index 0000000..f0a766d
--- /dev/null
+++ b/Typescript/types/pixi/canvas-text/index.d.ts
@@ -0,0 +1 @@
+export { }
diff --git a/Typescript/types/pixi/compressed-textures/global.d.ts b/Typescript/types/pixi/compressed-textures/global.d.ts
new file mode 100644
index 0000000..156f0dc
--- /dev/null
+++ b/Typescript/types/pixi/compressed-textures/global.d.ts
@@ -0,0 +1,8 @@
+declare namespace GlobalMixins
+{
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
+ interface BaseTexture
+ {
+ ktxKeyValueData: Map;
+ }
+}
diff --git a/Typescript/types/pixi/compressed-textures/index.d.ts b/Typescript/types/pixi/compressed-textures/index.d.ts
new file mode 100644
index 0000000..ca06454
--- /dev/null
+++ b/Typescript/types/pixi/compressed-textures/index.d.ts
@@ -0,0 +1,420 @@
+///
+
+import type { BaseTexture } from 'pixi/core';
+import { BufferResource } from 'pixi/core';
+import type { ExtensionMetadata } from 'pixi/core';
+import { FORMATS } from 'pixi/constants';
+import type { GLTexture } from 'pixi/core';
+import { LoaderResource } from 'pixi/loaders';
+import type { Renderer } from 'pixi/core';
+import type { Resource } from 'pixi/core';
+import { TYPES } from 'pixi/constants';
+import { ViewableBuffer } from 'pixi/core';
+
+/**
+ * Resource that fetches texture data over the network and stores it in a buffer.
+ * @class
+ * @extends PIXI.Resource
+ * @memberof PIXI
+ */
+export declare abstract class BlobResource extends BufferResource {
+ protected origin: string;
+ protected buffer: ViewableBuffer;
+ protected loaded: boolean;
+ /**
+ * @param {string} source - the URL of the texture file
+ * @param {PIXI.IBlobOptions} options
+ * @param {boolean}[options.autoLoad] - whether to fetch the data immediately;
+ * you can fetch it later via {@link BlobResource#load}
+ * @param {boolean}[options.width] - the width in pixels.
+ * @param {boolean}[options.height] - the height in pixels.
+ */
+ constructor(source: string | Uint8Array | Uint32Array | Float32Array, options?: IBlobOptions);
+ protected onBlobLoaded(_data: ArrayBuffer): void;
+ /** Loads the blob */
+ load(): Promise;
+}
+
+/**
+ * @ignore
+ */
+export declare type CompressedLevelBuffer = {
+ levelID: number;
+ levelWidth: number;
+ levelHeight: number;
+ levelBuffer: Uint8Array;
+};
+
+export declare type CompressedTextureExtensionRef = keyof CompressedTextureExtensions;
+
+/** Compressed texture extensions */
+export declare type CompressedTextureExtensions = {
+ s3tc?: WEBGL_compressed_texture_s3tc;
+ s3tc_sRGB: WEBGL_compressed_texture_s3tc_srgb;
+ etc: any;
+ etc1: any;
+ pvrtc: any;
+ atc: any;
+ astc: WEBGL_compressed_texture_astc;
+};
+
+/**
+ * Loader plugin for handling compressed textures for all platforms.
+ * @class
+ * @memberof PIXI
+ * @implements {PIXI.ILoaderPlugin}
+ */
+export declare class CompressedTextureLoader {
+ /** @ignore */
+ static extension: ExtensionMetadata;
+ /** Map of available texture extensions. */
+ private static _textureExtensions;
+ /** Map of available texture formats. */
+ private static _textureFormats;
+ /**
+ * Called after a compressed-textures manifest is loaded.
+ *
+ * This will then load the correct compression format for the device. Your manifest should adhere
+ * to the following schema:
+ *
+ * ```js
+ * import { INTERNAL_FORMATS } from 'pixi/constants';
+ *
+ * type CompressedTextureManifest = {
+ * textures: Array<{ src: string, format?: keyof INTERNAL_FORMATS}>,
+ * cacheID: string;
+ * };
+ * ```
+ *
+ * This is an example of a .json manifest file
+ *
+ * ```json
+ * {
+ * "cacheID":"asset",
+ * "textures":[
+ * { "src":"asset.fallback.png" },
+ * { "format":"COMPRESSED_RGBA_S3TC_DXT5_EXT", "src":"asset.s3tc.ktx" },
+ * { "format":"COMPRESSED_RGBA8_ETC2_EAC", "src":"asset.etc.ktx" },
+ * { "format":"RGBA_PVRTC_4BPPV1_IMG", "src":"asset.pvrtc.ktx" }
+ * ]
+ * }
+ * ```
+ */
+ static use(resource: LoaderResource, next: (...args: any[]) => void): void;
+ /** Map of available texture extensions. */
+ static get textureExtensions(): Partial;
+ /** Map of available texture formats. */
+ static get textureFormats(): {
+ [P in keyof INTERNAL_FORMATS]?: number;
+ };
+}
+
+/**
+ * Schema for compressed-texture manifests
+ * @ignore
+ * @see PIXI.CompressedTextureLoader
+ */
+export declare type CompressedTextureManifest = {
+ textures: Array<{
+ src: string;
+ format?: keyof INTERNAL_FORMATS;
+ }>;
+ cacheID: string;
+};
+
+/**
+ * Resource for compressed texture formats, as follows: S3TC/DXTn (& their sRGB formats), ATC, ASTC, ETC 1/2, PVRTC.
+ *
+ * Compressed textures improve performance when rendering is texture-bound. The texture data stays compressed in
+ * graphics memory, increasing memory locality and speeding up texture fetches. These formats can also be used to store
+ * more detail in the same amount of memory.
+ *
+ * For most developers, container file formats are a better abstraction instead of directly handling raw texture
+ * data. PixiJS provides native support for the following texture file formats (via {@link PIXI.Loader}):
+ *
+ * **.dds** - the DirectDraw Surface file format stores DXTn (DXT-1,3,5) data. See {@link PIXI.DDSLoader}
+ * **.ktx** - the Khronos Texture Container file format supports storing all the supported WebGL compression formats.
+ * See {@link PIXI.KTXLoader}.
+ * **.basis** - the BASIS supercompressed file format stores texture data in an internal format that is transcoded
+ * to the compression format supported on the device at _runtime_. It also supports transcoding into a uncompressed
+ * format as a fallback; you must install the `@pixi/basis-loader`, `@pixi/basis-transcoder` packages separately to
+ * use these files. See {@link PIXI.BasisLoader}.
+ *
+ * The loaders for the aforementioned formats use `CompressedTextureResource` internally. It is strongly suggested that
+ * they be used instead.
+ *
+ * ## Working directly with CompressedTextureResource
+ *
+ * Since `CompressedTextureResource` inherits `BlobResource`, you can provide it a URL pointing to a file containing
+ * the raw texture data (with no file headers!):
+ *
+ * ```js
+ * // The resource backing the texture data for your textures.
+ * // NOTE: You can also provide a ArrayBufferView instead of a URL. This is used when loading data from a container file
+ * // format such as KTX, DDS, or BASIS.
+ * const compressedResource = new PIXI.CompressedTextureResource("bunny.dxt5", {
+ * format: PIXI.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,
+ * width: 256,
+ * height: 256
+ * });
+ *
+ * // You can create a base-texture to the cache, so that future `Texture`s can be created using the `Texture.from` API.
+ * const baseTexture = new PIXI.BaseTexture(compressedResource, { pmaMode: PIXI.ALPHA_MODES.NPM });
+ *
+ * // Create a Texture to add to the TextureCache
+ * const texture = new PIXI.Texture(baseTexture);
+ *
+ * // Add baseTexture & texture to the global texture cache
+ * PIXI.BaseTexture.addToCache(baseTexture, "bunny.dxt5");
+ * PIXI.Texture.addToCache(texture, "bunny.dxt5");
+ * ```
+ * @memberof PIXI
+ */
+export declare class CompressedTextureResource extends BlobResource {
+ /** The compression format */
+ format: INTERNAL_FORMATS;
+ /**
+ * The number of mipmap levels stored in the resource buffer.
+ * @default 1
+ */
+ levels: number;
+ private _extension;
+ private _levelBuffers;
+ /**
+ * @param source - the buffer/URL holding the compressed texture data
+ * @param options
+ * @param {PIXI.INTERNAL_FORMATS} options.format - the compression format
+ * @param {number} options.width - the image width in pixels.
+ * @param {number} options.height - the image height in pixels.
+ * @param {number} [options.level=1] - the mipmap levels stored in the compressed texture, including level 0.
+ * @param {number} [options.levelBuffers] - the buffers for each mipmap level. `CompressedTextureResource` can allows you
+ * to pass `null` for `source`, for cases where each level is stored in non-contiguous memory.
+ */
+ constructor(source: string | Uint8Array | Uint32Array, options: ICompressedTextureResourceOptions);
+ /**
+ * @override
+ * @param renderer - A reference to the current renderer
+ * @param _texture - the texture
+ * @param _glTexture - texture instance for this webgl context
+ */
+ upload(renderer: Renderer, _texture: BaseTexture, _glTexture: GLTexture): boolean;
+ /** @protected */
+ protected onBlobLoaded(): void;
+ /**
+ * Returns the key (to ContextSystem#extensions) for the WebGL extension supporting the compression format
+ * @private
+ * @param format - the compression format to get the extension for.
+ */
+ private static _formatToExtension;
+ /**
+ * Pre-creates buffer views for each mipmap level
+ * @private
+ * @param buffer -
+ * @param format - compression formats
+ * @param levels - mipmap levels
+ * @param blockWidth -
+ * @param blockHeight -
+ * @param imageWidth - width of the image in pixels
+ * @param imageHeight - height of the image in pixels
+ */
+ private static _createLevelBuffers;
+}
+
+/**
+ * @class
+ * @memberof PIXI
+ * @implements {PIXI.ILoaderPlugin}
+ * @see https://docs.microsoft.com/en-us/windows/win32/direct3ddds/dx-graphics-dds-pguide
+ */
+export declare class DDSLoader {
+ /** @ignore */
+ static extension: ExtensionMetadata;
+ /**
+ * Registers a DDS compressed texture
+ * @see PIXI.Loader.loaderMiddleware
+ * @param resource - loader resource that is checked to see if it is a DDS file
+ * @param next - callback Function to call when done
+ */
+ static use(resource: LoaderResource, next: (...args: any[]) => void): void;
+}
+
+/**
+ * Number of components in each {@link PIXI.FORMATS}
+ * @ignore
+ */
+export declare const FORMATS_TO_COMPONENTS: {
+ [id: number]: number;
+};
+
+declare interface IBlobOptions {
+ autoLoad?: boolean;
+ width: number;
+ height: number;
+}
+
+/**
+ * @ignore
+ */
+export declare interface ICompressedTextureResourceOptions {
+ format: INTERNAL_FORMATS;
+ width: number;
+ height: number;
+ levels?: number;
+ levelBuffers?: CompressedLevelBuffer[];
+}
+
+/**
+ * Maps the compressed texture formats in {@link PIXI.INTERNAL_FORMATS} to the number of bytes taken by
+ * each texel.
+ * @memberof PIXI
+ * @static
+ * @ignore
+ */
+export declare const INTERNAL_FORMAT_TO_BYTES_PER_PIXEL: {
+ [id: number]: number;
+};
+
+/**
+ * WebGL internal formats, including compressed texture formats provided by extensions
+ * @memberof PIXI
+ * @static
+ * @name INTERNAL_FORMATS
+ * @enum {number}
+ * @property {number} [COMPRESSED_RGB_S3TC_DXT1_EXT=0x83F0] -
+ * @property {number} [COMPRESSED_RGBA_S3TC_DXT1_EXT=0x83F1] -
+ * @property {number} [COMPRESSED_RGBA_S3TC_DXT3_EXT=0x83F2] -
+ * @property {number} [COMPRESSED_RGBA_S3TC_DXT5_EXT=0x83F3] -
+ * @property {number} [COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917] -
+ * @property {number} [COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918] -
+ * @property {number} [COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919] -
+ * @property {number} [COMPRESSED_SRGB_S3TC_DXT1_EXT=35916] -
+ * @property {number} [COMPRESSED_R11_EAC=0x9270] -
+ * @property {number} [COMPRESSED_SIGNED_R11_EAC=0x9271] -
+ * @property {number} [COMPRESSED_RG11_EAC=0x9272] -
+ * @property {number} [COMPRESSED_SIGNED_RG11_EAC=0x9273] -
+ * @property {number} [COMPRESSED_RGB8_ETC2=0x9274] -
+ * @property {number} [COMPRESSED_RGBA8_ETC2_EAC=0x9278] -
+ * @property {number} [COMPRESSED_SRGB8_ETC2=0x9275] -
+ * @property {number} [COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=0x9279] -
+ * @property {number} [COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=0x9276] -
+ * @property {number} [COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=0x9277] -
+ * @property {number} [COMPRESSED_RGB_PVRTC_4BPPV1_IMG=0x8C00] -
+ * @property {number} [COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=0x8C02] -
+ * @property {number} [COMPRESSED_RGB_PVRTC_2BPPV1_IMG=0x8C01] -
+ * @property {number} [COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=0x8C03] -
+ * @property {number} [COMPRESSED_RGB_ETC1_WEBGL=0x8D64] -
+ * @property {number} [COMPRESSED_RGB_ATC_WEBGL=0x8C92] -
+ * @property {number} [COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=0x8C92] -
+ * @property {number} [COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=0x87EE] -
+ * @property {number} [COMPRESSED_RGBA_ASTC_4x4_KHR=0x93B0] -
+ */
+export declare enum INTERNAL_FORMATS {
+ COMPRESSED_RGB_S3TC_DXT1_EXT = 33776,
+ COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777,
+ COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778,
+ COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779,
+ COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917,
+ COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918,
+ COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919,
+ COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916,
+ COMPRESSED_R11_EAC = 37488,
+ COMPRESSED_SIGNED_R11_EAC = 37489,
+ COMPRESSED_RG11_EAC = 37490,
+ COMPRESSED_SIGNED_RG11_EAC = 37491,
+ COMPRESSED_RGB8_ETC2 = 37492,
+ COMPRESSED_RGBA8_ETC2_EAC = 37496,
+ COMPRESSED_SRGB8_ETC2 = 37493,
+ COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497,
+ COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494,
+ COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495,
+ COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840,
+ COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842,
+ COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841,
+ COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843,
+ COMPRESSED_RGB_ETC1_WEBGL = 36196,
+ COMPRESSED_RGB_ATC_WEBGL = 35986,
+ COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 35986,
+ COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798,
+ COMPRESSED_RGBA_ASTC_4x4_KHR = 37808
+}
+
+/**
+ * Loader plugin for handling KTX texture container files.
+ *
+ * This KTX loader does not currently support the following features:
+ * * cube textures
+ * * 3D textures
+ * * endianness conversion for big-endian machines
+ * * embedded *.basis files
+ *
+ * It does supports the following features:
+ * * multiple textures per file
+ * * mipmapping (only for compressed formats)
+ * * vendor-specific key/value data parsing (enable {@link PIXI.KTXLoader.loadKeyValueData})
+ * @class
+ * @memberof PIXI
+ * @implements {PIXI.ILoaderPlugin}
+ */
+export declare class KTXLoader {
+ /** @ignore */
+ static extension: ExtensionMetadata;
+ /**
+ * If set to `true`, {@link PIXI.KTXLoader} will parse key-value data in KTX textures. This feature relies
+ * on the [Encoding Standard]{@link https://encoding.spec.whatwg.org}.
+ *
+ * The key-value data will be available on the base-textures as {@code PIXI.BaseTexture.ktxKeyValueData}. They
+ * will hold a reference to the texture data buffer, so make sure to delete key-value data once you are done
+ * using it.
+ */
+ static loadKeyValueData: boolean;
+ /**
+ * Called after a KTX file is loaded.
+ *
+ * This will parse the KTX file header and add a {@code BaseTexture} to the texture
+ * cache.
+ * @see PIXI.Loader.loaderMiddleware
+ * @param resource - loader resource that is checked to see if it is a KTX file
+ * @param next - callback Function to call when done
+ */
+ static use(resource: LoaderResource, next: (...args: any[]) => void): void;
+}
+
+/**
+ * @class
+ * @memberof PIXI
+ * @implements {PIXI.ILoaderPlugin}
+ * @see https://docs.microsoft.com/en-us/windows/win32/direct3ddds/dx-graphics-dds-pguide
+ */
+/**
+ * Parses the DDS file header, generates base-textures, and puts them into the texture cache.
+ * @param arrayBuffer
+ */
+export declare function parseDDS(arrayBuffer: ArrayBuffer): CompressedTextureResource[];
+
+export declare function parseKTX(url: string, arrayBuffer: ArrayBuffer, loadKeyValueData?: boolean): {
+ compressed?: CompressedTextureResource[];
+ uncompressed?: {
+ resource: BufferResource;
+ type: TYPES;
+ format: FORMATS;
+ }[];
+ kvData: Map | null;
+};
+
+/**
+ * Maps {@link PIXI.TYPES} to the bytes taken per component, excluding those ones that are bit-fields.
+ * @ignore
+ */
+export declare const TYPES_TO_BYTES_PER_COMPONENT: {
+ [id: number]: number;
+};
+
+/**
+ * Number of bytes per pixel in bit-field types in {@link PIXI.TYPES}
+ * @ignore
+ */
+export declare const TYPES_TO_BYTES_PER_PIXEL: {
+ [id: number]: number;
+};
+
+export { }
diff --git a/Typescript/types/pixi/constants/index.d.ts b/Typescript/types/pixi/constants/index.d.ts
new file mode 100644
index 0000000..af71e20
--- /dev/null
+++ b/Typescript/types/pixi/constants/index.d.ts
@@ -0,0 +1,506 @@
+/**
+ * How to treat textures with premultiplied alpha
+ * @name ALPHA_MODES
+ * @memberof PIXI
+ * @static
+ * @enum {number}
+ * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.
+ * Option for compressed and data textures that are created from typed arrays.
+ * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.
+ * Default option, used for all loaded images.
+ * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied
+ * Example: spine atlases with `_pma` suffix.
+ * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.
+ * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.
+ * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.
+ */
+export declare enum ALPHA_MODES {
+ NPM = 0,
+ UNPACK = 1,
+ PMA = 2,
+ NO_PREMULTIPLIED_ALPHA = 0,
+ PREMULTIPLY_ON_UPLOAD = 1,
+ PREMULTIPLY_ALPHA = 2,
+ PREMULTIPLIED_ALPHA = 2
+}
+
+/**
+ * Various blend modes supported by PIXI.
+ *
+ * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.
+ * Anything else will silently act like NORMAL.
+ * @memberof PIXI
+ * @name BLEND_MODES
+ * @enum {number}
+ * @property {number} NORMAL -
+ * @property {number} ADD -
+ * @property {number} MULTIPLY -
+ * @property {number} SCREEN -
+ * @property {number} OVERLAY -
+ * @property {number} DARKEN -
+ * @property {number} LIGHTEN -
+ * @property {number} COLOR_DODGE -
+ * @property {number} COLOR_BURN -
+ * @property {number} HARD_LIGHT -
+ * @property {number} SOFT_LIGHT -
+ * @property {number} DIFFERENCE -
+ * @property {number} EXCLUSION -
+ * @property {number} HUE -
+ * @property {number} SATURATION -
+ * @property {number} COLOR -
+ * @property {number} LUMINOSITY -
+ * @property {number} NORMAL_NPM -
+ * @property {number} ADD_NPM -
+ * @property {number} SCREEN_NPM -
+ * @property {number} NONE -
+ * @property {number} SRC_IN -
+ * @property {number} SRC_OUT -
+ * @property {number} SRC_ATOP -
+ * @property {number} DST_OVER -
+ * @property {number} DST_IN -
+ * @property {number} DST_OUT -
+ * @property {number} DST_ATOP -
+ * @property {number} SUBTRACT -
+ * @property {number} SRC_OVER -
+ * @property {number} ERASE -
+ * @property {number} XOR -
+ */
+export declare enum BLEND_MODES {
+ NORMAL = 0,
+ ADD = 1,
+ MULTIPLY = 2,
+ SCREEN = 3,
+ OVERLAY = 4,
+ DARKEN = 5,
+ LIGHTEN = 6,
+ COLOR_DODGE = 7,
+ COLOR_BURN = 8,
+ HARD_LIGHT = 9,
+ SOFT_LIGHT = 10,
+ DIFFERENCE = 11,
+ EXCLUSION = 12,
+ HUE = 13,
+ SATURATION = 14,
+ COLOR = 15,
+ LUMINOSITY = 16,
+ NORMAL_NPM = 17,
+ ADD_NPM = 18,
+ SCREEN_NPM = 19,
+ NONE = 20,
+ SRC_OVER = 0,
+ SRC_IN = 21,
+ SRC_OUT = 22,
+ SRC_ATOP = 23,
+ DST_OVER = 24,
+ DST_IN = 25,
+ DST_OUT = 26,
+ DST_ATOP = 27,
+ ERASE = 26,
+ SUBTRACT = 28,
+ XOR = 29
+}
+
+/**
+ * Bitwise OR of masks that indicate the buffers to be cleared.
+ * @static
+ * @memberof PIXI
+ * @name BUFFER_BITS
+ * @enum {number}
+ * @property {number} COLOR - Indicates the buffers currently enabled for color writing.
+ * @property {number} DEPTH - Indicates the depth buffer.
+ * @property {number} STENCIL - Indicates the stencil buffer.
+ */
+export declare enum BUFFER_BITS {
+ COLOR = 16384,
+ DEPTH = 256,
+ STENCIL = 1024
+}
+
+/**
+ * Constants for various buffer types in Pixi
+ * @see PIXI.BUFFER_TYPE
+ * @name BUFFER_TYPE
+ * @memberof PIXI
+ * @static
+ * @enum {number}
+ * @property {number} ELEMENT_ARRAY_BUFFER - buffer type for using as an index buffer
+ * @property {number} ARRAY_BUFFER - buffer type for using attribute data
+ * @property {number} UNIFORM_BUFFER - the buffer type is for uniform buffer objects
+ */
+export declare enum BUFFER_TYPE {
+ ELEMENT_ARRAY_BUFFER = 34963,
+ ARRAY_BUFFER = 34962,
+ UNIFORM_BUFFER = 35345
+}
+
+/**
+ * Configure whether filter textures are cleared after binding.
+ *
+ * Filter textures need not be cleared if the filter does not use pixel blending. {@link CLEAR_MODES.BLIT} will detect
+ * this and skip clearing as an optimization.
+ * @name CLEAR_MODES
+ * @memberof PIXI
+ * @static
+ * @enum {number}
+ * @property {number} BLEND - Do not clear the filter texture. The filter's output will blend on top of the output texture.
+ * @property {number} CLEAR - Always clear the filter texture.
+ * @property {number} BLIT - Clear only if {@link FilterSystem.forceClear} is set or if the filter uses pixel blending.
+ * @property {number} NO - Alias for BLEND, same as `false` in earlier versions
+ * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions
+ * @property {number} AUTO - Alias for BLIT
+ */
+export declare enum CLEAR_MODES {
+ NO = 0,
+ YES = 1,
+ AUTO = 2,
+ BLEND = 0,
+ CLEAR = 1,
+ BLIT = 2
+}
+
+/**
+ * Bitwise OR of masks that indicate the color channels that are rendered to.
+ * @static
+ * @memberof PIXI
+ * @name COLOR_MASK_BITS
+ * @enum {number}
+ * @property {number} RED - Red channel.
+ * @property {number} GREEN - Green channel
+ * @property {number} BLUE - Blue channel.
+ * @property {number} ALPHA - Alpha channel.
+ */
+export declare enum COLOR_MASK_BITS {
+ RED = 1,
+ GREEN = 2,
+ BLUE = 4,
+ ALPHA = 8
+}
+
+/**
+ * Various webgl draw modes. These can be used to specify which GL drawMode to use
+ * under certain situations and renderers.
+ * @memberof PIXI
+ * @static
+ * @name DRAW_MODES
+ * @enum {number}
+ * @property {number} POINTS -
+ * @property {number} LINES -
+ * @property {number} LINE_LOOP -
+ * @property {number} LINE_STRIP -
+ * @property {number} TRIANGLES -
+ * @property {number} TRIANGLE_STRIP -
+ * @property {number} TRIANGLE_FAN -
+ */
+export declare enum DRAW_MODES {
+ POINTS = 0,
+ LINES = 1,
+ LINE_LOOP = 2,
+ LINE_STRIP = 3,
+ TRIANGLES = 4,
+ TRIANGLE_STRIP = 5,
+ TRIANGLE_FAN = 6
+}
+
+/**
+ * Different types of environments for WebGL.
+ * @static
+ * @memberof PIXI
+ * @name ENV
+ * @enum {number}
+ * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility
+ * with older / less advanced devices. If you experience unexplained flickering prefer this environment.
+ * @property {number} WEBGL - Version 1 of WebGL
+ * @property {number} WEBGL2 - Version 2 of WebGL
+ */
+export declare enum ENV {
+ WEBGL_LEGACY = 0,
+ WEBGL = 1,
+ WEBGL2 = 2
+}
+
+/**
+ * Various GL texture/resources formats.
+ * @memberof PIXI
+ * @static
+ * @name FORMATS
+ * @enum {number}
+ * @property {number} [RGBA=6408] -
+ * @property {number} [RGB=6407] -
+ * @property {number} [RG=33319] -
+ * @property {number} [RED=6403] -
+ * @property {number} [RGBA_INTEGER=36249] -
+ * @property {number} [RGB_INTEGER=36248] -
+ * @property {number} [RG_INTEGER=33320] -
+ * @property {number} [RED_INTEGER=36244] -
+ * @property {number} [ALPHA=6406] -
+ * @property {number} [LUMINANCE=6409] -
+ * @property {number} [LUMINANCE_ALPHA=6410] -
+ * @property {number} [DEPTH_COMPONENT=6402] -
+ * @property {number} [DEPTH_STENCIL=34041] -
+ */
+export declare enum FORMATS {
+ RGBA = 6408,
+ RGB = 6407,
+ RG = 33319,
+ RED = 6403,
+ RGBA_INTEGER = 36249,
+ RGB_INTEGER = 36248,
+ RG_INTEGER = 33320,
+ RED_INTEGER = 36244,
+ ALPHA = 6406,
+ LUMINANCE = 6409,
+ LUMINANCE_ALPHA = 6410,
+ DEPTH_COMPONENT = 6402,
+ DEPTH_STENCIL = 34041
+}
+
+/**
+ * The gc modes that are supported by pixi.
+ *
+ * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO
+ * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not
+ * used for a specified period of time they will be removed from the GPU. They will of course
+ * be uploaded again when they are required. This is a silent behind the scenes process that
+ * should ensure that the GPU does not get filled up.
+ *
+ * Handy for mobile devices!
+ * This property only affects WebGL.
+ * @name GC_MODES
+ * @enum {number}
+ * @static
+ * @memberof PIXI
+ * @property {number} AUTO - Garbage collection will happen periodically automatically
+ * @property {number} MANUAL - Garbage collection will need to be called manually
+ */
+export declare enum GC_MODES {
+ AUTO = 0,
+ MANUAL = 1
+}
+
+/**
+ * Constants for mask implementations.
+ * We use `type` suffix because it leads to very different behaviours
+ * @name MASK_TYPES
+ * @memberof PIXI
+ * @static
+ * @enum {number}
+ * @property {number} NONE - Mask is ignored
+ * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap
+ * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil
+ * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture
+ * @property {number} COLOR - Color mask (RGBA)
+ */
+export declare enum MASK_TYPES {
+ NONE = 0,
+ SCISSOR = 1,
+ STENCIL = 2,
+ SPRITE = 3,
+ COLOR = 4
+}
+
+/**
+ * Mipmap filtering modes that are supported by pixi.
+ *
+ * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.
+ * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,
+ * or its `POW2` and texture dimensions are powers of 2.
+ * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.
+ *
+ * This property only affects WebGL.
+ * @name MIPMAP_MODES
+ * @memberof PIXI
+ * @static
+ * @enum {number}
+ * @property {number} OFF - No mipmaps
+ * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2
+ * @property {number} ON - Always generate mipmaps
+ * @property {number} ON_MANUAL - Use mipmaps, but do not auto-generate them; this is used with a resource
+ * that supports buffering each level-of-detail.
+ */
+export declare enum MIPMAP_MODES {
+ OFF = 0,
+ POW2 = 1,
+ ON = 2,
+ ON_MANUAL = 3
+}
+
+/**
+ * Constants for multi-sampling antialiasing.
+ * @see PIXI.Framebuffer#multisample
+ * @name MSAA_QUALITY
+ * @memberof PIXI
+ * @static
+ * @enum {number}
+ * @property {number} NONE - No multisampling for this renderTexture
+ * @property {number} LOW - Try 2 samples
+ * @property {number} MEDIUM - Try 4 samples
+ * @property {number} HIGH - Try 8 samples
+ */
+export declare enum MSAA_QUALITY {
+ NONE = 0,
+ LOW = 2,
+ MEDIUM = 4,
+ HIGH = 8
+}
+
+/**
+ * Constants that specify float precision in shaders.
+ * @name PRECISION
+ * @memberof PIXI
+ * @constant
+ * @static
+ * @enum {string}
+ * @property {string} [LOW='lowp'] -
+ * @property {string} [MEDIUM='mediump'] -
+ * @property {string} [HIGH='highp'] -
+ */
+export declare enum PRECISION {
+ LOW = "lowp",
+ MEDIUM = "mediump",
+ HIGH = "highp"
+}
+
+/**
+ * Constant to identify the Renderer Type.
+ * @static
+ * @memberof PIXI
+ * @name RENDERER_TYPE
+ * @enum {number}
+ * @property {number} UNKNOWN - Unknown render type.
+ * @property {number} WEBGL - WebGL render type.
+ * @property {number} CANVAS - Canvas render type.
+ */
+export declare enum RENDERER_TYPE {
+ UNKNOWN = 0,
+ WEBGL = 1,
+ CANVAS = 2
+}
+
+/**
+ * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively.
+ * WebGL1 works only with FLOAT.
+ * @memberof PIXI
+ * @static
+ * @name SAMPLER_TYPES
+ * @enum {number}
+ * @property {number} [FLOAT=0] -
+ * @property {number} [INT=1] -
+ * @property {number} [UINT=2] -
+ */
+export declare enum SAMPLER_TYPES {
+ FLOAT = 0,
+ INT = 1,
+ UINT = 2
+}
+
+/**
+ * The scale modes that are supported by pixi.
+ *
+ * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.
+ * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.
+ * @memberof PIXI
+ * @static
+ * @name SCALE_MODES
+ * @enum {number}
+ * @property {number} LINEAR Smooth scaling
+ * @property {number} NEAREST Pixelating scaling
+ */
+export declare enum SCALE_MODES {
+ NEAREST = 0,
+ LINEAR = 1
+}
+
+/**
+ * Various GL target types.
+ * @memberof PIXI
+ * @static
+ * @name TARGETS
+ * @enum {number}
+ * @property {number} [TEXTURE_2D=3553] -
+ * @property {number} [TEXTURE_CUBE_MAP=34067] -
+ * @property {number} [TEXTURE_2D_ARRAY=35866] -
+ * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_X=34069] -
+ * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_X=34070] -
+ * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Y=34071] -
+ * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Y=34072] -
+ * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Z=34073] -
+ * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Z=34074] -
+ */
+export declare enum TARGETS {
+ TEXTURE_2D = 3553,
+ TEXTURE_CUBE_MAP = 34067,
+ TEXTURE_2D_ARRAY = 35866,
+ TEXTURE_CUBE_MAP_POSITIVE_X = 34069,
+ TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,
+ TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,
+ TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,
+ TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,
+ TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074
+}
+
+/**
+ * Various GL data format types.
+ * @memberof PIXI
+ * @static
+ * @name TYPES
+ * @enum {number}
+ * @property {number} [UNSIGNED_BYTE=5121] -
+ * @property {number} [UNSIGNED_SHORT=5123] -
+ * @property {number} [UNSIGNED_SHORT_5_6_5=33635] -
+ * @property {number} [UNSIGNED_SHORT_4_4_4_4=32819] -
+ * @property {number} [UNSIGNED_SHORT_5_5_5_1=32820] -
+ * @property {number} [UNSIGNED_INT=5125] -
+ * @property {number} [UNSIGNED_INT_10F_11F_11F_REV=35899] -
+ * @property {number} [UNSIGNED_INT_2_10_10_10_REV=33640] -
+ * @property {number} [UNSIGNED_INT_24_8=34042] -
+ * @property {number} [UNSIGNED_INT_5_9_9_9_REV=35902] -
+ * @property {number} [BYTE=5120] -
+ * @property {number} [SHORT=5122] -
+ * @property {number} [INT=5124] -
+ * @property {number} [FLOAT=5126] -
+ * @property {number} [FLOAT_32_UNSIGNED_INT_24_8_REV=36269] -
+ * @property {number} [HALF_FLOAT=36193] -
+ */
+export declare enum TYPES {
+ UNSIGNED_BYTE = 5121,
+ UNSIGNED_SHORT = 5123,
+ UNSIGNED_SHORT_5_6_5 = 33635,
+ UNSIGNED_SHORT_4_4_4_4 = 32819,
+ UNSIGNED_SHORT_5_5_5_1 = 32820,
+ UNSIGNED_INT = 5125,
+ UNSIGNED_INT_10F_11F_11F_REV = 35899,
+ UNSIGNED_INT_2_10_10_10_REV = 33640,
+ UNSIGNED_INT_24_8 = 34042,
+ UNSIGNED_INT_5_9_9_9_REV = 35902,
+ BYTE = 5120,
+ SHORT = 5122,
+ INT = 5124,
+ FLOAT = 5126,
+ FLOAT_32_UNSIGNED_INT_24_8_REV = 36269,
+ HALF_FLOAT = 36193
+}
+
+/**
+ * The wrap modes that are supported by pixi.
+ *
+ * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.
+ * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.
+ * If the texture is non power of two then clamp will be used regardless as WebGL can
+ * only use REPEAT if the texture is po2.
+ *
+ * This property only affects WebGL.
+ * @name WRAP_MODES
+ * @memberof PIXI
+ * @static
+ * @enum {number}
+ * @property {number} CLAMP - The textures uvs are clamped
+ * @property {number} REPEAT - The texture uvs tile and repeat
+ * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring
+ */
+export declare enum WRAP_MODES {
+ CLAMP = 33071,
+ REPEAT = 10497,
+ MIRRORED_REPEAT = 33648
+}
+
+export { }
diff --git a/Typescript/types/pixi/core/global.d.ts b/Typescript/types/pixi/core/global.d.ts
new file mode 100644
index 0000000..cbbebad
--- /dev/null
+++ b/Typescript/types/pixi/core/global.d.ts
@@ -0,0 +1,26 @@
+declare namespace GlobalMixins
+{
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
+ interface BaseTexture
+ {
+
+ }
+
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
+ interface Texture
+ {
+
+ }
+
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
+ interface BaseRenderTexture
+ {
+
+ }
+
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
+ interface IRendererOptions
+ {
+
+ }
+}
diff --git a/Typescript/types/pixi/core/index.d.ts b/Typescript/types/pixi/core/index.d.ts
new file mode 100644
index 0000000..7126536
--- /dev/null
+++ b/Typescript/types/pixi/core/index.d.ts
@@ -0,0 +1,5467 @@
+///
+
+///
+
+import { ALPHA_MODES } from 'pixi/constants';
+import type { ArrayFixed } from 'pixi/utils';
+import type { BaseTexture as BaseTexture_2 } from 'pixi/core';
+import { BLEND_MODES } from 'pixi/constants';
+import { BUFFER_BITS } from 'pixi/constants';
+import { BUFFER_TYPE } from 'pixi/constants';
+import { CLEAR_MODES } from 'pixi/constants';
+import type { COLOR_MASK_BITS } from 'pixi/constants';
+import type { Dict } from 'pixi/utils';
+import { DRAW_MODES } from 'pixi/constants';
+import { EventEmitter } from 'pixi/utils';
+import { FORMATS } from 'pixi/constants';
+import { GC_MODES } from 'pixi/constants';
+import type { IPointData } from 'pixi/math';
+import type { ISize } from 'pixi/math';
+import type { ISpriteMaskFilter as ISpriteMaskFilter_2 } from 'pixi/core';
+import { MASK_TYPES } from 'pixi/constants';
+import { Matrix } from 'pixi/math';
+import type { MIPMAP_MODES } from 'pixi/constants';
+import { MSAA_QUALITY } from 'pixi/constants';
+import { Point } from 'pixi/math';
+import { Rectangle } from 'pixi/math';
+import { RENDERER_TYPE } from 'pixi/constants';
+import { Runner } from 'pixi/runner';
+import { SCALE_MODES } from 'pixi/constants';
+import { TARGETS } from 'pixi/constants';
+import { TYPES } from 'pixi/constants';
+import type { WRAP_MODES } from 'pixi/constants';
+
+/**
+ * Renderer dedicated to drawing and batching sprites.
+ *
+ * This is the default batch renderer. It buffers objects
+ * with texture-based geometries and renders them in
+ * batches. It uploads multiple textures to the GPU to
+ * reduce to the number of draw calls.
+ * @memberof PIXI
+ */
+export declare class AbstractBatchRenderer extends ObjectRenderer {
+ /** The WebGL state in which this renderer will work. */
+ readonly state: State;
+ /**
+ * The number of bufferable objects before a flush
+ * occurs automatically.
+ * @default settings.SPRITE_BATCH_SIZE * 4
+ */
+ size: number;
+ /**
+ * Maximum number of textures that can be uploaded to
+ * the GPU under the current context. It is initialized
+ * properly in `this.contextChange`.
+ * @see PIXI.AbstractBatchRenderer#contextChange
+ * @readonly
+ */
+ MAX_TEXTURES: number;
+ /**
+ * This is used to generate a shader that can
+ * color each vertex based on a `aTextureId`
+ * attribute that points to an texture in `uSampler`.
+ *
+ * This enables the objects with different textures
+ * to be drawn in the same draw call.
+ *
+ * You can customize your shader by creating your
+ * custom shader generator.
+ */
+ protected shaderGenerator: BatchShaderGenerator;
+ /**
+ * The class that represents the geometry of objects
+ * that are going to be batched with this.
+ * @member {object}
+ * @default PIXI.BatchGeometry
+ */
+ protected geometryClass: typeof BatchGeometry;
+ /**
+ * Size of data being buffered per vertex in the
+ * attribute buffers (in floats). By default, the
+ * batch-renderer plugin uses 6:
+ *
+ * | aVertexPosition | 2 |
+ * |-----------------|---|
+ * | aTextureCoords | 2 |
+ * | aColor | 1 |
+ * | aTextureId | 1 |
+ * @readonly
+ */
+ protected vertexSize: number;
+ /** Total count of all vertices used by the currently buffered objects. */
+ protected _vertexCount: number;
+ /** Total count of all indices used by the currently buffered objects. */
+ protected _indexCount: number;
+ /**
+ * Buffer of objects that are yet to be rendered.
+ * @member {PIXI.DisplayObject[]}
+ */
+ protected _bufferedElements: Array;
+ /**
+ * Data for texture batch builder, helps to save a bit of CPU on a pass.
+ * @member {PIXI.BaseTexture[]}
+ */
+ protected _bufferedTextures: Array;
+ /** Number of elements that are buffered and are waiting to be flushed. */
+ protected _bufferSize: number;
+ /**
+ * This shader is generated by `this.shaderGenerator`.
+ *
+ * It is generated specifically to handle the required
+ * number of textures being batched together.
+ */
+ protected _shader: Shader;
+ /**
+ * A flush may occur multiple times in a single
+ * frame. On iOS devices or when
+ * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the
+ * batch renderer does not upload data to the same
+ * `WebGLBuffer` for performance reasons.
+ *
+ * This is the index into `packedGeometries` that points to
+ * geometry holding the most recent buffers.
+ */
+ protected _flushId: number;
+ /**
+ * Pool of `ViewableBuffer` objects that are sorted in
+ * order of increasing size. The flush method uses
+ * the buffer with the least size above the amount
+ * it requires. These are used for passing attributes.
+ *
+ * The first buffer has a size of 8; each subsequent
+ * buffer has double capacity of its previous.
+ * @member {PIXI.ViewableBuffer[]}
+ * @see PIXI.AbstractBatchRenderer#getAttributeBuffer
+ */
+ protected _aBuffers: Array;
+ /**
+ * Pool of `Uint16Array` objects that are sorted in
+ * order of increasing size. The flush method uses
+ * the buffer with the least size above the amount
+ * it requires. These are used for passing indices.
+ *
+ * The first buffer has a size of 12; each subsequent
+ * buffer has double capacity of its previous.
+ * @member {Uint16Array[]}
+ * @see PIXI.AbstractBatchRenderer#getIndexBuffer
+ */
+ protected _iBuffers: Array;
+ protected _dcIndex: number;
+ protected _aIndex: number;
+ protected _iIndex: number;
+ protected _attributeBuffer: ViewableBuffer;
+ protected _indexBuffer: Uint16Array;
+ protected _tempBoundTextures: BaseTexture[];
+ /**
+ * Pool of `this.geometryClass` geometry objects
+ * that store buffers. They are used to pass data
+ * to the shader on each draw call.
+ *
+ * These are never re-allocated again, unless a
+ * context change occurs; however, the pool may
+ * be expanded if required.
+ * @member {PIXI.Geometry[]}
+ * @see PIXI.AbstractBatchRenderer.contextChange
+ */
+ private _packedGeometries;
+ /**
+ * Size of `this._packedGeometries`. It can be expanded
+ * if more than `this._packedGeometryPoolSize` flushes
+ * occur in a single frame.
+ */
+ private _packedGeometryPoolSize;
+ /**
+ * This will hook onto the renderer's `contextChange`
+ * and `prerender` signals.
+ * @param {PIXI.Renderer} renderer - The renderer this works for.
+ */
+ constructor(renderer: Renderer);
+ /**
+ * Handles the `contextChange` signal.
+ *
+ * It calculates `this.MAX_TEXTURES` and allocating the packed-geometry object pool.
+ */
+ contextChange(): void;
+ /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */
+ initFlushBuffers(): void;
+ /** Handles the `prerender` signal. It ensures that flushes start from the first geometry object again. */
+ onPrerender(): void;
+ /**
+ * Buffers the "batchable" object. It need not be rendered immediately.
+ * @param {PIXI.DisplayObject} element - the element to render when
+ * using this renderer
+ */
+ render(element: IBatchableElement): void;
+ buildTexturesAndDrawCalls(): void;
+ /**
+ * Populating drawcalls for rendering
+ * @param texArray
+ * @param start
+ * @param finish
+ */
+ buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void;
+ /**
+ * Bind textures for current rendering
+ * @param texArray
+ */
+ bindAndClearTexArray(texArray: BatchTextureArray): void;
+ updateGeometry(): void;
+ drawBatches(): void;
+ /** Renders the content _now_ and empties the current batch. */
+ flush(): void;
+ /** Starts a new sprite batch. */
+ start(): void;
+ /** Stops and flushes the current batch. */
+ stop(): void;
+ /** Destroys this `AbstractBatchRenderer`. It cannot be used again. */
+ destroy(): void;
+ /**
+ * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats.
+ * @param size - minimum capacity required
+ * @returns - buffer than can hold atleast `size` floats
+ */
+ getAttributeBuffer(size: number): ViewableBuffer;
+ /**
+ * Fetches an index buffer from `this._iBuffers` that can
+ * have at least `size` capacity.
+ * @param size - minimum required capacity
+ * @returns - buffer that can fit `size` indices.
+ */
+ getIndexBuffer(size: number): Uint16Array;
+ /**
+ * Takes the four batching parameters of `element`, interleaves
+ * and pushes them into the batching attribute/index buffers given.
+ *
+ * It uses these properties: `vertexData` `uvs`, `textureId` and
+ * `indicies`. It also uses the "tint" of the base-texture, if
+ * present.
+ * @param {PIXI.DisplayObject} element - element being rendered
+ * @param attributeBuffer - attribute buffer.
+ * @param indexBuffer - index buffer
+ * @param aIndex - number of floats already in the attribute buffer
+ * @param iIndex - number of indices already in `indexBuffer`
+ */
+ packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array, aIndex: number, iIndex: number): void;
+ /**
+ * Pool of `BatchDrawCall` objects that `flush` used
+ * to create "batches" of the objects being rendered.
+ *
+ * These are never re-allocated again.
+ * Shared between all batch renderers because it can be only one "flush" working at the moment.
+ * @member {PIXI.BatchDrawCall[]}
+ */
+ static _drawCallPool: Array;
+ /**
+ * Pool of `BatchDrawCall` objects that `flush` used
+ * to create "batches" of the objects being rendered.
+ *
+ * These are never re-allocated again.
+ * Shared between all batch renderers because it can be only one "flush" working at the moment.
+ * @member {PIXI.BatchTextureArray[]}
+ */
+ static _textureArrayPool: Array;
+}
+
+/**
+ * System plugin to the renderer to manage specific types of masking operations.
+ * @memberof PIXI
+ */
+declare class AbstractMaskSystem implements ISystem {
+ /**
+ * The mask stack
+ * @member {PIXI.MaskData[]}
+ */
+ protected maskStack: Array;
+ /**
+ * Constant for gl.enable
+ * @private
+ */
+ protected glConst: number;
+ protected renderer: Renderer;
+ /**
+ * @param renderer - The renderer this System works for.
+ */
+ constructor(renderer: Renderer);
+ /** Gets count of masks of certain type. */
+ getStackLength(): number;
+ /**
+ * Changes the mask stack that is used by this System.
+ * @param {PIXI.MaskData[]} maskStack - The mask stack
+ */
+ setMaskStack(maskStack: Array): void;
+ /**
+ * Setup renderer to use the current mask data.
+ * @private
+ */
+ protected _useCurrent(): void;
+ /** Destroys the mask stack. */
+ destroy(): void;
+}
+
+/**
+ * Resource that can manage several resource (items) inside.
+ * All resources need to have the same pixel size.
+ * Parent class for CubeResource and ArrayResource
+ * @memberof PIXI
+ */
+export declare abstract class AbstractMultiResource extends Resource {
+ /** Number of elements in array. */
+ readonly length: number;
+ /**
+ * Collection of partial baseTextures that correspond to resources.
+ * @readonly
+ */
+ items: Array;
+ /**
+ * Dirty IDs for each part.
+ * @readonly
+ */
+ itemDirtyIds: Array;
+ /**
+ * Promise when loading.
+ * @default null
+ */
+ private _load;
+ /** Bound baseTexture, there can only be one. */
+ baseTexture: BaseTexture;
+ /**
+ * @param length
+ * @param options - Options to for Resource constructor
+ * @param {number} [options.width] - Width of the resource
+ * @param {number} [options.height] - Height of the resource
+ */
+ constructor(length: number, options?: ISize);
+ /**
+ * Used from ArrayResource and CubeResource constructors.
+ * @param resources - Can be resources, image elements, canvas, etc. ,
+ * length should be same as constructor length
+ * @param options - Detect options for resources
+ */
+ protected initFromArray(resources: Array, options?: IAutoDetectOptions): void;
+ /** Destroy this BaseImageResource. */
+ dispose(): void;
+ /**
+ * Set a baseTexture by ID
+ * @param baseTexture
+ * @param index - Zero-based index of resource to set
+ * @returns - Instance for chaining
+ */
+ abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;
+ /**
+ * Set a resource by ID
+ * @param resource
+ * @param index - Zero-based index of resource to set
+ * @returns - Instance for chaining
+ */
+ addResourceAt(resource: Resource, index: number): this;
+ /**
+ * Set the parent base texture.
+ * @param baseTexture
+ */
+ bind(baseTexture: BaseTexture): void;
+ /**
+ * Unset the parent base texture.
+ * @param baseTexture
+ */
+ unbind(baseTexture: BaseTexture): void;
+ /**
+ * Load all the resources simultaneously
+ * @returns - When load is resolved
+ */
+ load(): Promise;
+}
+
+/**
+ * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}
+ * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.
+ * @abstract
+ * @class
+ * @extends PIXI.utils.EventEmitter
+ * @memberof PIXI
+ */
+export declare abstract class AbstractRenderer extends EventEmitter {
+ resolution: number;
+ clearBeforeRender?: boolean;
+ readonly options: IRendererOptions;
+ readonly type: RENDERER_TYPE;
+ readonly screen: Rectangle;
+ readonly view: HTMLCanvasElement;
+ readonly plugins: IRendererPlugins;
+ readonly useContextAlpha: boolean | 'notMultiplied';
+ readonly autoDensity: boolean;
+ readonly preserveDrawingBuffer: boolean;
+ protected _backgroundColor: number;
+ protected _backgroundColorString: string;
+ _backgroundColorRgba: number[];
+ _lastObjectRendered: IRenderableObject;
+ /**
+ * @param type - The renderer type.
+ * @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} [options.backgroundAlpha=1] -
+ * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).
+ * @param {number} [options.backgroundColor=0x000000] -
+ * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).
+ * @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 {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} [options.transparent] -
+ * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \
+ * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.
+ * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -
+ * 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 {HTMLCanvasElement} [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.
+ */
+ constructor(type?: RENDERER_TYPE, options?: IRendererOptions);
+ /**
+ * Initialize the plugins.
+ * @protected
+ * @param {object} staticMap - The dictionary of statically saved plugins.
+ */
+ initPlugins(staticMap: IRendererPlugins): void;
+ /**
+ * Same as view.width, actual number of pixels in the canvas by horizontal.
+ * @member {number}
+ * @readonly
+ * @default 800
+ */
+ get width(): number;
+ /**
+ * Same as view.height, actual number of pixels in the canvas by vertical.
+ * @member {number}
+ * @readonly
+ * @default 600
+ */
+ get height(): number;
+ /**
+ * Resizes the screen and canvas as close as possible to the specified width and height.
+ * Canvas dimensions are multiplied by resolution and rounded to the nearest integers.
+ * The new canvas dimensions divided by the resolution become the new screen dimensions.
+ * @param desiredScreenWidth - The desired width of the screen.
+ * @param desiredScreenHeight - The desired height of the screen.
+ */
+ resize(desiredScreenWidth: number, desiredScreenHeight: number): void;
+ /**
+ * Useful function that returns a texture of the display object that can then be used to create sprites
+ * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.
+ * @method PIXI.AbstractRenderer#generateTexture
+ * @param displayObject - The displayObject the object will be generated from.
+ * @param {object} options - Generate texture options.
+ * @param {PIXI.SCALE_MODES} options.scaleMode - The scale mode of the texture.
+ * @param {number} options.resolution - The resolution / device pixel ratio of the texture being generated.
+ * @param {PIXI.Rectangle} options.region - The region of the displayObject, that shall be rendered,
+ * if no region is specified, defaults to the local bounds of the displayObject.
+ * @param {PIXI.MSAA_QUALITY} options.multisample - The number of samples of the frame buffer.
+ * @returns A texture of the graphics object.
+ */
+ generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture;
+ /**
+ * Please use the options argument instead.
+ * @method PIXI.AbstractRenderer#generateTexture
+ * @deprecated Since 6.1.0
+ * @param displayObject - The displayObject the object will be generated from.
+ * @param scaleMode - The scale mode of the texture.
+ * @param resolution - The resolution / device pixel ratio of the texture being generated.
+ * @param region - The region of the displayObject, that shall be rendered,
+ * if no region is specified, defaults to the local bounds of the displayObject.
+ * @returns A texture of the graphics object.
+ */
+ generateTexture(displayObject: IRenderableObject, scaleMode?: SCALE_MODES, resolution?: number, region?: Rectangle): RenderTexture;
+ /**
+ * Adds a new system to the renderer.
+ * @param ClassRef - Class reference
+ * @param name - Property name for system
+ * @returns Return instance of renderer
+ */
+ abstract addSystem(ClassRef: ISystemConstructor, name: string): this;
+ abstract render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;
+ /**
+ * Removes everything from the renderer and optionally removes the Canvas DOM element.
+ * @param [removeView=false] - Removes the Canvas element from the DOM.
+ */
+ destroy(removeView?: boolean): void;
+ /**
+ * The background color to fill if not transparent
+ * @member {number}
+ */
+ get backgroundColor(): number;
+ set backgroundColor(value: number);
+ /**
+ * The background color alpha. Setting this to 0 will make the canvas transparent.
+ * @member {number}
+ */
+ get backgroundAlpha(): number;
+ set backgroundAlpha(value: number);
+}
+
+/**
+ * A resource that contains a number of sources.
+ * @memberof PIXI
+ */
+export declare class ArrayResource extends AbstractMultiResource {
+ /**
+ * @param source - Number of items in array or the collection
+ * of image URLs to use. Can also be resources, image elements, canvas, etc.
+ * @param options - Options to apply to {@link PIXI.autoDetectResource}
+ * @param {number} [options.width] - Width of the resource
+ * @param {number} [options.height] - Height of the resource
+ */
+ constructor(source: number | Array, options?: ISize);
+ /**
+ * Set a baseTexture by ID,
+ * ArrayResource just takes resource from it, nothing more
+ * @param baseTexture
+ * @param index - Zero-based index of resource to set
+ * @returns - Instance for chaining
+ */
+ addBaseTextureAt(baseTexture: BaseTexture, index: number): this;
+ /**
+ * Add binding
+ * @param baseTexture
+ */
+ bind(baseTexture: BaseTexture): void;
+ /**
+ * Upload the resources to the GPU.
+ * @param renderer
+ * @param texture
+ * @param glTexture
+ * @returns - whether texture was uploaded
+ */
+ upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean;
+}
+
+/**
+ * Holds the information for a single attribute structure required to render geometry.
+ *
+ * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}
+ * This can include anything from positions, uvs, normals, colors etc.
+ * @memberof PIXI
+ */
+export declare class Attribute {
+ buffer: number;
+ size: number;
+ normalized: boolean;
+ type: TYPES;
+ stride: number;
+ start: number;
+ instance: boolean;
+ /**
+ * @param buffer - the id of the buffer that this attribute will look for
+ * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.
+ * @param normalized - should the data be normalized.
+ * @param {PIXI.TYPES} [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)
+ * @param [start=0] - How far into the array to start reading values (used for interleaving data)
+ * @param [instance=false] - Whether the geometry is instanced.
+ */
+ constructor(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number, start?: number, instance?: boolean);
+ /** Destroys the Attribute. */
+ destroy(): void;
+ /**
+ * Helper function that creates an Attribute based on the information provided
+ * @param buffer - the id of the buffer that this attribute will look for
+ * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2
+ * @param [normalized=false] - should the data be normalized.
+ * @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)
+ * @returns - A new {@link PIXI.Attribute} based on the information provided
+ */
+ static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute;
+}
+
+/**
+ * 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.
+ * @memberof PIXI
+ * @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} [options.backgroundAlpha=1] -
+ * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).
+ * @param {number} [options.backgroundColor=0x000000] -
+ * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).
+ * @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 is ignored.
+ * @param {number} [options.height=600] - The height of the renderer's view.
+ * @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} [options.transparent] -
+ * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \
+ * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.
+ * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -
+ * 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 {HTMLCanvasElement} [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 {PIXI.Renderer|PIXI.CanvasRenderer}
+ * Returns {@link PIXI.Renderer} if WebGL is available, otherwise {@link PIXI.CanvasRenderer}.
+ */
+export declare function autoDetectRenderer(options?: IRendererOptionsAuto): AbstractRenderer;
+
+/**
+ * Create a resource element from a single source element. This
+ * auto-detects which type of resource to create. All resources that
+ * are auto-detectable must have a static `test` method and a constructor
+ * with the arguments `(source, options?)`. Currently, the supported
+ * resources for auto-detection include:
+ * - {@link PIXI.ImageResource}
+ * - {@link PIXI.CanvasResource}
+ * - {@link PIXI.VideoResource}
+ * - {@link PIXI.SVGResource}
+ * - {@link PIXI.BufferResource}
+ * @static
+ * @memberof PIXI
+ * @function autoDetectResource
+ * @param {string|*} source - Resource source, this can be the URL to the resource,
+ * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri
+ * or any other resource that can be auto-detected. If not resource is
+ * detected, it's assumed to be an ImageResource.
+ * @param {object} [options] - Pass-through options to use for Resource
+ * @param {number} [options.width] - Width of BufferResource or SVG rasterization
+ * @param {number} [options.height] - Height of BufferResource or SVG rasterization
+ * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading
+ * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height
+ * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object
+ * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin
+ * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately
+ * @param {number} [options.updateFPS=0] - Video option to update how many times a second the
+ * texture should be updated from the video. Leave at 0 to update at every render
+ * @returns {PIXI.Resource} The created resource.
+ */
+export declare function autoDetectResource(source: unknown, options?: RO): R;
+
+/**
+ * Base for all the image/canvas resources.
+ * @memberof PIXI
+ */
+export declare class BaseImageResource extends Resource {
+ /**
+ * The source element.
+ * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}
+ * @readonly
+ */
+ source: ImageSource;
+ /**
+ * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.
+ * Certain types of media (e.g. video) using `texImage2D` is more performant.
+ * @default false
+ * @private
+ */
+ noSubImage: boolean;
+ /**
+ * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source
+ */
+ constructor(source: ImageSource);
+ /**
+ * Set cross origin based detecting the url and the crossorigin
+ * @param element - Element to apply crossOrigin
+ * @param url - URL to check
+ * @param crossorigin - Cross origin value to use
+ */
+ static crossOrigin(element: HTMLImageElement | HTMLVideoElement, url: string, crossorigin?: boolean | string): void;
+ /**
+ * Upload the texture to the GPU.
+ * @param renderer - Upload to the renderer
+ * @param baseTexture - Reference to parent texture
+ * @param glTexture
+ * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] - (optional)
+ * @returns - true is success
+ */
+ upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean;
+ /**
+ * Checks if source width/height was changed, resize can cause extra baseTexture update.
+ * Triggers one update in any case.
+ */
+ update(): void;
+ /** Destroy this {@link BaseImageResource} */
+ dispose(): void;
+}
+
+export declare interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {
+}
+
+/**
+ * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.
+ *
+ * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded
+ * otherwise black rectangles will be drawn instead.
+ *
+ * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position
+ * and rotation of the given Display Objects is ignored. For example:
+ *
+ * ```js
+ * let renderer = PIXI.autoDetectRenderer();
+ * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });
+ * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);
+ * let sprite = PIXI.Sprite.from("spinObj_01.png");
+ *
+ * sprite.position.x = 800/2;
+ * sprite.position.y = 600/2;
+ * sprite.anchor.x = 0.5;
+ * sprite.anchor.y = 0.5;
+ *
+ * renderer.render(sprite, {renderTexture});
+ * ```
+ *
+ * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0
+ * you can clear the transform
+ *
+ * ```js
+ *
+ * sprite.setTransform()
+ *
+ * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });
+ * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);
+ *
+ * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture
+ * ```
+ * @memberof PIXI
+ */
+export declare class BaseRenderTexture extends BaseTexture {
+ clearColor: number[];
+ framebuffer: Framebuffer;
+ /** The data structure for the stencil masks. */
+ maskStack: Array;
+ /** The data structure for the filters. */
+ filterStack: Array;
+ /**
+ * @param options
+ * @param {number} [options.width=100] - The width of the base render texture.
+ * @param {number} [options.height=100] - The height of the base render texture.
+ * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}
+ * for possible values.
+ * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio
+ * of the texture being generated.
+ * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer.
+ */
+ constructor(options?: IBaseTextureOptions);
+ /**
+ * Resizes the BaseRenderTexture.
+ * @param desiredWidth - The desired width to resize to.
+ * @param desiredHeight - The desired height to resize to.
+ */
+ resize(desiredWidth: number, desiredHeight: number): void;
+ /**
+ * Frees the texture and framebuffer from WebGL memory without destroying this texture object.
+ * This means you can still use the texture later which will upload it to GPU
+ * memory again.
+ * @fires PIXI.BaseTexture#dispose
+ */
+ dispose(): void;
+ /** Destroys this texture. */
+ destroy(): void;
+}
+
+export declare interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {
+}
+
+/**
+ * A Texture stores the information that represents an image.
+ * All textures have a base texture, which contains information about the source.
+ * Therefore you can have many textures all using a single BaseTexture
+ * @memberof PIXI
+ * @typeParam R - The BaseTexture's Resource type.
+ * @typeParam RO - The options for constructing resource.
+ */
+export declare class BaseTexture extends EventEmitter {
+ /**
+ * The width of the base texture set when the image has loaded
+ * @readonly
+ */
+ width: number;
+ /**
+ * The height of the base texture set when the image has loaded
+ * @readonly
+ */
+ height: number;
+ /**
+ * The resolution / device pixel ratio of the texture
+ * @readonly
+ * @default PIXI.settings.RESOLUTION
+ */
+ resolution: number;
+ /**
+ * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.
+ * @member {PIXI.ALPHA_MODES}
+ * @default PIXI.ALPHA_MODES.UNPACK
+ */
+ alphaMode?: ALPHA_MODES;
+ /**
+ * Anisotropic filtering level of texture
+ * @member {number}
+ * @default PIXI.settings.ANISOTROPIC_LEVEL
+ */
+ anisotropicLevel?: number;
+ /**
+ * The pixel format of the texture
+ * @default PIXI.FORMATS.RGBA
+ */
+ format?: FORMATS;
+ /**
+ * The type of resource data
+ * @default PIXI.TYPES.UNSIGNED_BYTE
+ */
+ type?: TYPES;
+ /**
+ * The target type
+ * @default PIXI.TARGETS.TEXTURE_2D
+ */
+ target?: TARGETS;
+ /**
+ * Global unique identifier for this BaseTexture
+ * @protected
+ */
+ readonly uid: number;
+ /**
+ * Used by automatic texture Garbage Collection, stores last GC tick when it was bound
+ * @protected
+ */
+ touched: number;
+ /**
+ * Whether or not the texture is a power of two, try to use power of two textures as much
+ * as you can
+ * @readonly
+ * @default false
+ */
+ isPowerOfTwo: boolean;
+ /**
+ * The map of render context textures where this is bound
+ * @private
+ */
+ _glTextures: {
+ [key: number]: GLTexture;
+ };
+ /**
+ * Used by TextureSystem to only update texture to the GPU when needed.
+ * Please call `update()` to increment it.
+ * @readonly
+ */
+ dirtyId: number;
+ /**
+ * Used by TextureSystem to only update texture style when needed.
+ * @protected
+ */
+ dirtyStyleId: number;
+ /**
+ * Currently default cache ID.
+ * @member {string}
+ */
+ cacheId: string;
+ /**
+ * Generally speaking means when resource is loaded.
+ * @readonly
+ * @member {boolean}
+ */
+ valid: boolean;
+ /**
+ * The collection of alternative cache ids, since some BaseTextures
+ * can have more than one ID, short name and longer full URL
+ * @member {Array}
+ * @readonly
+ */
+ textureCacheIds: Array;
+ /**
+ * Flag if BaseTexture has been destroyed.
+ * @member {boolean}
+ * @readonly
+ */
+ destroyed: boolean;
+ /**
+ * The resource used by this BaseTexture, there can only
+ * be one resource per BaseTexture, but textures can share
+ * resources.
+ * @member {PIXI.Resource}
+ * @readonly
+ */
+ resource: R;
+ /**
+ * Number of the texture batch, used by multi-texture renderers
+ * @member {number}
+ */
+ _batchEnabled: number;
+ /**
+ * Location inside texture batch, used by multi-texture renderers
+ * @member {number}
+ */
+ _batchLocation: number;
+ /**
+ * Whether its a part of another texture, handled by ArrayResource or CubeResource
+ * @member {PIXI.BaseTexture}
+ */
+ parentTextureArray: BaseTexture;
+ private _mipmap?;
+ private _scaleMode?;
+ private _wrapMode?;
+ /**
+ * @param {PIXI.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] -
+ * The current resource to use, for things that aren't Resource objects, will be converted
+ * into a Resource.
+ * @param options - Collection of options
+ * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture
+ * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture
+ * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures
+ * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest
+ * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type
+ * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type
+ * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target
+ * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha
+ * @param {number} [options.width=0] - Width of the texture
+ * @param {number} [options.height=0] - Height of the texture
+ * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture
+ * @param {object} [options.resourceOptions] - Optional resource options,
+ * see {@link PIXI.autoDetectResource autoDetectResource}
+ */
+ constructor(resource?: R | ImageSource | string | any, options?: IBaseTextureOptions);
+ /**
+ * Pixel width of the source of this texture
+ * @readonly
+ */
+ get realWidth(): number;
+ /**
+ * Pixel height of the source of this texture
+ * @readonly
+ */
+ get realHeight(): number;
+ /**
+ * Mipmap mode of the texture, affects downscaled images
+ * @default PIXI.settings.MIPMAP_TEXTURES
+ */
+ get mipmap(): MIPMAP_MODES;
+ set mipmap(value: MIPMAP_MODES);
+ /**
+ * The scale mode to apply when scaling this texture
+ * @default PIXI.settings.SCALE_MODE
+ */
+ get scaleMode(): SCALE_MODES;
+ set scaleMode(value: SCALE_MODES);
+ /**
+ * How the texture wraps
+ * @default PIXI.settings.WRAP_MODE
+ */
+ get wrapMode(): WRAP_MODES;
+ set wrapMode(value: WRAP_MODES);
+ /**
+ * Changes style options of BaseTexture
+ * @param scaleMode - Pixi scalemode
+ * @param mipmap - enable mipmaps
+ * @returns - this
+ */
+ setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this;
+ /**
+ * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.
+ * @param desiredWidth - Desired visual width
+ * @param desiredHeight - Desired visual height
+ * @param resolution - Optionally set resolution
+ * @returns - this
+ */
+ setSize(desiredWidth: number, desiredHeight: number, resolution?: number): this;
+ /**
+ * Sets real size of baseTexture, preserves current resolution.
+ * @param realWidth - Full rendered width
+ * @param realHeight - Full rendered height
+ * @param resolution - Optionally set resolution
+ * @returns - this
+ */
+ setRealSize(realWidth: number, realHeight: number, resolution?: number): this;
+ /**
+ * Refresh check for isPowerOfTwo texture based on size
+ * @private
+ */
+ protected _refreshPOT(): void;
+ /**
+ * Changes resolution
+ * @param resolution - res
+ * @returns - this
+ */
+ setResolution(resolution: number): this;
+ /**
+ * Sets the resource if it wasn't set. Throws error if resource already present
+ * @param resource - that is managing this BaseTexture
+ * @returns - this
+ */
+ setResource(resource: R): this;
+ /** Invalidates the object. Texture becomes valid if width and height are greater than zero. */
+ update(): void;
+ /**
+ * Handle errors with resources.
+ * @private
+ * @param event - Error event emitted.
+ */
+ onError(event: ErrorEvent): void;
+ /**
+ * Destroys this base texture.
+ * The method stops if resource doesn't want this texture to be destroyed.
+ * Removes texture from all caches.
+ */
+ destroy(): void;
+ /**
+ * Frees the texture from WebGL memory without destroying this texture object.
+ * This means you can still use the texture later which will upload it to GPU
+ * memory again.
+ * @fires PIXI.BaseTexture#dispose
+ */
+ dispose(): void;
+ /** Utility function for BaseTexture|Texture cast. */
+ castToBaseTexture(): BaseTexture;
+ /**
+ * Helper function that creates a base texture based on the source you provide.
+ * The source can be - image url, image element, canvas element. If the
+ * source is an image url or an image element and not in the base texture
+ * cache, it will be created and loaded.
+ * @static
+ * @param {string|string[]|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The
+ * source to create base texture from.
+ * @param options - See {@link PIXI.BaseTexture}'s constructor for options.
+ * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id
+ * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.
+ * @returns {PIXI.BaseTexture} The new base texture.
+ */
+ static from(source: ImageSource | string | string[], options?: IBaseTextureOptions, strict?: boolean): BaseTexture;
+ /**
+ * Create a new BaseTexture with a BufferResource from a Float32Array.
+ * RGBA values are floats from 0 to 1.
+ * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data
+ * is provided, a new Float32Array is created.
+ * @param width - Width of the resource
+ * @param height - Height of the resource
+ * @param options - See {@link PIXI.BaseTexture}'s constructor for options.
+ * Default properties are different from the constructor's defaults.
+ * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type
+ * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.NPM] - Image alpha, not premultiplied by default
+ * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.SCALE_MODES.NEAREST] - Scale mode, pixelating by default
+ * @returns - The resulting new BaseTexture
+ */
+ static fromBuffer(buffer: Float32Array | Uint8Array, width: number, height: number, options?: IBaseTextureOptions): BaseTexture;
+ /**
+ * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.
+ * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.
+ * @param {string} id - The id that the BaseTexture will be stored against.
+ */
+ static addToCache(baseTexture: BaseTexture, id: string): void;
+ /**
+ * Remove a BaseTexture from the global BaseTextureCache.
+ * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.
+ * @returns {PIXI.BaseTexture|null} The BaseTexture that was removed.
+ */
+ static removeFromCache(baseTexture: string | BaseTexture): BaseTexture | null;
+ /** Global number of the texture batch, used by multi-texture renderers. */
+ static _globalBatch: number;
+}
+
+/**
+ * Used by the batcher to draw batches.
+ * Each one of these contains all information required to draw a bound geometry.
+ * @memberof PIXI
+ */
+export declare class BatchDrawCall {
+ texArray: BatchTextureArray;
+ type: DRAW_MODES;
+ blend: BLEND_MODES;
+ start: number;
+ size: number;
+ /** Data for uniforms or custom webgl state. */
+ data: any;
+ constructor();
+}
+
+/**
+ * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).
+ * @memberof PIXI
+ */
+export declare class BatchGeometry extends Geometry {
+ /**
+ * Buffer used for position, color, texture IDs
+ * @protected
+ */
+ _buffer: Buffer_2;
+ /**
+ * Index buffer data
+ * @protected
+ */
+ _indexBuffer: Buffer_2;
+ /**
+ * @param {boolean} [_static=false] - Optimization flag, where `false`
+ * is updated every frame, `true` doesn't change frame-to-frame.
+ */
+ constructor(_static?: boolean);
+}
+
+/** @memberof PIXI */
+export declare class BatchPluginFactory {
+ /**
+ * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way
+ * to extend BatchRenderer with all the necessary pieces.
+ * @example
+ * const fragment = `
+ * varying vec2 vTextureCoord;
+ * varying vec4 vColor;
+ * varying float vTextureId;
+ * uniform sampler2D uSamplers[%count%];
+ *
+ * void main(void){
+ * vec4 color;
+ * %forloop%
+ * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);
+ * }
+ * `;
+ * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });
+ * PIXI.extensions.add({
+ * name: 'invert',
+ * ref: InvertBatchRenderer,
+ * type: PIXI.ExtensionType.RendererPlugin,
+ * });
+ * const sprite = new PIXI.Sprite();
+ * sprite.pluginName = 'invert';
+ * @param {object} [options]
+ * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source
+ * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template
+ * @param {number} [options.vertexSize=6] - Vertex size
+ * @param {object} [options.geometryClass=PIXI.BatchGeometry]
+ * @returns {*} New batch renderer plugin
+ */
+ static create(options?: IBatchFactoryOptions): typeof AbstractBatchRenderer;
+ /**
+ * The default vertex shader source
+ * @readonly
+ */
+ static get defaultVertexSrc(): string;
+ /**
+ * The default fragment shader source
+ * @readonly
+ */
+ static get defaultFragmentTemplate(): string;
+}
+
+export declare const BatchRenderer: typeof AbstractBatchRenderer;
+
+/**
+ * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer
+ * @memberof PIXI
+ */
+export declare class BatchShaderGenerator {
+ /** Reference to the vertex shader source. */
+ vertexSrc: string;
+ /** Reference to the fragment shader template. Must contain "%count%" and "%forloop%". */
+ fragTemplate: string;
+ programCache: {
+ [key: number]: Program;
+ };
+ defaultGroupCache: {
+ [key: number]: UniformGroup;
+ };
+ /**
+ * @param vertexSrc - Vertex shader
+ * @param fragTemplate - Fragment shader template
+ */
+ constructor(vertexSrc: string, fragTemplate: string);
+ generateShader(maxTextures: number): Shader;
+ generateSampleSrc(maxTextures: number): string;
+}
+
+/**
+ * System plugin to the renderer to manage batching.
+ * @memberof PIXI
+ */
+export declare class BatchSystem implements ISystem {
+ /** An empty renderer. */
+ readonly emptyRenderer: ObjectRenderer;
+ /** The currently active ObjectRenderer. */
+ currentRenderer: ObjectRenderer;
+ private renderer;
+ /**
+ * @param renderer - The renderer this System works for.
+ */
+ constructor(renderer: Renderer);
+ /**
+ * Changes the current renderer to the one given in parameter
+ * @param objectRenderer - The object renderer to use.
+ */
+ setObjectRenderer(objectRenderer: ObjectRenderer): void;
+ /**
+ * This should be called if you wish to do some custom rendering
+ * It will basically render anything that may be batched up such as sprites
+ */
+ flush(): void;
+ /** Reset the system to an empty renderer */
+ reset(): void;
+ /**
+ * Handy function for batch renderers: copies bound textures in first maxTextures locations to array
+ * sets actual _batchLocation for them
+ * @param arr - arr copy destination
+ * @param maxTextures - number of copied elements
+ */
+ copyBoundTextures(arr: BaseTexture[], maxTextures: number): void;
+ /**
+ * Assigns batch locations to textures in array based on boundTextures state.
+ * All textures in texArray should have `_batchEnabled = _batchId`,
+ * and their count should be less than `maxTextures`.
+ * @param texArray - textures to bound
+ * @param boundTextures - current state of bound textures
+ * @param batchId - marker for _batchEnabled param of textures in texArray
+ * @param maxTextures - number of texture locations to manipulate
+ */
+ boundArray(texArray: BatchTextureArray, boundTextures: Array, batchId: number, maxTextures: number): void;
+ /**
+ * @ignore
+ */
+ destroy(): void;
+}
+
+/**
+ * Used by the batcher to build texture batches.
+ * Holds list of textures and their respective locations.
+ * @memberof PIXI
+ */
+export declare class BatchTextureArray {
+ /** Inside textures array. */
+ elements: BaseTexture_2[];
+ /** Respective locations for textures. */
+ ids: number[];
+ /** Number of filled elements. */
+ count: number;
+ constructor();
+ clear(): void;
+}
+
+/**
+ * A wrapper for data so that it can be used and uploaded by WebGL
+ * @memberof PIXI
+ */
+declare class Buffer_2 {
+ /**
+ * The data in the buffer, as a typed array
+ * @type {PIXI.IArrayBuffer}
+ */
+ data: ITypedArray;
+ /**
+ * The type of buffer this is, one of:
+ * + ELEMENT_ARRAY_BUFFER - used as an index buffer
+ * + ARRAY_BUFFER - used as an attribute buffer
+ * + UNIFORM_BUFFER - used as a uniform buffer (if available)
+ */
+ type: BUFFER_TYPE;
+ static: boolean;
+ id: number;
+ disposeRunner: Runner;
+ /**
+ * A map of renderer IDs to webgl buffer
+ * @private
+ * @type {Object}
+ */
+ _glBuffers: {
+ [key: number]: GLBuffer;
+ };
+ _updateID: number;
+ /**
+ * @param {PIXI.IArrayBuffer} data - the data to store in the buffer.
+ * @param _static - `true` for static buffer
+ * @param index - `true` for index buffer
+ */
+ constructor(data?: IArrayBuffer, _static?: boolean, index?: boolean);
+ /**
+ * Flags this buffer as requiring an upload to the GPU.
+ * @param {PIXI.IArrayBuffer|number[]} [data] - the data to update in the buffer.
+ */
+ update(data?: IArrayBuffer | Array): void;
+ /** Disposes WebGL resources that are connected to this geometry. */
+ dispose(): void;
+ /** Destroys the buffer. */
+ destroy(): void;
+ /**
+ * Flags whether this is an index buffer.
+ *
+ * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make
+ * the buffer of type `ARRAY_BUFFER`.
+ *
+ * For backwards compatibility.
+ */
+ set index(value: boolean);
+ get index(): boolean;
+ /**
+ * Helper function that creates a buffer based on an array or TypedArray
+ * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.
+ * @returns - A new Buffer based on the data provided.
+ */
+ static from(data: IArrayBuffer | number[]): Buffer_2;
+}
+export { Buffer_2 as Buffer }
+
+/**
+ * @interface SharedArrayBuffer
+ */
+/**
+ * Buffer resource with data of typed array.
+ * @memberof PIXI
+ */
+export declare class BufferResource extends Resource {
+ /** Source array Cannot be {@code ClampedUint8Array} because it cant be uploaded to WebGL */
+ data: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array;
+ /**
+ * @param source - Source buffer
+ * @param options - Options
+ * @param {number} options.width - Width of the texture
+ * @param {number} options.height - Height of the texture
+ */
+ constructor(source: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array, options: ISize);
+ /**
+ * Upload the texture to the GPU.
+ * @param renderer - Upload to the renderer
+ * @param baseTexture - Reference to parent texture
+ * @param glTexture - glTexture
+ * @returns - true is success
+ */
+ upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;
+ /** Destroy and don't use after this. */
+ dispose(): void;
+ /**
+ * Used to auto-detect the type of resource.
+ * @param {*} source - The source object
+ * @returns {boolean} `true` if