UNPKG

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