Function photon_rs::multiple::blend[][src]

pub fn blend(
    photon_image: &mut PhotonImage,
    photon_image2: &PhotonImage,
    blend_mode: &str
)

Blend two images together.

The blend_mode (3rd param) determines which blending mode to use; change this for varying effects. The blend modes available include: overlay, over, atop, xor, multiply, burn, soft_light, hard_light, difference, lighten, darken, dodge, plus, exclusion (more to come) NOTE: The first image must be smaller than the second image passed as params. If the first image were larger than the second, then there would be overflowing pixels which would have no corresponding pixels in the second image.

Arguments

  • img - A DynamicImage that contains a view into the image.
  • img2 - The 2nd DynamicImage to be blended with the first.
  • blend_mode - The blending mode to use. See above for complete list of blend modes available.

Example

// For example, to blend two images with the `multiply` blend mode:
use photon_rs::multiple::blend;
use photon_rs::native::open_image;

let mut img = open_image("img.jpg").expect("File should open");
let img2 = open_image("img2.jpg").expect("File should open");
blend(&mut img, &img2, "multiply");