Function offset

Source
pub fn offset(photon_image: &mut PhotonImage, channel_index: usize, offset: u32)
Expand description

Adds an offset to the image by a certain number of pixels.

This creates an RGB shift effect.

§Arguments

  • img - A PhotonImage that contains a view into the image.
  • channel_index: The index of the channel to increment. 0 for red, 1 for green and 2 for blue.
  • offset - The offset is added to the pixels in the image.

§Example

// For example, to offset pixels by 30 pixels on the red channel:
use photon_rs::effects::offset;
use photon_rs::native::open_image;

let mut img = open_image("img.jpg").expect("File should open");
offset(&mut img, 0_usize, 30_u32);