---
name: "notcurses_lines"
section: "3"
platform: "linux"
package: "notcurses"
version: "3.0.17-3"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/notcurses_lines"
---

# notcurses\_lines(3)

operations on lines and boxes

## NAME

notcurses\_lines - operations on lines and boxes

## SYNOPSIS

**#include \<notcurses/notcurses.h\>**

**int ncplane\_hline\_interp(struct ncplane\*** *n***,** **const nccell\*** *c***, unsigned** *len***,** **uint64\_t** *c1***, uint64\_t** *c2***);**

**static inline int ncplane\_hline(struct ncplane\*** *n***, const nccell\*** *c***, unsigned** *len***);**

**int ncplane\_vline\_interp(struct ncplane\*** *n***,** **const nccell\*** *c***, unsigned** *len***,** **uint64\_t** *c1***, uint64\_t** *c2***);**

**static inline int ncplane\_vline(struct ncplane\*** *n***, const nccell\*** *c***, unsigned** *len***);**

-

  ```
  #define NCBOXMASK_TOP    0x0001
  #define NCBOXMASK_RIGHT  0x0002
  #define NCBOXMASK_BOTTOM 0x0004
  #define NCBOXMASK_LEFT   0x0008
  #define NCBOXGRAD_TOP    0x0010
  #define NCBOXGRAD_RIGHT  0x0020
  #define NCBOXGRAD_BOTTOM 0x0040
  #define NCBOXGRAD_LEFT   0x0080
  #define NCBOXCORNER_MASK 0x0300
  #define NCBOXCORNER_SHIFT 8u
  ```

**int ncplane\_box(struct ncplane\*** *n***, const** **nccell\*** *ul***, const nccell\*** *ur***,** **const nccell\*** *ll***, const nccell\*** *lr***, const nccell\*** *hline***, const** **nccell\*** *vline***, int** *ystop***, int** *xstop***, unsigned** *ctlword***);**

**static inline int ncplane\_box\_sized(struct ncplane\*** *n***, const nccell\*** *ul***, const** **nccell\*** *ur***, const nccell\*** *ll***,** **const nccell\*** *lr***, const nccell\*** *hline***, const nccell\*** *vline***, int** *ylen***, int** *xlen***, unsigned** *ctlword***);**

**static inline int ncplane\_perimeter(struct ncplane\*** *n***, const nccell\*** *ul***, const** **nccell\*** *ur***, const nccell\*** *ll***,** **const nccell\*** *lr***, const nccell\*** *hline***, const nccell\*** *vline***,** **unsigned** *ctlword***)**

**static inline int nccells\_load\_box(struct ncplane\*** *n***, uint16\_t** *styles***, uint64\_t** *channels***, nccell\*** *ul***, nccell\*** *ur***, nccell\*** *ll***, nccell\*** *lr***, nccell\*** *hl***, nccell\*** *vl***, const char\*** *gclusters***);**

**static inline int nccells\_rounded\_box(struct ncplane\*** *n***, uint16\_t** *styles***, uint64\_t** *channels***, nccell\*** *ul***, nccell\*** *ur***, nccell\*** *ll***, nccell\*** *lr***, nccell\*** *hl***, nccell\*** *vl***);**

**static inline int ncplane\_rounded\_box(struct ncplane\*** *n***, uint16\_t** *styles***, uint64\_t** *channels***, int** *ystop***, int** *xstop***, unsigned** *ctlword***);**

**static inline int ncplane\_rounded\_box\_sized(struct ncplane\*** *n***, uint16\_t** *styles***, uint64\_t** *channels***, int** *ylen***, int** *xlen***, unsigned** *ctlword***);**

**static inline int nccells\_double\_box(struct ncplane\*** *n***, uint16\_t** *styles***, uint64\_t** *channels***, nccell\*** *ul***, nccell\*** *ur***, nccell\*** *ll***, nccell\*** *lr***, nccell\*** *hl***, nccell\*** *vl***);**

