logo
pub fn horizontal_gradient<S, P, I>(img: &mut I, start: &P, stop: &P) where
    I: GenericImage<Pixel = P>,
    P: 'static + Pixel<Subpixel = S>,
    S: 'static + Primitive + Lerp, 
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();