UNPKG

2.78 kBTypeScriptView Raw
1import { Color } from '@pixi/color';
2import type { ColorSource } from '@pixi/color';
3import type { ExtensionMetadata } from '@pixi/extensions';
4import type { ISystem } from '../system/ISystem';
5/**
6 * Options for the background system.
7 * @memberof PIXI
8 * @deprecated since 7.2.3
9 * @see PIXI.BackgroundSystemOptions
10 */
11export type BackgroundSytemOptions = BackgroundSystemOptions;
12/**
13 * Options for the background system.
14 * @memberof PIXI
15 */
16export interface BackgroundSystemOptions {
17 /**
18 * The background color used to clear the canvas. See {@link PIXI.ColorSource} for accepted color values.
19 * @memberof PIXI.IRendererOptions
20 */
21 backgroundColor: ColorSource;
22 /**
23 * Alias for {@link PIXI.IRendererOptions.backgroundColor}
24 * @memberof PIXI.IRendererOptions
25 */
26 background?: ColorSource;
27 /**
28 * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).
29 * @memberof PIXI.IRendererOptions
30 */
31 backgroundAlpha: number;
32 /**
33 * Whether to clear the canvas before new render passes.
34 * @memberof PIXI.IRendererOptions
35 */
36 clearBeforeRender: boolean;
37}
38/**
39 * The background system manages the background color and alpha of the main view.
40 * @memberof PIXI
41 */
42export declare class BackgroundSystem implements ISystem<BackgroundSystemOptions> {
43 static defaultOptions: BackgroundSystemOptions;
44 /** @ignore */
45 static extension: ExtensionMetadata;
46 /**
47 * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.
48 * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every
49 * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect
50 * to clear the canvas every frame. Disable this by setting this to false. For example, if
51 * your game has a canvas filling background image you often don't need this set.
52 * @member {boolean}
53 * @default
54 */
55 clearBeforeRender: boolean;
56 /** Reference to the internal color */
57 private _backgroundColor;
58 constructor();
59 /**
60 * initiates the background system
61 * @param {PIXI.IRendererOptions} options - the options for the background colors
62 */
63 init(options: BackgroundSystemOptions): void;
64 /**
65 * The background color to fill if not transparent.
66 * @member {PIXI.ColorSource}
67 */
68 get color(): ColorSource;
69 set color(value: ColorSource);
70 /**
71 * The background color alpha. Setting this to 0 will make the canvas transparent.
72 * @member {number}
73 */
74 get alpha(): number;
75 set alpha(value: number);
76 /** The background color object. */
77 get backgroundColor(): Color;
78 destroy(): void;
79}