fn mask(source: &mut DynamicImage, other: &DynamicImage, x: u32, y:u32)
    -> Result<(), PromptoError> {
  // Code adapted from `image` library.
  if source.width() < other.width() + x {
    return Err(PromptoError::MaskingError);
  } else if source.height() < other.height() + y {
    return Err(PromptoError::MaskingError);
  }

  for i in 0 .. other.width() {
    for k in 0 .. other.height() {
      unsafe {
        let p = other.unsafe_get_pixel(i, k);
        source.blend_pixel(i + x, k + y, p);
      }
    }
  }

  Ok(())
}
/// Mask the source image with the Prompto selfie mask.
Mask the source image with the Prompto selfie mask.
Mask the source image with the Prompto selfie mask .
fn mask(source: &mut DynamicImage, other: &DynamicImage, x: u32, y:u32)
    -> Result<(), PromptoError> {
  // Code adapted from `image` library.
  if source.width() < other.width() + x {
    return Err(PromptoError::MaskingError);
  } else if source.height() < other.height() + y {
    return Err(PromptoError::MaskingError);
  }
  for i in 0 .. other.width() {
    for k in 0 .. other.height() {
      unsafe {
        let p = other.unsafe_get_pixel(i, k);
        source.blend_pixel(i + x, k + y, p);
      }
    }
  }
  Ok(())
}
fn mask ( source : & mut DynamicImage , other : & DynamicImage , x : u32 , y : u32 ) -> Result < ( ) , PromptoError > { // Code adapted from `image` library. if source . width ( ) < other . width ( ) + x { return Err ( PromptoError :: MaskingError ) ; } else if source . height ( ) < other . height ( ) + y { return Err ( PromptoError :: MaskingError ) ; } for i in 0 .. other . width ( ) { for k in 0 .. other . height ( ) { unsafe { let p = other . unsafe_get_pixel ( i , k ) ; source . blend_pixel ( i + x , k + y , p ) ; } } } Ok ( ( ) ) }
Mask the source image with the Prompto selfie mask.
Mask the source image with the Prompto selfie mask .
source
&mut DynamicImage
other
&DynamicImage
x
u32
y
u32
source
&mut DynamicImage
other
&DynamicImage
x
u32
y
u32