libnotcurses_sys/plane/mod.rs
1//! `NcPlane`
2
3// functions already exported by bindgen : 100
4// -------------------------------------------
5// (#) test: 9
6// (W) wrap: 91
7// -------------------------------------------
8//W ncpile_bottom
9//W# ncpile_create
10//W ncpile_rasterize
11//W ncpile_render
12//W ncpile_render_to_buffer,
13//W ncpile_render_to_file,
14//W ncpile_top
15//W ncplane_above
16//W ncplane_abs_x
17//W ncplane_abs_y
18//W ncplane_abs_yx
19//W ncplane_as_rgba
20//W ncplane_at_cursor
21//W ncplane_at_cursor_cell
22//W ncplane_at_yx
23//W ncplane_at_yx_cell
24//W ncplane_autogrow_p
25//W ncplane_base
26//W ncplane_below
27//W ncplane_box
28//W ncplane_center_abs
29//W ncplane_contents
30//W ncplane_create
31//W ncplane_cursor_move_rel
32//W# ncplane_cursor_move_yx
33//W# ncplane_cursor_yx
34//W ncplane_destroy
35//W# ncplane_dim_yx
36//W ncplane_dup
37//W# ncplane_erase
38//W ncplane_erase_region
39//W ncplane_fadein
40//W ncplane_fadein_iteration
41//W ncplane_fadeout
42//W ncplane_fadeout_iteration
43//W ncplane_format
44//W ncplane_gradient2x1
45//W ncplane_greyscale
46// ncplane_hline_interp
47//W# ncplane_home
48//W ncplane_mergedown
49//W ncplane_mergedown_simple
50//W ncplane_move_above
51//W ncplane_move_below
52//W ncplane_move_family_above
53//W ncplane_move_family_below
54//W ncplane_move_yx
55//W# ncplane_notcurses
56//W# ncplane_notcurses_const
57//W ncplane_off_styles
58//W ncplane_on_styles
59//W ncplane_parent
60//W ncplane_parent_const
61//W ncplane_pixelgeom
62// ncplane_polyfill_yx
63//W ncplane_pulse
64//W ncplane_putc_yx
65//W ncplane_putnstr_aligned
66//W ncplane_putnstr_yx
67//W ncplane_puttext
68//W ncplane_qrcode
69//W ncplane_reparent
70//W ncplane_reparent_family
71//W# ncplane_resize
72//W ncplane_resize_marginalized
73//W ncplane_resize_maximize
74//W ncplane_resize_placewithin
75//W ncplane_resize_realign
76//W ncplane_resizecb
77//W ncplane_rotate_ccw
78//W ncplane_rotate_cw
79//W ncplane_scrolling_p
80//W ncplane_scrollup,
81//W ncplane_scrollup_child,
82//W ncplane_set_autogrow
83//W ncplane_set_base
84//W ncplane_set_base_cell
85//W ncplane_set_bg_alpha
86//W ncplane_set_bg_default
87//W ncplane_set_bg_palindex
88//W ncplane_set_bg_rgb
89// ncplane_set_bg_rgb8 // unneeded method
90//W ncplane_set_fg_alpha
91//W ncplane_set_fg_default
92//W ncplane_set_fg_palindex
93//W ncplane_set_fg_rgb
94// ncplane_set_fg_rgb8 // unneeded method
95//W ncplane_set_resizecb
96//W ncplane_set_scrolling
97//W ncplane_set_styles
98// ncplane_set_userptr
99//W ncplane_stain
100//W ncplane_styles
101//W ncplane_translate
102//W ncplane_translate_abs
103// ncplane_userptr
104// ncplane_vline_interp
105//W ncplane_x
106//W ncplane_y
107//W ncplane_yx
108
109// functions manually reimplemented: 49
110// ------------------------------------------
111// (+) done: 49
112// (W) wrap: 45
113// (#) test: 9
114// ------------------------------------------
115//W+ ncplane_ascii_box WIP
116//W+ ncplane_bchannel
117//W+ ncplane_bg_alpha
118//W# ncplane_bg_default_p
119//W+ ncplane_bg_rgb
120//W+ ncplane_bg_rgb8
121//W+ ncplane_box_sized
122//W# ncplane_channels
123//W# ncplane_dim_x
124//W# ncplane_dim_y
125//W+ ncplane_double_box
126//W+ ncplane_double_box_sized
127//W+ ncplane_fchannel
128//W+ ncplane_fg_alpha
129//W# ncplane_fg_default_p
130//W+ ncplane_fg_rgb
131//W+ ncplane_fg_rgb8
132//W+ ncplane_gradient
133//W+ ncplane_gradient_sized
134//W+ ncplane_halign
135// + ncplane_hline
136//W+ ncplane_moverel
137//W+ ncplane_move_bottom
138//W+ ncplane_move_family_bottom
139//W+ ncplane_move_family_top
140//W+ ncplane_move_top
141//W+ ncplane_perimeter
142//W+ ncplane_perimeter_double
143//W+ ncplane_perimeter_rounded
144//W+ ncplane_putc
145//W+ ncplane_putchar
146//W+ ncplane_putchar_stained
147//W+ ncplane_putchar_yx
148//W+ ncplane_putegc
149//W+ ncplane_putegc_stained
150//W+ ncplane_putegc_yx
151//W+ ncplane_putnstr
152//W+ ncplane_putstr
153//W+ ncplane_putstr_aligned
154//W+ ncplane_putstr_stained
155//W+ ncplane_putstr_yx
156//W# ncplane_resize_simple
157// + ncplane_rounded_box
158// + ncplane_rounded_box_sized
159//W# ncplane_set_bchannel
160//W# ncplane_set_channels
161//W# ncplane_set_fchannel
162//W+ ncplane_valign
163// + ncplane_vline
164
165// wont implement:
166// ----------------
167// ncplane_putegc_stained
168// ncplane_putegc_yx
169// ncplane_putwegc_stained
170// ncplane_putwstr_stained
171// ncplane_set_bg_rgb8_clipped
172// ncplane_set_fg_rgb8_clipped
173// ncplane_vprintf_aligned
174// ncplane_vprintf_stained
175// ncplane_vprintf_yx
176//
177// ncplane_putegc
178// ncplane_putwc
179// ncplane_putwc_stained
180// ncplane_putwc_yx
181// ncplane_putwegc
182// ncplane_putwegc_yx
183// ncplane_putwstr
184// ncplane_putwstr_aligned
185// ncplane_putwstr_yx
186// ncplane_vprintf
187
188pub(crate) mod helpers;
189mod methods;
190pub(crate) mod options;
191pub(crate) mod reimplemented;
192#[cfg(test)]
193pub(crate) mod test;
194
195pub use options::{NcPlaneFlag, NcPlaneOptions, NcPlaneOptionsBuilder};
196
197// NcPlane
198//
199/// A drawable [`Nc`][crate::Nc] notcurses surface, composed of [`NcCell`]s.
200///
201/// Unites a *CellMatrix* with an *EgcPool* (a matrix of `NcCells` with a pool
202/// of extended grapheme characters).
203///
204/// `type in C: ncplane (struct)`
205///
206/// # About planes and piles
207///
208/// A given notcurses context is made up of one or more piles.
209///
210/// A pile is made up of [`NcPlane`]s, totally ordered on a z-axis.
211///
212/// You can't manage the piles directly, but only the `NcPlanes`.
213///
214/// A pile is destroyed when all its planes are destroyed or moved to other
215/// piles.
216///
217/// A pile has a top and bottom plane (this might be a single `NcPlane`),
218/// and one or more root planes (`NcPlane`s which are bound to themselves).
219///
220/// Multiple threads can concurrently operate on distinct piles, rendering or
221/// mutating it, while another thread concurrently renders or mutates another.
222///
223/// Each `NcPlane` is part of one and only one pile. By default, an `NcPlane` is
224/// part of the same pile that contains the `NcPlane` to which it is bound.
225///
226/// When an `NcPlane` is created without being bound to another `NcPlane`, then
227/// it becomes the root plane, top, and bottom of a new pile. As a root plane,
228/// it is bound to itself.
229///
230/// A new pile can also be created by reparenting an `NcPlane` to itself,
231/// though if the plane is already a root plane, this is a no-op.
232///
233/// When an `NcPlane` is moved to a different pile (whether new or preexisting),
234/// any `NcPlane`s which were bound to it are rebound to its previous parent.
235/// If the `NcPlane` was a root plane of some pile, any bound planes become root
236/// planes. The new `NcPlane` is placed immediately atop its new parent on its
237/// new pile's z-axis.
238///
239/// When [`NcPlane::reparent_family`] is used, all `NcPlanes` bound to the
240/// reparented `NcPlane` are moved along with it. Their relative z-order is
241/// maintained.
242//
243/// Rendering reduces a pile of `NcPlane`s to a single `NcPlane`, proceeding
244/// from the top to the bottom along a pile's z-axis. The result is a matrix of
245/// [`NcCell`]s. Rasterizing takes this matrix, together with the
246/// current state of the visual area, and produces a stream of optimized control
247/// sequences and `EGC`s for the terminal. By writing this stream to the
248/// terminal, the physical display is synced to some pile's `NcPlane`s.
249///
250/// [`NcPlane.render`] performs the first of these tasks for the pile of which
251/// the plane is a part. The output is maintained internally; calling `render`
252/// again on the same pile will replace this state with a fresh render.
253/// Multiple piles can be concurrently rendered.
254///
255/// [`NcPlane.rasterize`] performs rasterization, and writes the result to the
256/// terminal. It is a blocking call, and only one rasterization operation may
257/// proceed at a time.
258///
259/// It is necessary to call `NcPlane.rasterize` to generate any visible output;
260/// the various *output calls* only draw to the virtual `NcPlane`s. Most of the
261/// notcurses `statistics` are updated as a result of a render, and screen
262/// geometry is refreshed (similarly to [`Nc.refresh`]) following the render.
263///
264/// # Methods & Associated Functions
265///
266/// - [Constructors & Destructors](#ncplane-constructors--destructors)
267///
268/// Methods:
269/// - [`NcAlpha`](#ncplane-methods-ncalphabits)
270/// - [`NcChannel` & `NcChannels`](#ncplane-methods-ncchannel)
271/// - [`NcRgb`, components & default color](#ncplane-methods-ncrgb-components--default-color)
272/// - [`NcStyle` & `NcPaletteIndex`](#ncplane-methods-ncstylemask--paletteindex)
273/// - [`NcCell` & strings](#ncplane-methods-nccell--strings)
274/// - [cursor](#ncplane-methods-cursor)
275/// - [`NcPlane` & `Nc`](#ncplane-methods-ncplane--nc)
276/// - [boxes & perimeters](#ncplane-methods-boxes--perimeters)
277/// - [Size, position & alignment](#ncplane-methods-size-position--alignment)
278/// - [fading, gradients & greyscale](#ncplane-methods-fading-gradients--greyscale)
279/// - [*other*](#ncplane-methods-other)
280///
281/// [`NcCell`]: crate::NcCell
282/// [`NcPlane::reparent_family`]: NcPlane#method.reparent_family
283/// [`NcPlane.render`]: crate::NcPlane#method.render
284/// [`NcPlane.rasterize`]: crate::NcPlane#method.render
285/// [`Nc.refresh`]: crate::Nc#method.refresh
286pub type NcPlane = crate::c_api::ffi::ncplane;