import Texture from "../textures/Texture";
import Painter from "../rendering/Painter";
import IFilterHelper from "./IFilterHelper";
import FragmentFilter from "./FragmentFilter";
import DisplacementMapEffect from "./DisplacementMapEffect";
declare namespace starling.filters {
/**
* The DisplacementMapFilter class uses the pixel values from the specified texture (called
* * the map texture) to perform a displacement of an object. You can use this filter
* * to apply a warped or mottled effect to any object that inherits from the DisplayObject
* * class.
* *
* *
The filter uses the following formula:
* * dstPixel[x, y] = srcPixel[x + ((componentX(x, y) - 128) * scaleX) / 256,
* * y + ((componentY(x, y) - 128) * scaleY) / 256]
* *
* *
* * Where componentX(x, y) gets the componentX property color value from the
* * map texture at (x - mapX, y - mapY).
* *
* * Clamping to the Edges
* *
* * Per default, the filter allows the object to grow beyond its actual bounds to make
* * room for the displacement (depending on scaleX/Y). If you want to clamp the
* * displacement to the actual object bounds, set all margins to zero via a call to
* * filter.padding.setTo(). This works only with rectangular, stage-aligned
* * objects, though.
*
*/
export class DisplacementMapFilter extends FragmentFilter {
/**
* Creates a new displacement map filter that uses the provided map texture.
* *
* * @param mapTexture The texture containing the displacement map data.
* * @param componentX Describes which color channel to use in the map image to displace
* * the x result. Possible values are the BitmapDataChannel constants.
* * @param componentY Describes which color channel to use in the map image to displace
* * the y result. Possible values are the BitmapDataChannel constants.
* * @param scaleX The multiplier used to scale the x displacement result.
* * @param scaleY The multiplier used to scale the y displacement result.
*
*/
constructor(mapTexture: Texture, componentX?: number, componentY?: number, scaleX?: number, scaleY?: number);
/**
* @private
*/
override process(painter: Painter, pool: IFilterHelper, input0?: Texture, input1?: Texture, input2?: Texture, input3?: Texture): Texture;
/**
* Describes which color channel to use in the map image to displace the x result.
* * Possible values are constants from the BitmapDataChannel class.
*/
get componentX(): number;
set componentX(value: number)
/**
* Describes which color channel to use in the map image to displace the y result.
* * Possible values are constants from the BitmapDataChannel class.
*/
get componentY(): number;
set componentY(value: number)
/**
* The multiplier used to scale the x displacement result from the map calculation.
*/
get scaleX(): number;
set scaleX(value: number)
/**
* The multiplier used to scale the y displacement result from the map calculation.
*/
get scaleY(): number;
set scaleY(value: number)
/**
* The horizontal offset of the map texture relative to the origin. @default 0
*/
get mapX(): number;
set mapX(value: number)
/**
* The vertical offset of the map texture relative to the origin. @default 0
*/
get mapY(): number;
set mapY(value: number)
/**
* The horizontal scale applied to the map texture. @default 1
*/
get mapScaleX(): number;
set mapScaleX(value: number)
/**
* The vertical scale applied to the map texture. @default 1
*/
get mapScaleY(): number;
set mapScaleY(value: number)
/**
* The texture that will be used to calculate displacement.
*/
get mapTexture(): Texture;
set mapTexture(value: Texture)
/**
* Indicates if pixels at the edge of the map texture will be repeated.
* * Note that this only works if the map texture is a power-of-two texture!
*
*/
get mapRepeat(): boolean;
set mapRepeat(value: boolean)
get dispEffect(): DisplacementMapEffect;
}
}
export default starling.filters.DisplacementMapFilter;