ncplane_gradient

Function ncplane_gradient 

Source
pub unsafe extern "C" fn ncplane_gradient(
    n: *mut ncplane,
    y: c_int,
    x: c_int,
    ylen: c_uint,
    xlen: c_uint,
    egc: *const c_char,
    styles: u16,
    ul: u64,
    ur: u64,
    ll: u64,
    lr: u64,
) -> c_int
Expand description

Draw a gradient with its upper-left corner at the position specified by ‘y’/‘x’, where -1 means the current cursor position in that dimension. The area is specified by ‘ylen’/‘xlen’, where 0 means “everything remaining below or to the right, respectively.” The glyph composed of ‘egc’ and ‘styles’ is used for all cells. The channels specified by ‘ul’, ‘ur’, ‘ll’, and ‘lr’ are composed into foreground and background gradients. To do a vertical gradient, ‘ul’ ought equal ‘ur’ and ‘ll’ ought equal ‘lr’. To do a horizontal gradient, ‘ul’ ought equal ‘ll’ and ‘ur’ ought equal ‘ul’. To color everything the same, all four channels should be equivalent. The resulting alpha values are equal to incoming alpha values. Returns the number of cells filled on success, or -1 on failure. Palette-indexed color is not supported.

Preconditions for gradient operations (error otherwise):

all: only RGB colors, unless all four channels match as default all: all alpha values must be the same 1x1: all four colors must be the same 1xN: both top and both bottom colors must be the same (vertical gradient) Nx1: both left and both right colors must be the same (horizontal gradient)