UNPKG

starling-framework

Version:

A fast, productive library for 2D cross-platform development.

79 lines 3.1 kB
import Texture from "../textures/Texture"; import Painter from "../rendering/Painter"; import IFilterHelper from "./IFilterHelper"; import FragmentFilter from "./FragmentFilter"; import CompositeEffect from "./CompositeEffect"; import Point from "openfl/geom/Point"; declare namespace starling.filters { /** * The CompositeFilter class allows to combine several layers of textures into one texture. * * It's mainly used as a building block for more complex filters; e.g. the DropShadowFilter * * uses this class to draw the shadow (the result of a BlurFilter) behind an object. * */ export class CompositeFilter extends FragmentFilter { /** * Creates a new instance. */ constructor(); /** * Combines up to four input textures into one new texture, * * adhering to the properties of each layer. */ override process(painter: Painter, helper: IFilterHelper, input0?: Texture, input1?: Texture, input2?: Texture, input3?: Texture): Texture; /** * Returns the position (in points) at which a certain layer will be drawn. */ getOffsetAt(layerID: number, out?: Point): Point; /** * Indicates the position (in points) at which a certain layer will be drawn. */ setOffsetAt(layerID: number, x: number, y: number): void; /** * Returns the RGB color with which a layer is tinted when it is being drawn. * * @default 0xffffff */ getColorAt(layerID: number): number; /** * Indicates if the color of the given layer is replaced (true) or tinted (false). */ getReplaceColorAt(layerID: number): boolean; /** * Adjusts the RGB color with which a layer is tinted when it is being drawn. * * If <code>replace</code> is enabled, the pixels are not tinted, but instead * * the RGB channels will replace the texture's color entirely. * */ setColorAt(layerID: number, color: number, replace?: boolean): void; /** * Indicates the alpha value with which the layer is drawn. * * @default 1.0 */ getAlphaAt(layerID: number): number; /** * Adjusts the alpha value with which the layer is drawn. */ setAlphaAt(layerID: number, alpha: number): void; /** * The mode with which the layer is drawn. @see starling.filters.CompositeMode */ getModeAt(layerID: number): string; /** * Sets the mode with which the layer is drawn. @see starling.filters.CompositeMode */ setModeAt(layerID: number, mode: string): void; /** * Indicates if the alpha value of the given layer's fragments should be inverted, * * effectively inverting the layer's silhouette. */ getInvertAlphaAt(layerID: number): boolean; /** * Activate this setting to invert the alpha values of this layer's fragments, which will * * effectively invert the layer's silhouette. Note that this setting is only applied if * * color replacement is activated on this layer. */ setInvertAlphaAt(layerID: number, value?: boolean): void; get compositeEffect(): CompositeEffect; } } export default starling.filters.CompositeFilter;