import { BLEND_MODES, Matrix } from '@pixi/core'; import type { ColorSource, ExtensionMetadata, ICanvasRenderingContext2D, ISystem } from '@pixi/core'; import type { CanvasRenderer } from './CanvasRenderer'; /** * Rendering context for all browsers. This includes platform-specific * properties that are not included in the spec for CanvasRenderingContext2D */ export interface CrossPlatformCanvasRenderingContext2D extends ICanvasRenderingContext2D { webkitImageSmoothingEnabled: boolean; mozImageSmoothingEnabled: boolean; oImageSmoothingEnabled: boolean; msImageSmoothingEnabled: boolean; } export type SmoothingEnabledProperties = 'imageSmoothingEnabled' | 'webkitImageSmoothingEnabled' | 'mozImageSmoothingEnabled' | 'oImageSmoothingEnabled' | 'msImageSmoothingEnabled'; /** * System that manages the canvas `2d` contexts * @memberof PIXI */ export declare class CanvasContextSystem implements ISystem { /** @ignore */ static extension: ExtensionMetadata; /** A reference to the current renderer */ private renderer; /** The root canvas 2d context that everything is drawn with. */ rootContext: CrossPlatformCanvasRenderingContext2D; /** The currently active canvas 2d context (could change with renderTextures) */ activeContext: CrossPlatformCanvasRenderingContext2D; activeResolution: number; /** The canvas property used to set the canvas smoothing property. */ smoothProperty: SmoothingEnabledProperties; /** Tracks the blend modes useful for this renderer. */ readonly blendModes: string[]; _activeBlendMode: BLEND_MODES; /** Projection transform, passed in render() stored here */ _projTransform: Matrix; /** @private */ _outerBlend: boolean; /** @param renderer - A reference to the current renderer */ constructor(renderer: CanvasRenderer); /** initiates the system */ init(): void; /** * Sets matrix of context. * called only from render() methods * takes care about resolution * @param transform - world matrix of current element * @param roundPixels - whether to round (tx,ty) coords * @param localResolution - If specified, used instead of `renderer.resolution` for local scaling */ setContextTransform(transform: Matrix, roundPixels?: boolean, localResolution?: number): void; /** * Clear the canvas of renderer. * @param {string} [clearColor] - Clear the canvas with this color, except the canvas is transparent. * @param {number} [alpha] - Alpha to apply to the background fill color. */ clear(clearColor?: ColorSource, alpha?: number): void; /** * Sets the blend mode of the renderer. * @param {number} blendMode - See {@link PIXI.BLEND_MODES} for valid values. * @param {boolean} [readyForOuterBlend=false] - Some blendModes are dangerous, they affect outer space of sprite. * Pass `true` only if you are ready to use them. */ setBlendMode(blendMode: BLEND_MODES, readyForOuterBlend?: boolean): void; resize(): void; /** Checks if blend mode has changed. */ invalidateBlendMode(): void; destroy(): void; }