1 | import { BaseTexture } from '../textures/BaseTexture';
|
2 | import { Framebuffer } from '../framebuffer/Framebuffer';
|
3 | import type { IBaseTextureOptions } from '../textures/BaseTexture';
|
4 | import type { MaskData } from '../mask/MaskData';
|
5 | export interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {
|
6 | }
|
7 | /**
|
8 | * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.
|
9 | *
|
10 | * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded
|
11 | * otherwise black rectangles will be drawn instead.
|
12 | *
|
13 | * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position
|
14 | * and rotation of the given Display Objects is ignored. For example:
|
15 | * @example
|
16 | * import { autoDetectRenderer, BaseRenderTexture, RenderTexture, Sprite } from 'pixi.js';
|
17 | *
|
18 | * const renderer = autoDetectRenderer();
|
19 | * const baseRenderTexture = new BaseRenderTexture({ width: 800, height: 600 });
|
20 | * const renderTexture = new RenderTexture(baseRenderTexture);
|
21 | * const sprite = Sprite.from('spinObj_01.png');
|
22 | *
|
23 | * sprite.position.x = 800 / 2;
|
24 | * sprite.position.y = 600 / 2;
|
25 | * sprite.anchor.x = 0.5;
|
26 | * sprite.anchor.y = 0.5;
|
27 | *
|
28 | * renderer.render(sprite, { renderTexture });
|
29 | *
|
30 | * // The Sprite in this case will be rendered using its local transform.
|
31 | * // To render this sprite at 0,0 you can clear the transform
|
32 | * sprite.setTransform();
|
33 | *
|
34 | * const baseRenderTexture = new BaseRenderTexture({ width: 100, height: 100 });
|
35 | * const renderTexture = new RenderTexture(baseRenderTexture);
|
36 | *
|
37 | * renderer.render(sprite, { renderTexture }); // Renders to center of RenderTexture
|
38 | * @memberof PIXI
|
39 | */
|
40 | export declare class BaseRenderTexture extends BaseTexture {
|
41 | clearColor: number[];
|
42 | framebuffer: Framebuffer;
|
43 | /** The data structure for the stencil masks. */
|
44 | maskStack: Array<MaskData>;
|
45 | /** The data structure for the filters. */
|
46 | filterStack: Array<any>;
|
47 | /**
|
48 | * @param options
|
49 | * @param {number} [options.width=100] - The width of the base render texture.
|
50 | * @param {number} [options.height=100] - The height of the base render texture.
|
51 | * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}
|
52 | * for possible values.
|
53 | * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio
|
54 | * of the texture being generated.
|
55 | * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer.
|
56 | */
|
57 | constructor(options?: IBaseTextureOptions);
|
58 | /**
|
59 | * Resizes the BaseRenderTexture.
|
60 | * @param desiredWidth - The desired width to resize to.
|
61 | * @param desiredHeight - The desired height to resize to.
|
62 | */
|
63 | resize(desiredWidth: number, desiredHeight: number): void;
|
64 | /**
|
65 | * Frees the texture and framebuffer from WebGL memory without destroying this texture object.
|
66 | * This means you can still use the texture later which will upload it to GPU
|
67 | * memory again.
|
68 | * @fires PIXI.BaseTexture#dispose
|
69 | */
|
70 | dispose(): void;
|
71 | /** Destroys this texture. */
|
72 | destroy(): void;
|
73 | }
|