Skip to main content

linear_gradient

Function linear_gradient 

Source
pub fn linear_gradient(
    output: &str,
    width: u32,
    height: u32,
    angle_deg: f32,
    stops: &[ColorStop],
) -> Program
Expand description

Build a Program that rasterizes a linear gradient into output.

  • output: [u32; width * height] - rasterized gradient (packed RGBA)
  • angle_deg: CSS angle (0 = bottom-to-top, 90 = left-to-right)
  • stops: color stops (must be sorted by position, 2..=16)