vizia::vg::image_filters

Function displacement_map

pub fn displacement_map(
    _: (SkColorChannel, SkColorChannel),
    scale: f32,
    displacement: impl Into<Option<RCHandle<SkImageFilter>>>,
    color: impl Into<Option<RCHandle<SkImageFilter>>>,
    crop_rect: impl Into<CropRect>,
) -> Option<RCHandle<SkImageFilter>>
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.