Function libnotcurses_sys::c_api::ncplane_gradient
source · pub fn ncplane_gradient(
plane: &mut NcPlane,
y: Option<u32>,
x: Option<u32>,
len_y: Option<u32>,
len_x: Option<u32>,
egc: &str,
stylemask: impl Into<NcStyle_u16>,
ul: impl Into<NcChannels_u64>,
ur: impl Into<NcChannels_u64>,
ll: impl Into<NcChannels_u64>,
lr: impl Into<NcChannels_u64>
) -> NcResult_i32
Expand description
Draws a gradient with its upper-left corner at the current cursor position,
stopping at end_y
×end_x
.
Use None
for either or all of beg_y
and beg_x
in order to
use the current cursor position along that axis.
Use None
for either or both of len_y
and len_x
in order to
go through the boundary of the plane in that axis (same as 0
).
The glyph composed of egc
and stylemask
is used for all cells. The
NcChannels_u64
specified by ul
, ur
, ll
, and lr
are composed into
foreground and background gradients.
- To do a vertical gradient,
ul
ought equalur
andll
ought equallr
. - To do a horizontal gradient,
ul
ought equalll
andur
ought equalul
. - 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)
Method: NcPlane.gradient().