2020-01-02 02:23:11 +00:00
|
|
|
% notcurses_ncplane(3)
|
|
|
|
% nick black <nickblack@linux.com>
|
2020-02-11 02:37:20 +00:00
|
|
|
% v1.1.7
|
2020-01-02 02:23:11 +00:00
|
|
|
|
|
|
|
# NAME
|
|
|
|
|
2020-01-04 07:37:55 +00:00
|
|
|
notcurses_ncplane - operations on notcurses planes
|
2020-01-02 02:23:11 +00:00
|
|
|
|
|
|
|
# SYNOPSIS
|
|
|
|
|
|
|
|
**#include <notcurses.h>**
|
|
|
|
|
|
|
|
**struct ncplane* ncplane_new(struct notcurses* nc, int rows, int cols, int yoff, int xoff, void* opaque);**
|
|
|
|
|
|
|
|
**struct ncplane* ncplane_aligned(struct ncplane* n, int rows, int cols, int yoff, ncalign_e align, void* opaque);**
|
|
|
|
|
2020-01-15 17:22:10 +00:00
|
|
|
**struct ncplane* ncplane_dup(struct ncplane* n, void* opaque);**
|
|
|
|
|
2020-01-02 02:23:11 +00:00
|
|
|
**int ncplane_resize(struct ncplane* n, int keepy, int keepx, int keepleny, int keeplenx, int yoff, int xoff, int ylen, int xlen);**
|
|
|
|
|
|
|
|
**int ncplane_move_yx(struct ncplane* n, int y, int x);**
|
|
|
|
|
|
|
|
**void ncplane_yx(const struct ncplane* n, int* restrict y, int* restrict x);**
|
|
|
|
|
2020-01-30 13:55:01 +00:00
|
|
|
**int ncplane_set_base_cell(struct ncplane* ncp, const cell* c);**
|
2020-01-02 02:23:11 +00:00
|
|
|
|
2020-01-30 13:55:01 +00:00
|
|
|
**int ncplane_set_base(struct ncplane* ncp, uint64_t channels, uint32_t attrword, const char* egc);**
|
|
|
|
|
|
|
|
**int ncplane_base(struct ncplane* ncp, cell* c);**
|
2020-01-02 02:23:11 +00:00
|
|
|
|
|
|
|
**int ncplane_destroy(struct ncplane* ncp);**
|
|
|
|
|
|
|
|
**int ncplane_move_top(struct ncplane* n);**
|
|
|
|
|
|
|
|
**int ncplane_move_bottom(struct ncplane* n);**
|
|
|
|
|
|
|
|
**int ncplane_move_above(struct ncplane* n, struct ncplane* above);**
|
|
|
|
|
|
|
|
**int ncplane_move_below(struct ncplane* n, struct ncplane* below);**
|
|
|
|
|
|
|
|
**struct ncplane* ncplane_below(struct ncplane* n);**
|
|
|
|
|
|
|
|
**int ncplane_at_cursor(struct ncplane* n, cell* c);**
|
|
|
|
|
|
|
|
**int ncplane_at_yx(struct ncplane* n, int y, int x, cell* c);**
|
|
|
|
|
|
|
|
**void* ncplane_set_userptr(struct ncplane* n, void* opaque);**
|
|
|
|
|
|
|
|
**void* ncplane_userptr(struct ncplane* n);**
|
|
|
|
|
2020-01-04 12:21:54 +00:00
|
|
|
**void ncplane_dim_yx(struct ncplane* n, int* restrict rows, int* restrict cols);**
|
|
|
|
|
|
|
|
**static inline int ncplane_dim_y(struct ncplane* n);**
|
|
|
|
|
|
|
|
**static inline int ncplane_dim_x(struct ncplane* n);**
|
2020-01-02 02:23:11 +00:00
|
|
|
|
|
|
|
**int ncplane_cursor_move_yx(struct ncplane* n, int y, int x);**
|
|
|
|
|
2020-01-12 09:12:43 +00:00
|
|
|
**void ncplane_cursor_yx(struct ncplane* n, int* restrict y, int* restrict x);**
|
2020-01-02 02:23:11 +00:00
|
|
|
|
2020-01-12 09:12:43 +00:00
|
|
|
**uint64_t ncplane_channels(struct ncplane* n);**
|
2020-01-04 09:34:29 +00:00
|
|
|
|
2020-01-12 09:12:43 +00:00
|
|
|
**uint32_t ncplane_attr(struct ncplane* n);**
|
2020-01-04 09:34:29 +00:00
|
|
|
|
2020-01-12 09:12:43 +00:00
|
|
|
**static inline unsigned ncplane_bchannel(struct ncplane* nc);**
|
2020-01-04 09:34:29 +00:00
|
|
|
|
2020-01-12 09:12:43 +00:00
|
|
|
**static inline unsigned ncplane_fchannel(struct ncplane* nc);**
|
2020-01-04 09:34:29 +00:00
|
|
|
|
2020-01-12 09:12:43 +00:00
|
|
|
**static inline unsigned ncplane_fg(struct ncplane* nc);**
|
2020-01-04 09:34:29 +00:00
|
|
|
|
2020-01-12 09:12:43 +00:00
|
|
|
**static inline unsigned ncplane_bg(struct ncplane* nc);**
|
2020-01-04 09:34:29 +00:00
|
|
|
|
2020-01-12 09:12:43 +00:00
|
|
|
**static inline unsigned ncplane_fg_alpha(struct ncplane* nc);**
|
2020-01-04 09:34:29 +00:00
|
|
|
|
2020-01-12 09:12:43 +00:00
|
|
|
**static inline unsigned ncplane_bg_alpha(struct ncplane* nc);**
|
2020-01-04 09:34:29 +00:00
|
|
|
|
2020-01-12 09:12:43 +00:00
|
|
|
**static inline unsigned ncplane_fg_rgb(struct ncplane* n, unsigned* r, unsigned* g, unsigned* b);**
|
2020-01-04 09:34:29 +00:00
|
|
|
|
2020-01-12 09:12:43 +00:00
|
|
|
**static inline unsigned ncplane_bg_rgb(struct ncplane* n, unsigned* r, unsigned* g, unsigned* b);**
|
2020-01-04 09:34:29 +00:00
|
|
|
|
2020-01-12 09:12:43 +00:00
|
|
|
**int ncplane_set_fg_rgb(struct ncplane* n, int r, int g, int b);**
|
|
|
|
|
|
|
|
**int ncplane_set_bg_rgb(struct ncplane* n, int r, int g, int b);**
|
|
|
|
|
|
|
|
**void ncplane_set_fg_rgb_clipped(struct ncplane* n, int r, int g, int b);**
|
|
|
|
|
|
|
|
**void ncplane_set_bg_rgb_clipped(struct ncplane* n, int r, int g, int b);**
|
2020-01-04 09:34:29 +00:00
|
|
|
|
|
|
|
**int ncplane_set_fg(struct ncplane* n, unsigned channel);**
|
2020-01-12 09:12:43 +00:00
|
|
|
|
2020-01-04 09:34:29 +00:00
|
|
|
**int ncplane_set_bg(struct ncplane* n, unsigned channel);**
|
|
|
|
|
|
|
|
**void ncplane_set_fg_default(struct ncplane* n);**
|
2020-01-12 09:12:43 +00:00
|
|
|
|
2020-01-04 09:34:29 +00:00
|
|
|
**void ncplane_set_bg_default(struct ncplane* n);**
|
|
|
|
|
2020-01-12 09:12:43 +00:00
|
|
|
**int ncplane_set_fg_alpha(struct ncplane* n, int alpha);**
|
|
|
|
|
|
|
|
**int ncplane_set_bg_alpha(struct ncplane* n, int alpha);**
|
2020-01-04 09:34:29 +00:00
|
|
|
|
2020-01-19 01:42:29 +00:00
|
|
|
**int ncplane_set_fg_palindex(struct ncplane* n, int idx);**
|
|
|
|
|
|
|
|
**int ncplane_set_bg_palindex(struct ncplane* n, int idx);**
|
|
|
|
|
2020-01-04 09:34:29 +00:00
|
|
|
**void ncplane_styles_set(struct ncplane* n, unsigned stylebits);**
|
2020-01-12 09:12:43 +00:00
|
|
|
|
2020-01-04 09:34:29 +00:00
|
|
|
**void ncplane_styles_on(struct ncplane* n, unsigned stylebits);**
|
2020-01-12 09:12:43 +00:00
|
|
|
|
2020-01-04 09:34:29 +00:00
|
|
|
**void ncplane_styles_off(struct ncplane* n, unsigned stylebits);**
|
|
|
|
|
|
|
|
**unsigned ncplane_styles(struct ncplane* n);**
|
|
|
|
|
2020-01-17 09:31:46 +00:00
|
|
|
**void ncplane_greyscale(struct ncplane* n);**
|
|
|
|
|
2020-02-02 07:20:01 +00:00
|
|
|
**int bgrx_blit(struct ncplane* nc, int placey, int placex, int linesize, const unsigned char* data, int begy, int begx, int leny, int lenx);**
|
|
|
|
|
|
|
|
**int rgba_blit(struct ncplane* nc, int placey, int placex, int linesize, const unsigned char* data, int begy, int begx, int leny, int lenx);**
|
|
|
|
|
2020-01-02 02:23:11 +00:00
|
|
|
## DESCRIPTION
|
|
|
|
|
|
|
|
Ncplanes are the fundamental drawing object of notcurses. All output functions
|
2020-01-03 09:18:44 +00:00
|
|
|
take a **struct ncplane** as an argument. They can be any size, and placed
|
2020-01-02 02:23:11 +00:00
|
|
|
anywhere. In addition to its framebuffer--a rectilinear matrix of cells
|
|
|
|
(see **notcurses_cell(3)**)--an ncplane is defined by:
|
|
|
|
|
|
|
|
* a base cell, used for any cell on the plane without a glyph,
|
|
|
|
* the egcpool backing its cells,
|
|
|
|
* a current cursor location,
|
|
|
|
* a current style, foreground channel, and background channel,
|
|
|
|
* its geometry,
|
|
|
|
* a configured user pointer,
|
|
|
|
* its position relative to the visible plane, and
|
|
|
|
* its z-index.
|
|
|
|
|
|
|
|
# RETURN VALUES
|
|
|
|
|
2020-01-15 17:22:10 +00:00
|
|
|
**ncplane_new(3)**, **ncplane_aligned(3)**, and **ncplane_dup(3)** all return a
|
|
|
|
new **struct ncplane** on success, or **NULL** on failure.
|
2020-01-02 02:23:11 +00:00
|
|
|
|
2020-02-10 20:18:28 +00:00
|
|
|
**ncplane_userptr(3)** returns the configured user pointer for the ncplane, and
|
|
|
|
cannot fail.
|
2020-01-02 02:23:11 +00:00
|
|
|
|
|
|
|
**ncplane_below(3)** returns the plane below the specified ncplane. If the provided
|
|
|
|
plane is the bottommost plane, NULL is returned. It cannot fail.
|
|
|
|
|
|
|
|
Functions returning **int** return 0 on success, and non-zero on error.
|
|
|
|
|
|
|
|
All other functions either cannot fail (and return **void**).
|
|
|
|
|
2020-01-04 12:21:54 +00:00
|
|
|
# NOTES
|
|
|
|
|
|
|
|
It would be reasonable to expect many of these functions to accept `const struct notcurses`
|
|
|
|
parameters. Alas, almost all must manipulate the mutex contained within the object.
|
|
|
|
|
2020-01-02 02:23:11 +00:00
|
|
|
# SEE ALSO
|
|
|
|
|
|
|
|
**notcurses(3)**, **notcurses_cell(3)**, **notcurses_output(3)**,
|
|
|
|
**notcurses_stdplane(3)**
|