Function image::imageops::horizontal_gradient

source ·
pub fn horizontal_gradient<S, P, I>(img: &mut I, start: &P, stop: &P)
where I: GenericImage<Pixel = P>, P: Pixel<Subpixel = S> + 'static, S: Primitive + Lerp + 'static,
Expand description

Fill the image with a linear horizontal gradient

This function assumes a linear color space.

§Examples

use image::{Rgba, RgbaImage, Pixel};

let mut img = RgbaImage::new(100, 100);
let start = Rgba::from_slice(&[0, 128, 0, 0]);
let end = Rgba::from_slice(&[255, 255, 255, 255]);

image::imageops::horizontal_gradient(&mut img, start, end);
img.save("horizontal_gradient.png").unwrap();