**static inline int ncplane\_double\_box(struct ncplane\*** *n***, uint16\_t** *styles***, uint64\_t** *channels***, int** *ystop***, int** *xstop***, unsigned** *ctlword***);**

**static inline int ncplane\_double\_box\_sized(struct ncplane\*** *n***, uint16\_t** *styles***, uint64\_t** *channels***, int** *ylen***, int** *xlen***, unsigned** *ctlword***);**

**int ncplane\_polyfill\_yx(struct ncplane\*** *n***,** **unsigned** *y***, unsigned** *x***, const** **nccell\*** *c***);**

**int ncplane\_gradient(struct ncplane\*** *n***, int** *y***, int** *x***, unsigned** *ylen***, unsigned** *xlen***, const char\*** *egc***, uint16\_t** *stylemask***,** **uint64\_t** *ul***, uint64\_t** *ur***,** **uint64\_t** *ll***, uint64\_t** *lr***);**

**int ncplane\_highgradient2x1(struct ncplane\*** *n***,** **int** *y***, int** *x***, unsigned** *ylen***, unsigned** *xlen***, uint32\_t** *ul***, uint32\_t** *ur***, uint32\_t** *ll***, uint32\_t** *lr***);**

**int ncplane\_format(struct ncplane\*** *n***, int** *y***, int** *x***, unsigned** *ylen***, unsigned** *xlen***, uint16\_t** *stylemask***);**

**int ncplane\_stain(struct ncplane\*** *n***, int** *y***, int** *x***, unsigned** *ylen***, unsigned** *xlen***, uint64\_t** *ul***, uint64\_t** *ur***, uint64\_t** *ll***, uint64\_t** *lr***);**

## DESCRIPTION

**ncplane\_polyfill\_yx** starts at the specified ***y*** and ***x*** (provide -1 to use the cursor's position in the relevant dimension). The cell at these coordinates is replaced with ***c***. All connected cells having the same content as this original cell are replaced with ***c***, recursively. Two cells are connected if they are vertical or horizontal neighbors of one another.

**ncplane\_gradient** replaces all glyphs in the specified area with ***egc***, and colors them with the specified gradient. All content within the specified area is destroyed.

**ncplane\_gradient2x1** draws a high-definition gradient in the specified area. It will return an error if UTF8 is not being used. The gradient is drawn using the UPPER HALF BLOCK glyph, with two vertical steps and one horizontal step in each cell. Since cells are often about twice as tall as they are wide, this tends to result in very even color differences. All content within the specified area is destroyed.

**ncplane\_format** sets the attributes of every cell in the region having its upper-left corner at ***y*** and ***x*** (provide -1 to use the cursor's position in the relevant dimension), and its area defined by ***ylen*** and ***xlen*** (provide 0 to use all remaining area to the right and below, respectively). Channels and glyphs will be unaffected.

**ncplane\_stain** works the same way, but sets channels. Standard linear interpolation is applied between the provided corner channels. Glyphs and their attributes will be unaffected.

Box- and line-drawing is unaffected by a plane's scrolling status.

## RETURN VALUES

**ncplane\_format**, **ncplane\_stain**, **ncplane\_gradient**, **ncplane\_gradient2x1**, and **ncplane\_polyfill\_yx** return -1 if any coordinates are outside the plane, and otherwise the number of cells affected.

**ncplane\_hline\_interp**, **ncplane\_hline**, **ncplane\_vline\_interp**, and **ncplane\_vline** all return the number of glyphs drawn on success, or -1 on failure. Passing a length of 0 is an error.

## SEE ALSO

**[notcurses(3)](/notcurses/3.md)**, **[notcurses\_cell(3)](/notcurses_cell/3.md)**, **[notcurses\_plane(3)](/notcurses_plane/3.md)**

## AUTHORS

nick black ⟨nickblack@linux.com⟩\\c.
