UNPKG

2.23 kBTypeScriptView Raw
1import { Rectangle } from '@pixi/math';
2import { RenderTexture } from './RenderTexture';
3import type { MSAA_QUALITY } from '@pixi/constants';
4import type { ExtensionMetadata } from '@pixi/extensions';
5import type { IRenderableObject, IRenderer } from '../IRenderer';
6import type { ISystem } from '../system/ISystem';
7import type { IBaseTextureOptions } from '../textures/BaseTexture';
8export interface IGenerateTextureOptions extends IBaseTextureOptions {
9 /**
10 * The region of the displayObject, that shall be rendered,
11 * if no region is specified, defaults to the local bounds of the displayObject.
12 */
13 region?: Rectangle;
14 /** The resolution / device pixel ratio of the texture being generated. The default is the renderer's resolution. */
15 resolution?: number;
16 /** The number of samples of the frame buffer. The default is the renderer's multisample. */
17 multisample?: MSAA_QUALITY;
18}
19/**
20 * System that manages the generation of textures from the renderer.
21 * @memberof PIXI
22 */
23export declare class GenerateTextureSystem implements ISystem {
24 /** @ignore */
25 static extension: ExtensionMetadata;
26 renderer: IRenderer;
27 private readonly _tempMatrix;
28 constructor(renderer: IRenderer);
29 /**
30 * A Useful function that returns a texture of the display object that can then be used to create sprites
31 * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.
32 * @param displayObject - The displayObject the object will be generated from.
33 * @param {IGenerateTextureOptions} options - Generate texture options.
34 * @param {PIXI.Rectangle} options.region - The region of the displayObject, that shall be rendered,
35 * if no region is specified, defaults to the local bounds of the displayObject.
36 * @param {number} [options.resolution] - If not given, the renderer's resolution is used.
37 * @param {PIXI.MSAA_QUALITY} [options.multisample] - If not given, the renderer's multisample is used.
38 * @returns a shiny new texture of the display object passed in
39 */
40 generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture;
41 destroy(): void;
42}