pub extern "C" fn __wasm_bindgen_generated_swap_channels(
    arg0: <PhotonImage as RefMutFromWasmAbi>::Abi,
    arg1: <usize as FromWasmAbi>::Abi,
    arg2: <usize as FromWasmAbi>::Abi
) -> <() as ReturnWasmAbi>::Abi
Expand description

Swap two channels.

Arguments

  • img - A PhotonImage.
  • channel1 - An index from 0 to 2, representing the Red, Green or Blue channels respectively. Red would be represented by 0, Green by 1, and Blue by 2.
  • channel2 - An index from 0 to 2, representing the Red, Green or Blue channels respectively. Same as above.

Example

// For example, to swap the values of the Red channel with the values of the Blue channel:
use photon_rs::channels::swap_channels;
use photon_rs::native::open_image;

let mut img = open_image("img.jpg").expect("File should open");
swap_channels(&mut img, 0_usize, 2_usize);