@pixi/core
Version:
Core PixiJS
85 lines (84 loc) • 3.56 kB
TypeScript
import { Color } from '@pixi/color';
import { Framebuffer } from '../framebuffer/Framebuffer';
import { BaseTexture } from '../textures/BaseTexture';
import type { ColorSource } from '@pixi/color';
import type { MaskData } from '../mask/MaskData';
import type { IBaseTextureOptions } from '../textures/BaseTexture';
export 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:
* @example
* import { autoDetectRenderer, BaseRenderTexture, RenderTexture, Sprite } from 'pixi.js';
*
* const renderer = autoDetectRenderer();
* const baseRenderTexture = new BaseRenderTexture({ width: 800, height: 600 });
* const renderTexture = new RenderTexture(baseRenderTexture);
* const sprite = 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
* sprite.setTransform();
*
* const baseRenderTexture = new BaseRenderTexture({ width: 100, height: 100 });
* const renderTexture = new RenderTexture(baseRenderTexture);
*
* renderer.render(sprite, { renderTexture }); // Renders to center of RenderTexture
* @memberof PIXI
*/
export declare class BaseRenderTexture extends BaseTexture {
_clear: Color;
framebuffer: Framebuffer;
/** The data structure for the stencil masks. */
maskStack: Array<MaskData>;
/** The data structure for the filters. */
filterStack: Array<any>;
/**
* @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.BaseTexture.defaultOptions.scaleMode] - 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);
/** Color when clearning the texture. */
set clearColor(value: ColorSource);
get clearColor(): ColorSource;
/**
* Color object when clearning the texture.
* @readonly
* @since 7.2.0
*/
get clear(): Color;
/**
* Resizes the BaseRenderTexture.
* @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;
}