.\" Automatically generated by Pandoc 2.9.2.1 .\" .TH "notcurses_plane" "3" "v2.2.3" "" "" .hy .SH NAME .PP notcurses_plane - operations on ncplanes .SH SYNOPSIS .PP \f[B]#include \f[R] .IP .nf \f[C] #define NCPLANE_OPTION_HORALIGNED 0x0001ull typedef struct ncplane_options { int y; // vertical placement relative to parent plane int x; // horizontal placement relative to parent plane int rows; // number of rows, must be positive int cols; // number of columns, must be positive void* userptr; // user curry, may be NULL const char* name; // name (used only for debugging), may be NULL int (*resizecb)(struct ncplane*); // called on parent resize uint64_t flags; // closure over NCPLANE_OPTION_* } ncplane_options; \f[R] .fi .PP \f[B]struct ncplane* ncplane_create(struct ncplane* \f[R]\f[I]n\f[R]\f[B], const ncplane_options* \f[R]\f[I]nopts\f[R]\f[B]);\f[R] .PP \f[B]struct ncplane* ncpile_create(struct notcurses* \f[R]\f[I]n\f[R]\f[B], const ncplane_options* \f[R]\f[I]nopts\f[R]\f[B]);\f[R] .PP \f[B]struct ncplane* notcurses_top(struct notcurses* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]struct ncplane* notcurses_bottom(struct notcurses* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]struct ncplane* ncpile_top(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]struct ncplane* ncpile_bottom(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]struct ncplane* ncplane_reparent(struct ncplane* \f[R]\f[I]n\f[R]\f[B], struct ncplane* \f[R]\f[I]newparent\f[R]\f[B]);\f[R] .PP \f[B]struct ncplane* ncplane_reparent_family(struct ncplane* \f[R]\f[I]n\f[R]\f[B], struct ncplane* \f[R]\f[I]newparent\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_descendant_p(const struct ncplane* \f[R]\f[I]n\f[R]\f[B], const struct ncplane* \f[R]\f[I]ancestor\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_resize_realign(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_set_resizecb(struct ncplane* \f[R]\f[I]n\f[R]\f[B], int(\f[BI]resizecb)(struct ncplane\f[B]));\f[R] .PP \f[B]int (\f[BI]ncplane_resizecb(const struct ncplane\f[B] \f[R]\f[I]n\f[R]**))(struct ncplane*);** .PP \f[B]struct ncplane* ncplane_dup(struct ncplane* \f[R]\f[I]n\f[R]\f[B], void* \f[R]\f[I]opaque\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_resize(struct ncplane* \f[R]\f[I]n\f[R]\f[B], int \f[R]\f[I]keepy\f[R]\f[B], int \f[R]\f[I]keepx\f[R]\f[B], int \f[R]\f[I]keepleny\f[R]\f[B], int \f[R]\f[I]keeplenx\f[R]\f[B], int \f[R]\f[I]yoff\f[R]\f[B], int \f[R]\f[I]xoff\f[R]\f[B], int \f[R]\f[I]ylen\f[R]\f[B], int \f[R]\f[I]xlen\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_move_yx(struct ncplane* \f[R]\f[I]n\f[R]\f[B], int \f[R]\f[I]y\f[R]\f[B], int \f[R]\f[I]x\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_yx(const struct ncplane* \f[R]\f[I]n\f[R]\f[B], int* restrict \f[R]\f[I]y\f[R]\f[B], int* restrict \f[R]\f[I]x\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_y(const struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_x(const struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_abs_yx(const struct ncplane* \f[R]\f[I]n\f[R]\f[B], int* \f[R]\f[I]y\f[R]\f[B], int* \f[R]\f[I]x\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_abs_y(const struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_abs_x(const struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]struct ncplane* ncplane_parent(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]const struct ncplane* ncplane_parent_const(const struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_set_base_cell(struct ncplane* \f[R]\f[I]ncp\f[R]\f[B], const nccell* \f[R]\f[I]c\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_set_base(struct ncplane* \f[R]\f[I]ncp\f[R]\f[B], const char* \f[R]\f[I]egc\f[R]\f[B], uint32_t \f[R]\f[I]stylemask\f[R]\f[B], uint64_t \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_base(struct ncplane* \f[R]\f[I]ncp\f[R]\f[B], nccell* \f[R]\f[I]c\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_move_top(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_move_bottom(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_move_above(struct ncplane* restrict \f[R]\f[I]n\f[R]\f[B], struct ncplane* restrict \f[R]\f[I]above\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_move_below(struct ncplane* restrict \f[R]\f[I]n\f[R]\f[B], struct ncplane* restrict \f[R]\f[I]below\f[R]\f[B]);\f[R] .PP \f[B]struct ncplane* ncplane_below(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]struct ncplane* ncplane_above(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]char* ncplane_at_cursor(struct ncplane* \f[R]\f[I]n\f[R]\f[B], uint16_t* \f[R]\f[I]stylemask\f[R]\f[B], uint64_t* \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_at_cursor_cell(struct ncplane* \f[R]\f[I]n\f[R]\f[B], nccell* \f[R]\f[I]c\f[R]\f[B]);\f[R] .PP \f[B]char* ncplane_at_yx(const struct ncplane* \f[R]\f[I]n\f[R]\f[B], int \f[R]\f[I]y\f[R]\f[B], int \f[R]\f[I]x\f[R]\f[B], uint16_t* \f[R]\f[I]stylemask\f[R]\f[B], uint64_t* \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_at_yx_cell(struct ncplane* \f[R]\f[I]n\f[R]\f[B], int \f[R]\f[I]y\f[R]\f[B], int \f[R]\f[I]x\f[R]\f[B], nccell* \f[R]\f[I]c\f[R]\f[B]);\f[R] .PP \f[B]uint32_t* ncplane_rgba(const struct ncplane* \f[R]\f[I]nc\f[R]\f[B], int \f[R]\f[I]begy\f[R]\f[B], int \f[R]\f[I]begx\f[R]\f[B], int \f[R]\f[I]leny\f[R]\f[B], int \f[R]\f[I]lenx\f[R]\f[B]);\f[R] .PP \f[B]char* ncplane_contents(const struct ncplane* \f[R]\f[I]nc\f[R]\f[B], int \f[R]\f[I]begy\f[R]\f[B], int \f[R]\f[I]begx\f[R]\f[B], int \f[R]\f[I]leny\f[R]\f[B], int \f[R]\f[I]lenx\f[R]\f[B]);\f[R] .PP \f[B]void* ncplane_set_userptr(struct ncplane* \f[R]\f[I]n\f[R]\f[B], void* \f[R]\f[I]opaque\f[R]\f[B]);\f[R] .PP \f[B]void* ncplane_userptr(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_dim_yx(const struct ncplane* \f[R]\f[I]n\f[R]\f[B], int* restrict \f[R]\f[I]rows\f[R]\f[B], int* restrict \f[R]\f[I]cols\f[R]\f[B]);\f[R] .PP \f[B]static inline int ncplane_dim_y(const struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]static inline int ncplane_dim_x(const struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_cursor_yx(const struct ncplane* \f[R]\f[I]n\f[R]\f[B], int* restrict \f[R]\f[I]y\f[R]\f[B], int* restrict \f[R]\f[I]x\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_translate(const struct ncplane* \f[R]\f[I]src\f[R]\f[B], const struct ncplane* \f[R]\f[I]dst\f[R]\f[B], int* restrict \f[R]\f[I]y\f[R]\f[B], int* restrict \f[R]\f[I]x\f[R]\f[B]);\f[R] .PP \f[B]bool ncplane_translate_abs(const struct ncplane* \f[R]\f[I]n\f[R]\f[B], int* restrict \f[R]\f[I]y\f[R]\f[B], int* restrict \f[R]\f[I]x\f[R]\f[B]);\f[R] .PP \f[B]uint64_t ncplane_channels(const struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_set_channels(struct ncplane* \f[R]\f[I]nc\f[R]\f[B], uint64_t \f[R]\f[I]channels\f[R]\f[B]);\f[R] .PP \f[B]static inline unsigned ncplane_bchannel(struct ncplane* \f[R]\f[I]nc\f[R]\f[B]);\f[R] .PP \f[B]static inline unsigned ncplane_fchannel(struct ncplane* \f[R]\f[I]nc\f[R]\f[B]);\f[R] .PP \f[B]static inline unsigned ncplane_fg_rgb8(struct ncplane* \f[R]\f[I]nc\f[R]\f[B]);\f[R] .PP \f[B]static inline unsigned ncplane_bg_rgb8(struct ncplane* \f[R]\f[I]nc\f[R]\f[B]);\f[R] .PP \f[B]static inline unsigned ncplane_fg_alpha(struct ncplane* \f[R]\f[I]nc\f[R]\f[B]);\f[R] .PP \f[B]static inline unsigned ncplane_bg_alpha(struct ncplane* \f[R]\f[I]nc\f[R]\f[B]);\f[R] .PP \f[B]static inline unsigned ncplane_fg_rgb8(struct ncplane* \f[R]\f[I]n\f[R]\f[B], unsigned* \f[R]\f[I]r\f[R]\f[B], unsigned* \f[R]\f[I]g\f[R]\f[B], unsigned* \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]static inline unsigned ncplane_bg_rgb8(struct ncplane* \f[R]\f[I]n\f[R]\f[B], unsigned* \f[R]\f[I]r\f[R]\f[B], unsigned* \f[R]\f[I]g\f[R]\f[B], unsigned* \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_set_fg_rgb8(struct ncplane* \f[R]\f[I]n\f[R]\f[B], int \f[R]\f[I]r\f[R]\f[B], int \f[R]\f[I]g\f[R]\f[B], int \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_set_bg_rgb8(struct ncplane* \f[R]\f[I]n\f[R]\f[B], int \f[R]\f[I]r\f[R]\f[B], int \f[R]\f[I]g\f[R]\f[B], int \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_set_fg_rgb8_clipped(struct ncplane* \f[R]\f[I]n\f[R]\f[B], int \f[R]\f[I]r\f[R]\f[B], int \f[R]\f[I]g\f[R]\f[B], int \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_set_bg_rgb8_clipped(struct ncplane* \f[R]\f[I]n\f[R]\f[B], int \f[R]\f[I]r\f[R]\f[B], int \f[R]\f[I]g\f[R]\f[B], int \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_set_fg_rgb8(struct ncplane* \f[R]\f[I]n\f[R]\f[B], uint32_t \f[R]\f[I]channel\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_set_bg_rgb8(struct ncplane* \f[R]\f[I]n\f[R]\f[B], uint32_t \f[R]\f[I]channel\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_set_fg_default(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_set_bg_default(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_set_fg_alpha(struct ncplane* \f[R]\f[I]n\f[R]\f[B], unsigned \f[R]\f[I]alpha\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_set_bg_alpha(struct ncplane* \f[R]\f[I]n\f[R]\f[B], unsigned \f[R]\f[I]alpha\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_set_fg_palindex(struct ncplane* \f[R]\f[I]n\f[R]\f[B], int \f[R]\f[I]idx\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_set_bg_palindex(struct ncplane* \f[R]\f[I]n\f[R]\f[B], int \f[R]\f[I]idx\f[R]\f[B]);\f[R] .PP \f[B]uint16_t ncplane_styles(const struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_set_styles(struct ncplane* \f[R]\f[I]n\f[R]\f[B], unsigned \f[R]\f[I]stylebits\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_on_styles(struct ncplane* \f[R]\f[I]n\f[R]\f[B], unsigned \f[R]\f[I]stylebits\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_off_styles(struct ncplane* \f[R]\f[I]n\f[R]\f[B], unsigned \f[R]\f[I]stylebits\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_greyscale(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_blit_bgrx(struct ncplane* \f[R]\f[I]nc\f[R]\f[B], int \f[R]\f[I]placey\f[R]\f[B], int \f[R]\f[I]placex\f[R]\f[B], int \f[R]\f[I]linesize\f[R]\f[B], ncblitter_e \f[R]\f[I]blitter\f[R]\f[B], const unsigned char* \f[R]\f[I]data\f[R]\f[B], int \f[R]\f[I]begy\f[R]\f[B], int \f[R]\f[I]begx\f[R]\f[B], int \f[R]\f[I]leny\f[R]\f[B], int \f[R]\f[I]lenx\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_blit_rgba(struct ncplane* \f[R]\f[I]nc\f[R]\f[B], int \f[R]\f[I]placey\f[R]\f[B], int \f[R]\f[I]placex\f[R]\f[B], int \f[R]\f[I]linesize\f[R]\f[B], ncblitter_e \f[R]\f[I]blitter\f[R]\f[B], const unsigned char* \f[R]\f[I]data\f[R]\f[B], int \f[R]\f[I]begy\f[R]\f[B], int \f[R]\f[I]begx\f[R]\f[B], int \f[R]\f[I]leny\f[R]\f[B], int \f[R]\f[I]lenx\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_destroy(struct ncplane* \f[R]\f[I]ncp\f[R]\f[B]);\f[R] .PP \f[B]void notcurses_drop_planes(struct notcurses* \f[R]\f[I]nc\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_mergedown(const struct ncplane* \f[R]\f[I]src\f[R]\f[B], struct ncplane* \f[R]\f[I]dst\f[R]\f[B], int \f[R]\f[I]begsrcy\f[R]\f[B], int \f[R]\f[I]begsrcx\f[R]\f[B], int \f[R]\f[I]leny\f[R]\f[B], int \f[R]\f[I]lenx\f[R]\f[B], int \f[R]\f[I]dsty\f[R]\f[B], int \f[R]\f[I]dstx\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_mergedown_simple(const struct ncplane* restrict \f[R]\f[I]src\f[R]\f[B], struct ncplane* restrict \f[R]\f[I]dst\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_erase(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]bool ncplane_set_scrolling(struct ncplane* \f[R]\f[I]n\f[R]\f[B], bool \f[R]\f[I]scrollp\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_rotate_cw(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_rotate_ccw(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .SS DESCRIPTION .PP Ncplanes are the fundamental drawing object of notcurses. All output functions take a \f[B]struct ncplane\f[R] as an argument. They can be any size, and placed anywhere. In addition to its framebuffer--a rectilinear matrix of \f[B]nccell\f[R]s (see \f[B]notcurses_cell(3)\f[R])--an ncplane is defined by: .IP \[bu] 2 a base \f[B]nccell\f[R], used for any cell on the plane without a glyph, .IP \[bu] 2 the egcpool backing its \f[B]nccell\f[R]s, .IP \[bu] 2 a current cursor location, .IP \[bu] 2 a current style, foreground channel, and background channel, .IP \[bu] 2 its geometry, .IP \[bu] 2 a configured user pointer, .IP \[bu] 2 position relative to the standard plane, .IP \[bu] 2 the plane, if any, to which it is bound, .IP \[bu] 2 the next plane bound by the plane to which it is bound, .IP \[bu] 2 the head of the list of its bound planes, .IP \[bu] 2 its z-index, and .IP \[bu] 2 a name (used only for debugging). .PP New planes can be created with \f[B]ncplane_create\f[R]. If a plane is bound to another, x and y coordinates are relative to the plane to which it is bound, and if this latter plane moves, all its bound planes move along with it. When a plane is destroyed, all planes bound to it (directly or transitively) are destroyed. .PP \f[B]ncplane_reparent\f[R] detaches the plane \f[B]\f[BI]n\f[B]\f[R] from any plane to which it is bound, and binds it to \f[B]\f[BI]newparent\f[B]\f[R]. Its children are reparented to its previous parent. The standard plane cannot be reparented. If \f[B]\f[BI]newparent\f[B]\f[R] is \f[B]NULL\f[R], the plane becomes the root plane of a new, unrendered stack. When \f[B]ncplane_reparent_family\f[R] is used, all planes bound to \f[B]\f[BI]n\f[B]\f[R] move along with it during a reparenting operation. See Piles below. .PP \f[B]ncplane_destroy\f[R] destroys a particular ncplane, after which it must not be used again. \f[B]notcurses_drop_planes\f[R] destroys all ncplanes other than the stdplane. Any references to such planes are, of course, invalidated. It is undefined to destroy a plane concurrently with any other operation involving that plane, or any operation involving the z-axis. .PP It is an error for two threads to concurrently mutate a single ncplane. So long as rendering is not taking place, however, multiple threads may safely output to multiple ncplanes. So long as all threads are readers, multiple threads may work with a single ncplane. A reading function is any which accepts a \f[B]const struct ncplane\f[R]. .PP \f[B]ncplane_yx\f[R] returns the coordinates of the specified plane\[aq]s origin, relative to the plane to which it is bound. Either or both of \f[B]\f[BI]y\f[B]\f[R] and \f[B]\f[BI]x\f[B]\f[R] may be \f[B]NULL\f[R]. \f[B]ncplane_y\f[R] and \f[B]ncplane_x\f[R] allow a single component of this location to be retrieved. \f[B]ncplane_abs_yx\f[R] returns the coordinates of the specified plane\[aq]s origin relative to its pile. .PP \f[B]ncplane_translate\f[R] translates coordinates expressed relative to the plane \f[B]\f[BI]src\f[B]\f[R], and writes the coordinates of that cell relative to \f[B]\f[BI]dst\f[B]\f[R]. The cell need not intersect with \f[B]\f[BI]dst\f[B]\f[R], though this will yield coordinates which are invalid for writing or reading on \f[B]\f[BI]dst\f[B]\f[R]. If \f[B]\f[BI]dst\f[B]\f[R] is \f[B]NULL\f[R], it is taken to refer to the standard plane. \f[B]ncplane_translate_abs\f[R] takes coordinates expressed relative to the standard plane, and returns coordinates relative to \f[B]\f[BI]dst\f[B]\f[R], returning \f[B]false\f[R] if the coordinates are invalid for \f[B]\f[BI]dst\f[B]\f[R]. .PP \f[B]ncplane_mergedown\f[R] writes to \f[B]\f[BI]dst\f[B]\f[R] the frame that would be rendered if only \f[B]\f[BI]src\f[B]\f[R] and \f[B]\f[BI]dst\f[B]\f[R] existed on the z-axis, ad \f[B]\f[BI]dst\f[B]\f[R] represented the entirety of the rendering region. Only those cells where \f[B]\f[BI]src\f[B]\f[R] intersects with \f[B]\f[BI]dst\f[B]\f[R] might see changes. It is an error to merge a plane onto itself. .PP \f[B]ncplane_erase\f[R] zeroes out every cell of the plane, dumps the egcpool, and homes the cursor. The base cell is preserved, as are the active attributes. .PP When a plane is resized (whether by \f[B]ncplane_resize\f[R], \f[B]SIGWINCH\f[R], or any other mechanism), a depth-first recursion is performed on its children. Each child plane having a non-\f[B]NULL\f[R] \f[B]resizecb\f[R] will see that callback invoked following resizing of its parent\[aq]s plane. If it returns non-zero, the resizing cascade terminates, returning non-zero. Otherwise, resizing proceeds recursively. .SS Base cells .PP Each plane has a base cell, initialized to all zeroes. When rendering, the cells of the plane are examined in turn. Each cell has three independent rendering elements--its EGC, its foreground channel, and its background channel. Any default channel is replaced with the corresponding channel from that plane\[aq]s base cell. \f[B]ncplane_erase\f[R] has no effect on the base cell. Calling \f[B]ncplane_erase\f[R] on a plane whose base cell is a purple \[aq]A\[aq] results (for rendering purposes) in a plane made up entirely of purple \[aq]A\[aq]s. .PP \f[B]ncplane_set_base_cell\f[R] uses the \f[B]nccell\f[R] \f[B]\f[BI]c\f[B]\f[R] (which must be bound to the \f[B]ncplane\f[R] \f[B]\f[BI]ncp\f[B]\f[R], and must be the first \f[B]nccell\f[R] of a multicolumn sequence) to set the base cell. \f[B]ncplane_set_base\f[R] does the same with \f[B]\f[BI]egc\f[B]\f[R], \f[B]\f[BI]stylemask\f[B]\f[R], and \f[B]\f[BI]channels\f[B]\f[R]. .SS Piles .PP A single \f[B]notcurses\f[R] context is made up of one or more piles. A pile is a set of one or more \f[B]ncplane\f[R]s, including the partial orderings made up of their binding and z-axis pointers. A pile has a top and bottom \f[B]ncplane\f[R] (this might be a single plane), and one or more root planes (planes which are bound to themselves). Multiple threads can concurrently operate on distinct piles, even changing one while rendering another. .PP Each plane is part of one and only one pile. By default, a plane is part of the same pile containing that plane to which it is bound. If \f[B]ncpile_create\f[R] is used in the place of \f[B]ncplane_create\f[R], the returned plane becomes the root plane, top, and bottom of a new pile. As a root plane, it is bound to itself. A new pile can also be created by reparenting a plane to itself, though if the plane is already a root plane, this is a no-op. .PP When a plane is moved to a different pile (whether new or preexisting), any planes which were bound to it are rebound to its previous parent. If the plane was a root plane of some pile, any bound planes become root planes. The new plane is placed immediately atop its new parent on its new pile\[aq]s z-axis. When \f[C]ncplane_reparent_family()\f[R] is used, all planes bound to the reparented plane are moved along with it. Their relative z-order is maintained. .SS Scrolling .PP All planes, including the standard plane, are created with scrolling disabled. Control scrolling on a per-plane basis with \f[B]ncplane_set_scrolling\f[R]. Attempting to print past the end of a line will stop at the plane boundary, and indicate an error. On a plane 10 columns wide and two rows high, printing \[dq]0123456789\[dq] at the origin should succeed, but printing \[dq]01234567890\[dq] will by default fail at the eleventh character. In either case, the cursor will be left at location 0x10; it must be moved before further printing can take place. If scrolling is enabled, the first row will be filled with 01234546789, the second row will have 0 written to its first column, and the cursor will end up at 1x1. Note that it is still an error to manually attempt to move the cursor off-plane, or to specify off-plane output. Boxes do not scroll; attempting to draw a 2x11 box on our 2x10 plane will result in an error and no output. When scrolling is enabled, and output takes place while the cursor is past the end of the last row, the first row is discarded, all other rows are moved up, the last row is cleared, and output begins at the beginning of the last row. This does not take place until output is generated (i.e. it is possible to fill a plane when scrolling is enabled). .SH RETURN VALUES .PP \f[B]ncplane_create\f[R] and \f[B]ncplane_dup\f[R] return a new \f[B]struct ncplane\f[R] on success, or \f[B]NULL\f[R] on failure. .PP \f[B]ncplane_userptr\f[R] returns the configured user pointer for the ncplane, and cannot fail. .PP \f[B]ncplane_below\f[R] returns the plane below the specified ncplane. If the provided plane is the bottommost plane, NULL is returned. It cannot fail. .PP \f[B]ncplane_set_scrolling\f[R] returns \f[B]true\f[R] if scrolling was previously enabled, and \f[B]false\f[R] otherwise. .PP \f[B]ncpile_top\f[R] and \f[B]ncpile_bottom\f[R] return the topmost and bottommost planes, respectively, of the pile containing their argument. \f[B]notcurses_top\f[R] and \f[B]notcurses_bottom\f[R] do the same for the standard pile. .PP \f[B]ncplane_at_yx\f[R] and \f[B]ncplane_at_cursor\f[R] return a heap-allocated copy of the EGC at the relevant cell, or \f[B]NULL\f[R] if the cell is invalid. The caller should free this result. \f[B]ncplane_at_yx_cell\f[R] and \f[B]ncplane_at_cursor_cell\f[R] instead load these values into an \f[B]nccell\f[R], which is invalidated if the associated plane is destroyed. The caller should release this \f[B]nccell\f[R] with \f[B]cell_release\f[R]. .PP Functions returning \f[B]int\f[R] return 0 on success, and non-zero on error. .PP All other functions cannot fail (and return \f[B]void\f[R]). .SH NOTES .PP \f[B]ncplane_new\f[R] is defined as a deprecated wrapper around \f[B]ncplane_create\f[R]. It should not be used in new code. .SH SEE ALSO .PP \f[B]notcurses(3)\f[R], \f[B]notcurses_cell(3)\f[R], \f[B]notcurses_output(3)\f[R], \f[B]notcurses_stdplane(3)\f[R] .SH AUTHORS nick black .