skia_safe::image_filters

Function displacement_map

Source
pub fn displacement_map(
    (x_channel_selector, y_channel_selector): (ColorChannel, ColorChannel),
    scale: scalar,
    displacement: impl Into<Option<ImageFilter>>,
    color: impl Into<Option<ImageFilter>>,
    crop_rect: impl Into<CropRect>,
) -> Option<ImageFilter>
Expand description

Create a filter that moves each pixel in its color input based on an (x,y) vector encoded in its displacement input filter. Two color components of the displacement image are mapped into a vector as scale * (color[xChannel], color[yChannel]), where the channel selectors are one of R, G, B, or A.

  • x_channel_selector - RGBA channel that encodes the x displacement per pixel.
  • y_channel_selector - RGBA channel that encodes the y displacement per pixel.
  • scale - Scale applied to displacement extracted from image.
  • displacement - The filter defining the displacement image, or None to use source.
  • color - The filter providing the color pixels to be displaced. If None, it will use the source.
  • crop_rect - Optional rectangle that crops the color input and output.