Function write_gpu_gradient_stops_linear

Source
fn write_gpu_gradient_stops_linear(
    stops: &[GradientStop],
    kind: GradientKind,
    extend_mode: ExtendMode,
    writer: &mut GpuBufferWriter<'_, GpuBufferBlockF>,
) -> bool
Expand description

Builds the gpu representation for common gradient parameters and returns whether the gradient is fully opaque.

The format is:


[count, extend_mode, <padding>, color0.r, color0.g, color0.b, color0.a, ..., offset0, offset1, ..., <padding>]
|_____________________________| |__________________________________________| |_______________________________|
       header: vec4                        colors: [vec4; n]                     offsets: [vec4; ceil(n/4)]

Packed contiguously such that each portion is 4-floats aligned to facilitate reading them from the gpu buffer.