.\" Automatically generated by Pandoc 2.9.2.1 .\" .TH "notcurses_plane" "3" "v3.0.0" "" "" .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 #define NCPLANE_OPTION_VERALIGNED 0x0002ull #define NCPLANE_OPTION_MARGINALIZED 0x0004ull #define NCPLANE_OPTION_FIXED 0x0008ull 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_* unsigned margin_b, margin_r; // bottom and right margins } ncplane_options; #define NCSTYLE_MASK 0xffffu #define NCSTYLE_ITALIC 0x0010u #define NCSTYLE_UNDERLINE 0x0008u #define NCSTYLE_UNDERCURL 0x0004u #define NCSTYLE_BOLD 0x0002u #define NCSTYLE_STRUCK 0x0001u #define NCSTYLE_NONE 0 \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* 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]int ncplane_resize_maximize(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_resize_marginalized(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_resize_placewithin(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]int ncplane_move_rel(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], 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_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]static inline void ncplane_move_top(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]static inline void ncplane_move_bottom(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_move_family_top(struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]void ncplane_move_family_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]targ\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]targ\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_move_family_above(struct ncplane* restrict \f[R]\f[I]n\f[R]\f[B], struct ncplane* restrict \f[R]\f[I]targ\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_move_family_below(struct ncplane* restrict \f[R]\f[I]n\f[R]\f[B], struct ncplane* restrict \f[R]\f[I]targ\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_as_rgba(const struct ncplane* \f[R]\f[I]nc\f[R]\f[B], ncblitter_e \f[R]\f[I]blit\f[R]\f[B], unsigned \f[R]\f[I]begy\f[R]\f[B], unsigned \f[R]\f[I]begx\f[R]\f[B], unsigned \f[R]\f[I]leny\f[R]\f[B], unsigned \f[R]\f[I]lenx\f[R]\f[B], unsigned* \f[R]\f[I]pxdimy\f[R]\f[B], unsigned* \f[R]\f[I]pxdimx\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], unsigned \f[R]\f[I]leny\f[R]\f[B], unsigned \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], unsigned* restrict \f[R]\f[I]rows\f[R]\f[B], unsigned* restrict \f[R]\f[I]cols\f[R]\f[B]);\f[R] .PP \f[B]static inline unsigned ncplane_dim_y(const struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]static inline unsigned 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], unsigned* restrict \f[R]\f[I]y\f[R]\f[B], unsigned* 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], 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_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]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(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], unsigned \f[R]\f[I]leny\f[R]\f[B], unsigned \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(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]int ncplane_erase_region(struct ncplane* \f[R]\f[I]n\f[R]\f[B], int \f[R]\f[I]ystart\f[R]\f[B], int \f[R]\f[I]xstart\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]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]bool ncplane_scrolling_p(const struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_scrollup(struct ncplane* \f[R]\f[I]n\f[R]\f[B], int \f[R]\f[I]r\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_scrollup_child(struct ncplane* \f[R]\f[I]n\f[R]\f[B], const struct ncplane* \f[R]\f[I]child\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] .PP \f[B]void ncplane_pixel_geom(const struct notcurses* \f[R]\f[I]n\f[R]\f[B], unsigned* restrict \f[R]\f[I]pxy\f[R]\f[B], unsigned* restrict \f[R]\f[I]pxx\f[R]\f[B], unsigned* restrict \f[R]\f[I]celldimy\f[R]\f[B], unsigned* restrict \f[R]\f[I]celldimx\f[R]\f[B], unsigned* restrict \f[R]\f[I]maxbmapy\f[R]\f[B], unsigned* restrict \f[R]\f[I]maxbmapx\f[R]\f[B]);\f[R] .PP \f[B]int ncplane_set_name(struct ncplane* \f[R]\f[I]n\f[R]\f[B], const char* \f[R]\f[I]name\f[R]\f[B]);\f[R] .PP \f[B]char* ncplane_name(const struct ncplane* \f[R]\f[I]n\f[R]\f[B]);\f[R] .SH 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 resize methodology, .IP \[bu] 2 whether a sprixel (see \f[B]notcurses_visual(3)\f[R]) is associated, .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 If the \f[B]NCPLANE_OPTION_HORALIGNED\f[R] flag is provided, \f[B]\f[BI]x\f[B]\f[R] is interpreted as an \f[B]ncalign_e\f[R] rather than an absolute position. If the \f[B]NCPLANE_OPTION_VERALIGNED\f[R] flag is provided, \f[B]\f[BI]y\f[B]\f[R] is interpreted as an \f[B]ncalign_e\f[R] rather than an absolute postiion. Either way, all positions are relative to the parent plane. \f[B]ncplane_resize_realign\f[R] should usually be used together with these flags, so that the plane is automatically realigned upon a resize of its parent. .PP If the \f[B]NCPLANE_OPTION_MARGINALIZED\f[R] flag is provided, neither \f[B]NCPLANE_OPTION_HORALIGNED\f[R] nor \f[B]NCPLANE_OPTION_VERALIGNED\f[R] may be provided, and \f[B]\f[BI]rows\f[B]\f[R] and \f[B]\f[BI]cols\f[B]\f[R] must both be 0. \f[B]\f[BI]y\f[B]\f[R] and \f[B]\f[BI]x\f[B]\f[R] will be interpreted as top and left margins. \f[B]\f[BI]margin_b\f[B]\f[R] and \f[B]\f[BI]margin_r\f[B]\f[R] will be interpreted as bottom and right margins. The plane will take the maximum space possible subject to its parent planes and these margins. The plane cannot become smaller than 1x1 (the margins are best-effort). \f[B]ncplane_resize_marginalized\f[R] should usually be used together with this flag, so that the plane is automatically resized. .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 A plane can be moved relative to its parent plane\[aq]s origin with \f[B]ncplane_move_yx\f[R]. If the plane has no parent, the move is relative to the rendering area. A plane can be moved off-screen entirely, in which case it will not be visible following rasterization; it can also be partially off-screen. .PP A plane has a virtual cursor; Set its new position with \f[B]ncplane_cursor_move_yx\f[R]. Specifying -1 as one or both coordinates will hold that axis constant. You may move a cursor relatively to its current position with \f[B]ncplane_cursor_move_rel\f[R]. Unless coordinates are specified for a call, action takes place at the plane\[aq]s virtual cursor, which automatically moves along with output. The current virtual cursor location can be acquired with \f[B]ncplane_cursor_yx\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. \f[B]ncplane_erase_region\f[R] does the same for a subregion of the plane. For the latter, supply 0 for \f[B]\f[BI]ylen\f[B]\f[R] and/or \f[B]\f[BI]xlen\f[B]\f[R] to erase through that dimension, starting at the specified point. Supply -1 for \f[B]\f[BI]ystart\f[B]\f[R] and/or \f[B]\f[BI]xstart\f[B]\f[R] to use the cursor\[aq]s current position along that axis for a starting point. Negative \f[B]\f[BI]ylen\f[B]\f[R] and \f[B]\f[BI]xlen\f[B]\f[R] move up and to the left from the starting coordinate; positive \f[B]\f[BI]ylen\f[B]\f[R] and \f[B]\f[BI]xlen\f[B]\f[R] move down and to the right from same. See BUGS below. .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. .PP \f[B]ncplane_move_top\f[R] and \f[B]ncplane_move_bottom\f[R] extract their argument \f[B]\f[BI]n\f[B]\f[R] from the z-axis, and reinsert it at the top or bottom, respectively, of its pile. These functions are both O(1). \f[B]ncplane_move_family_top\f[R] and \f[B]ncplane_move_family_bottom\f[R] do the same, and move any bound descendants along with the plane. Ordering among the plane and its descendants will be maintained. For example, assume a pile with A at the top of its z-axis, followed by B, C, D, and E, where E is bound to C. Calling \f[B]ncplane_move_family_top\f[R] on C will result in the order CEABD. Calling \f[B]ncplane_move_family_bottom\f[R] on C will result in the order ABDCE. Calling \f[B]ncplane_move_family_top\f[R] or \f[B]ncplane_move_top\f[R] on E will result in EABCD. Calling \f[B]ncplane_move_family_bottom\f[R] on E is a no-op. These two functions are O(N) on the number of planes in the pile. .PP \f[B]ncplane_move_above\f[R] and \f[B]ncplane_move_below\f[R] move the argument \f[B]\f[BI]n\f[B]\f[R] above or below, respectively, the argument \f[B]\f[BI]targ\f[B]\f[R]. Both operate in O(1). .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[B]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. .PP More information is available from \f[B]notcurses_pile(3)\f[R]. .SS Binding .PP The planes of a pile make up a directed acyclic forest. Planes bound to themselves make up the root planes of the pile. Every plane is either a root plane, or bound to some other plane in its pile. A plane and its descendants make up a family. When a plane is moved using \f[B]ncplane_move_yx\f[R], its family is moved along with it. .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. Box-drawing does not result in scrolling; 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). .PP By default, planes bound to a scrolling plane will scroll along with it, if they intersect the plane. This can be disabled with the \f[B]NCPLANE_OPTION_FIXED\f[R] flag. .SS Bitmaps .PP \f[B]ncplane_pixel_geom\f[R] retrieves pixel geometry details. \f[B]pxy\f[R] and \f[B]pxx\f[R] return the size of the plane in pixels. \f[B]celldimy\f[R] and \f[B]celldimx\f[R] return the size of a cell in pixels (these ought be the same across planes). \f[B]maxbmapy\f[R] and \f[B]maxbmapx\f[R] describe the largest bitmap which can be displayed in the plane. Any parameter (save \f[B]n\f[R]) may be \f[B]NULL\f[R]. .PP When a plane is blitted to using \f[B]ncvisual_blit\f[R] and \f[B]NCBLIT_PIXEL\f[R] (see \f[B]notcurses_visual(3)\f[R]), it ceases to accept cell-based output. The sprixel will remain associated until a new sprixel is blitted to the plane, the plane is resized, the plane is erased, or the plane is destroyed. The base cell of a sprixelated plane has no effect; if the sprixel is not even multiples of the cell geometry, the \[dq]excess plane\[dq] is ignored during rendering. .PP \f[B]ncplane_at_yx\f[R] and \f[B]ncplane_at_yx_cell\f[R] retrieve the contents of the plane at the specified coordinate. The content is returned as it will be used during rendering, and thus integrates any base cell as appropriate. If called on the secondary columns of a wide glyph, \f[B]ncplane_at_yx\f[R] returns the EGC, and thus cannot be used to distinguish between primary and secondary columns. \f[B]ncplane_at_yx_cell\f[R], however, preserves this information: retrieving a secondary column of a wide glyph with \f[B]ncplane_at_yx_cell\f[R] will fill in the \f[B]nccell\f[R] argument such that \f[B]nccell_extended_gcluster(3)\f[R] returns an empty string, and \f[B]nccell_wide_right_p(3)\f[R] returns \f[B]true\f[R]. .PP \f[B]ncplane_set_name\f[R] sets the plane\[aq]s name, freeing any old name. \f[B]\f[BI]name\f[B]\f[R] may be \f[B]NULL\f[R]. .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]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]nccell_release\f[R]. .PP \f[B]ncplane_as_rgba\f[R] returns a heap-allocated array of \f[B]uint32_t\f[R] values, each representing a single RGBA pixel, or \f[B]NULL\f[R] on failure. .PP \f[B]ncplane_erase_region\f[R] returns -1 if \f[B]ystart\f[R] or \f[B]xstart\f[R] are less than -1, or outside the plane. .PP \f[B]ncplane_cursor_move_yx\f[R] returns -1 if the coordinates are beyond the dimensions of the specified plane (except for the special value -1). .PP \f[B]ncplane_cursor_move_rel\f[R] returns -1 if the coordinates are beyond the dimensions of the specified plane. .PP \f[B]ncplane_name\f[R] returns a heap-allocated copy of the plane\[aq]s name, or NULL if it has no name (or on error). .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 .SH BUGS .PP \f[B]ncplane_at_yx\f[R] doesn\[aq]t yet account for bitmap-based graphics (see \f[B]notcurses_visual(3)\f[R]). Whatever glyph-based contents existed on the plane when the bitmap was blitted will continue to be returned. .PP When the alternate screen is not used (see \f[B]notcurses_init(3)\f[R]), the contents of the terminal at startup remain present until obliterated on a cell-by-cell basis. \f[B]ncplane_erase\f[R] and \f[B]ncplane_erase_region\f[R] \f[B]cannot\f[R] be used to clear the terminal of startup content. If you want the screen cleared on startup, but do not want to use (or rely on) the alternate screen, use something like: .IP .nf \f[C] ncplane_set_base(notcurses_stdplane(nc), \[dq] \[dq], 0, 0); notcurses_render(nc); \f[R] .fi .PP or simply: .IP .nf \f[C] notcurses_refresh(nc); \f[R] .fi .SH SEE ALSO .PP \f[B]notcurses(3)\f[R], \f[B]notcurses_capabilities(3)\f[R], \f[B]notcurses_cell(3)\f[R], \f[B]notcurses_output(3)\f[R], \f[B]notcurses_pile(3)\f[R], \f[B]notcurses_stdplane(3)\f[R], \f[B]notcurses_visual(3)\f[R] .SH AUTHORS nick black .