libnotcurses_sys/cell/
reimplemented.rs

1//! `cell*_*` reimplemented functions.
2
3#![allow(dead_code)]
4
5use crate::{
6    c_api::{
7        self, nccell_release, NcAlpha_u32, NcChannel_u32, NcChannels_u64, NcResult_i32, NcRgb_u32,
8        NcStyle_u16,
9    },
10    cstring, NcCell, NcPaletteIndex, NcPlane,
11};
12
13#[cfg(feature = "libc")]
14use crate::rstring;
15
16#[cfg(all(not(feature = "std"), feature = "libc"))]
17use alloc::string::String;
18
19const NCBOXLIGHT: &str = "┌┐└┘─│";
20const NCBOXHEAVY: &str = "┏┓┗┛━┃";
21const NCBOXROUND: &str = "╭╮╰╯─│";
22const NCBOXDOUBLE: &str = "╔╗╚╝═║";
23const NCBOXASCII: &str = "/\\\\/-|";
24const NCBOXOUTER: &str = "🭽🭾🭼🭿▁🭵🭶🭰";
25
26// Channels -----------------------------------------------------------------------
27
28/// Gets the background alpha and coloring bits from the cell [`NcChannels_u64`]
29/// as an [`NcChannel_u32`].
30///
31/// *Method: NcCell.[bchannel()][NcCell#method.bchannel].*
32#[inline]
33pub fn nccell_bchannel(cell: &NcCell) -> NcChannel_u32 {
34    c_api::ncchannels_bchannel(cell.channels)
35}
36
37/// Gets the foreground alpha and coloring bits from the cell [`NcChannels_u64`]
38/// as an [`NcChannel_u32`].
39///
40/// *Method: NcCell.[fchannel()][NcCell#method.fchannel].*
41#[inline]
42pub fn nccell_fchannel(cell: &NcCell) -> NcChannel_u32 {
43    c_api::ncchannels_fchannel(cell.channels)
44}
45
46/// Gets the alpha and coloring bits from the cell [`NcChannels_u64`].
47///
48/// *Method: NcCell.[channels()][NcCell#method.channels].*
49#[inline]
50pub fn nccell_channels(cell: &NcCell) -> NcChannels_u64 {
51    c_api::ncchannels_channels(cell.channels)
52}
53
54/// Sets the background alpha and coloring bits of the cell from an [`NcChannel_u32`],
55/// returning the new [`NcChannels_u64`].
56///
57/// *Method: NcCell.[set_bchannel()][NcCell#method.set_bchannel].*
58#[inline]
59pub fn nccell_set_bchannel(
60    cell: &mut NcCell,
61    bchannel: impl Into<NcChannel_u32>,
62) -> NcChannels_u64 {
63    c_api::ncchannels_set_bchannel(&mut cell.channels, bchannel.into())
64}
65
66/// Sets the foreground alpha and coloring bits of the cell from an [`NcChannel_u32`],
67/// returning the new [`NcChannels_u64`].
68///
69/// *Method: NcCell.[set_fchannel()][NcCell#method.set_fchannel].*
70#[inline]
71pub fn nccell_set_fchannel(
72    cell: &mut NcCell,
73    fchannel: impl Into<NcChannel_u32>,
74) -> NcChannels_u64 {
75    c_api::ncchannels_set_fchannel(&mut cell.channels, fchannel.into())
76}
77
78/// Sets the alpha and coloring bits of the cell from an [`NcChannels_u64`],
79/// returning the new [`NcChannels_u64`].
80///
81/// *Method: NcCell.[set_fchannel()][NcCell#method.set_fchannel].*
82#[inline]
83pub fn nccell_set_channels(
84    cell: &mut NcCell,
85    channels: impl Into<NcChannels_u64>,
86) -> NcChannels_u64 {
87    c_api::ncchannels_set_channels(&mut cell.channels, channels.into())
88}
89
90// Alpha -----------------------------------------------------------------------
91
92/// Gets the foreground [`NcAlpha_u32`] from an [`NcCell`] (shifted to LSBs).
93///
94/// *Method: NcCell.[fg_alpha()][NcCell#method.fg_alpha].*
95#[inline]
96pub fn nccell_fg_alpha(cell: &NcCell) -> NcAlpha_u32 {
97    c_api::ncchannels_fg_alpha(cell.channels)
98}
99
100/// Gets the background [`NcAlpha_u32`] from an [`NcCell`] (shifted to LSBs).
101///
102/// *Method: NcCell.[bg_alpha()][NcCell#method.bg_alpha].*
103#[inline]
104pub fn nccell_bg_alpha(cell: &NcCell) -> NcAlpha_u32 {
105    c_api::ncchannels_bg_alpha(cell.channels)
106}
107
108/// Sets the foreground [`NcAlpha_u32`] of an [`NcCell`].
109///
110/// *Method: NcCell.[set_fg_alpha()][NcCell#method.set_fg_alpha].*
111#[inline]
112pub fn nccell_set_fg_alpha(cell: &mut NcCell, alpha: impl Into<NcAlpha_u32>) {
113    c_api::ncchannels_set_fg_alpha(&mut cell.channels, alpha.into());
114}
115
116/// Sets the background [`NcAlpha_u32`] of an [`NcCell`].
117///
118/// *Method: NcCell.[set_bg_alpha()][NcCell#method.set_bg_alpha].*
119#[inline]
120pub fn nccell_set_bg_alpha(cell: &mut NcCell, alpha: impl Into<NcAlpha_u32>) {
121    c_api::ncchannels_set_bg_alpha(&mut cell.channels, alpha.into());
122}
123
124// u8 ---------------------------------------------------------------------
125
126/// Gets the foreground components of an [`NcCell`],
127/// and returns the [`NcChannel_u32`] (which can have some extra bits set).
128///
129/// *Method: NcCell.[fg_rgb()][NcCell#method.fg_rgb].*
130#[inline]
131pub fn nccell_fg_rgb8(cell: &NcCell, red: &mut u8, green: &mut u8, blue: &mut u8) -> NcChannel_u32 {
132    c_api::ncchannels_fg_rgb8(cell.channels, red, green, blue)
133}
134
135/// Gets the background components of an [`NcCell`],
136/// and returns the [`NcChannel_u32`] (which can have some extra bits set).
137///
138/// *Method: NcCell.[bg_rgb()][NcCell#method.bg_rgb].*
139#[inline]
140pub fn nccell_bg_rgb8(cell: &NcCell, red: &mut u8, green: &mut u8, blue: &mut u8) -> NcChannel_u32 {
141    c_api::ncchannels_bg_rgb8(cell.channels, red, green, blue)
142}
143
144/// Sets the foreground components of the [`NcCell`],
145/// and marks it as not using the "default color".
146///
147/// *Method: NcCell.[set_fg_rgb()][NcCell#method.set_fg_rgb].*
148#[inline]
149pub fn nccell_set_fg_rgb8(cell: &mut NcCell, red: u8, green: u8, blue: u8) {
150    c_api::ncchannels_set_fg_rgb8(&mut cell.channels, red, green, blue);
151}
152
153/// Sets the background components of the [`NcCell`],
154/// and marks it as not using the "default color".
155///
156/// *Method: NcCell.[set_bg_rgb()][NcCell#method.set_bg_rgb].*
157#[inline]
158pub fn nccell_set_bg_rgb8(cell: &mut NcCell, red: u8, green: u8, blue: u8) {
159    c_api::ncchannels_set_bg_rgb8(&mut cell.channels, red, green, blue);
160}
161
162// NcRgb_u32 -------------------------------------------------------------------
163
164/// Gets the foreground [`NcRgb_u32`] from an [`NcCell`] (shifted to LSBs).
165///
166/// *Method: NcCell.[fg_rgb()][NcCell#method.fg_rgb].*
167#[inline]
168pub fn nccell_fg_rgb(cell: &NcCell) -> NcRgb_u32 {
169    c_api::ncchannels_fg_rgb(cell.channels)
170}
171
172/// Gets the background [`NcRgb_u32`] from an [`NcCell`] (shifted to LSBs).
173///
174/// *Method: NcCell.[bg_rgb()][NcCell#method.bg_rgb].*
175#[inline]
176pub fn nccell_bg_rgb(cell: &NcCell) -> NcRgb_u32 {
177    c_api::ncchannels_bg_rgb(cell.channels)
178}
179
180/// Sets the foreground [`NcRgb_u32`] of an [`NcCell`],
181/// and marks it as not using the default color.
182///
183/// *Method: NcCell.[set_fg_rgb()][NcCell#method.set_fg_rgb].*
184#[inline]
185pub fn nccell_set_fg_rgb(cell: &mut NcCell, rgb: impl Into<NcRgb_u32>) {
186    c_api::ncchannels_set_fg_rgb(&mut cell.channels, rgb.into());
187}
188
189/// Sets the background [`NcRgb_u32`] of an [`NcCell`],
190/// and marks it as not using the default color.
191///
192/// *Method: NcCell.[set_bg_rgb()][NcCell#method.set_bg_rgb].*
193#[inline]
194pub fn nccell_set_bg_rgb(cell: &mut NcCell, rgb: impl Into<NcRgb_u32>) {
195    c_api::ncchannels_set_bg_rgb(&mut cell.channels, rgb.into());
196}
197
198// Default ---------------------------------------------------------------------
199
200/// Indicates to use the "default color" for the foreground [`NcChannel_u32`]
201/// of an [`NcCell`].
202///
203/// *Method: NcCell.[set_fg_default()][NcCell#method.set_fg_default].*
204#[inline]
205pub fn nccell_set_fg_default(cell: &mut NcCell) {
206    c_api::ncchannels_set_fg_default(&mut cell.channels);
207}
208
209/// Indicates to use the "default color" for the background [`NcChannel_u32`]
210/// of an [`NcCell`].
211///
212/// *Method: NcCell.[set_bg_default()][NcCell#method.set_bg_default].*
213#[inline]
214pub fn nccell_set_bg_default(cell: &mut NcCell) {
215    c_api::ncchannels_set_bg_default(&mut cell.channels);
216}
217
218/// Is the foreground [`NcChannel_u32`] of this [`NcCell`] using the
219/// "default foreground color"?
220///
221/// *Method: NcCell.[fg_default_p()][NcCell#method.fg_default_p].*
222#[inline]
223pub fn nccell_fg_default_p(cell: &NcCell) -> bool {
224    c_api::ncchannels_fg_default_p(cell.channels)
225}
226
227/// Is the background [`NcChannel_u32`] of this [`NcCell`] using the
228/// "default background color"?
229///
230/// The "default background color" must generally be used to take advantage of
231/// terminal-effected transparency.
232///
233/// *Method: NcCell.[bg_default_p()][NcCell#method.bg_default_p].*
234#[inline]
235pub fn nccell_bg_default_p(cell: &NcCell) -> bool {
236    c_api::ncchannels_bg_default_p(cell.channels)
237}
238
239// Palette ---------------------------------------------------------------------
240
241/// Is the foreground [`NcChannel_u32`] of this [`NcCell`] using an
242/// [`NcPaletteIndex`] indexed [`NcPalette`][crate::NcPalette] color?
243///
244/// *Method: NcCell.[fg_palindex_p()][NcCell#method.fg_palindex_p].*
245#[inline]
246pub fn nccell_fg_palindex_p(cell: &NcCell) -> bool {
247    c_api::ncchannels_fg_palindex_p(cell.channels)
248}
249
250/// Is the background [`NcChannel_u32`] of this [`NcCell`] using an
251/// [`NcPaletteIndex`] indexed [`NcPalette`][crate::NcPalette] color?
252///
253/// *Method: NcCell.[bg_palindex_p()][NcCell#method.bg_palindex_p].*
254#[inline]
255pub fn nccell_bg_palindex_p(cell: &NcCell) -> bool {
256    c_api::ncchannels_bg_palindex_p(cell.channels)
257}
258
259/// Gets the [`NcPaletteIndex`] of the foreground [`NcChannel_u32`] of the [`NcCell`].
260///
261/// *Method: NcCell.[fg_palindex()][NcCell#method.fg_palindex].*
262#[inline]
263#[allow(clippy::unnecessary_cast)]
264pub const fn nccell_fg_palindex(cell: &NcCell) -> NcPaletteIndex {
265    ((cell.channels & 0xff00000000 as NcChannels_u64) >> 32) as NcPaletteIndex
266}
267
268/// Gets the [`NcPaletteIndex`] of the background [`NcChannel_u32`] of the [`NcCell`].
269///
270/// *Method: NcCell.[bg_palindex()][NcCell#method.bg_palindex].*
271#[inline]
272#[allow(clippy::unnecessary_cast)]
273pub const fn nccell_bg_palindex(cell: &NcCell) -> NcPaletteIndex {
274    (cell.channels & 0xff) as NcPaletteIndex
275}
276
277/// Sets an [`NcCell`]'s foreground [`NcPaletteIndex`].
278///
279/// Also sets [`NcChannels_u64::FG_PALETTE`] and [`NCALPHA_OPAQUE`],
280/// and clears out [`NcChannels_u64::FG_DEFAULT_MASK`].
281///
282/// Note: Unlike the original C function, this one can't fail.
283///
284/// [`NCALPHA_OPAQUE`]: c_api::NCALPHA_OPAQUE
285/// [`NcChannels_u64::FG_PALETTE`]: NcChannels_u64#associatedconstant.FG_PALETTE
286/// [`NcChannels_u64::FG_DEFAULT_MASK`]: NcChannels_u64#associatedconstant.FG_DEFAULT_MASK
287///
288/// *Method: NcCell.[set_fg_palindex()][NcCell#method.set_fg_palindex].*
289#[inline]
290pub fn nccell_set_fg_palindex(cell: &mut NcCell, index: impl Into<NcPaletteIndex>) {
291    c_api::ncchannels_set_fg_palindex(&mut cell.channels, index.into())
292}
293
294/// Sets an [`NcCell`]'s background [`NcPaletteIndex`].
295///
296/// Also sets [`NcChannels_u64::BG_PALETTE`] and [`NCALPHA_OPAQUE`],
297/// and clears out [`NcChannels_u64::BG_DEFAULT_MASK`].
298///
299/// Note: Unlike the original C function, this one can't fail.
300///
301/// [`NCALPHA_OPAQUE`]: c_api::NCALPHA_OPAQUE
302/// [`NcChannels_u64::BG_PALETTE`]: NcChannels_u64#associatedconstant.BG_PALETTE
303/// [`NcChannels_u64::BG_DEFAULT_MASK`]: NcChannels_u64#associatedconstant.BG_DEFAULT_MASK
304///
305/// *Method: NcCell.[set_bg_palindex()][NcCell#method.set_bg_palindex].*
306#[inline]
307pub fn nccell_set_bg_palindex(cell: &mut NcCell, index: impl Into<NcPaletteIndex>) {
308    c_api::ncchannels_set_bg_palindex(&mut cell.channels, index.into())
309}
310
311// Styles ----------------------------------------------------------------------
312
313/// Gets the [`NcStyle_u16`] bits from an [`NcCell`].
314///
315/// *Method: NcCell.[cell_styles()][NcCell#method.cell_styles].*
316#[inline]
317pub const fn nccell_styles(cell: &NcCell) -> NcStyle_u16 {
318    cell.stylemask
319}
320
321/// Adds the specified [`NcStyle_u16`] bits to an [`NcCell`]'s existing spec.,
322/// whether they're actively supported or not.
323///
324/// *Method: NcCell.[styles_on()][NcCell#method.styles_on].*
325#[inline]
326pub fn nccell_on_styles(cell: &mut NcCell, stylebits: impl Into<NcStyle_u16>) {
327    cell.stylemask |= stylebits.into() & c_api::NCSTYLE_MASK;
328}
329
330/// Removes the specified [`NcStyle_u16`] bits from an [`NcCell`]'s existing spec.
331///
332/// *Method: NcCell.[styles_off()][NcCell#method.styles_off].*
333#[inline]
334pub fn nccell_off_styles(cell: &mut NcCell, stylebits: impl Into<NcStyle_u16>) {
335    cell.stylemask &= !(stylebits.into() & c_api::NCSTYLE_MASK);
336}
337
338/// Sets *just* the specified [`NcStyle_u16`] bits for an [`NcCell`],
339/// whether they're actively supported or not.
340///
341/// *Method: NcCell.[styles_set()][NcCell#method.styles_set].*
342#[inline]
343pub fn nccell_set_styles(cell: &mut NcCell, stylebits: impl Into<NcStyle_u16>) {
344    cell.stylemask = stylebits.into() & c_api::NCSTYLE_MASK;
345}
346
347// Chars -----------------------------------------------------------------------
348
349/// Returns the number of columns occupied by `cell`.
350///
351/// See [`ncstrwidth`][c_api::ncstrwidth] for an equivalent for multiple EGCs.
352#[inline]
353pub const fn nccell_cols(cell: &NcCell) -> u8 {
354    if cell.width != 0 {
355        cell.width
356    } else {
357        1
358    }
359}
360
361/// Does the [`NcCell`] contain an East Asian Wide codepoint?
362///
363/// *Method: NcCell.[double_wide_p()][NcCell#method.double_wide_p].*
364#[inline]
365pub const fn nccell_double_wide_p(cell: &NcCell) -> bool {
366    cell.width > 0
367}
368
369/// Is this the right half of a wide character?
370///
371/// *Method: NcCell.[wide_right_p()][NcCell#method.wide_right_p].*
372#[inline]
373pub const fn nccell_wide_right_p(cell: &NcCell) -> bool {
374    nccell_double_wide_p(cell) && cell.gcluster == 0
375}
376
377/// Is this the left half of a wide character?
378///
379/// *Method: NcCell.[wide_left_p()][NcCell#method.wide_left_p].*
380#[inline]
381pub const fn nccell_wide_left_p(cell: &NcCell) -> bool {
382    nccell_double_wide_p(cell) && cell.gcluster != 0
383}
384
385/// Copies the UTF8-encoded `EGC` out of the [`NcCell`], whether simple or complex.
386///
387/// The result is not tied to the [`NcPlane`],
388/// and persists across erases and destruction.
389///
390/// *Method: NcCell.[strdup()][NcCell#method.strdup].*
391#[inline]
392#[cfg(feature = "libc")]
393#[cfg_attr(feature = "nightly", doc(cfg(feature = "libc")))]
394pub fn nccell_strdup(plane: &NcPlane, cell: &NcCell) -> String {
395    rstring![libc::strdup(c_api::nccell_extended_gcluster(plane, cell))].into()
396}
397
398// Misc. -----------------------------------------------------------------------
399
400/// Saves the [`NcStyle_u16`] and the [`NcChannels_u64`],
401/// and returns the `EGC`, of an [`NcCell`].
402///
403/// *Method: NcCell.[extract()][NcCell#method.extract].*
404#[inline]
405#[cfg(feature = "libc")]
406#[cfg_attr(feature = "nightly", doc(cfg(feature = "libc")))]
407pub fn nccell_extract(
408    plane: &NcPlane,
409    cell: &NcCell,
410    stylemask: &mut NcStyle_u16,
411    channels: &mut NcChannels_u64,
412) -> String {
413    *stylemask = cell.stylemask;
414    *channels = cell.channels;
415    nccell_strdup(plane, cell)
416}
417
418/// Returns true if the two cells are distinct `EGC`s, attributes, or channels.
419///
420/// The actual egcpool index needn't be the same--indeed, the planes needn't even
421/// be the same. Only the expanded EGC must be equal. The EGC must be bit-equal;
422///
423/// *Method: NcCell.[compare()][NcCell#method.compare].*
424//
425// NOTE: FIXME: it would probably be better to test whether they're Unicode-equal
426#[inline]
427#[cfg(feature = "libc")]
428#[cfg_attr(feature = "nightly", doc(cfg(feature = "libc")))]
429pub fn nccellcmp(plane1: &NcPlane, cell1: &NcCell, plane2: &NcPlane, cell2: &NcCell) -> bool {
430    if cell1.stylemask != cell2.stylemask {
431        return true;
432    }
433    if cell1.channels != cell2.channels {
434        return true;
435    }
436    unsafe {
437        libc::strcmp(
438            c_api::nccell_extended_gcluster(plane1, cell1),
439            c_api::nccell_extended_gcluster(plane2, cell2),
440        ) != 0
441    }
442}
443
444/// Initializes (zeroes out) an [`NcCell`].
445///
446/// *Method: NcCell.[init()][NcCell#method.init].*
447#[inline]
448pub fn nccell_init(cell: &mut NcCell) {
449    *cell = unsafe { core::mem::zeroed() }
450}
451
452/// Same as [`nccell_load`][c_api::nccell_load], plus blasts the styling with
453/// `style` and `channels`.
454///
455/// - Breaks the UTF-8 string in `gcluster` down, setting up the cell `cell`.
456/// - Returns the number of bytes copied out of `gcluster`, or -1 on failure.
457/// - The styling of the cell is left untouched, but any resources are released.
458/// - Blasts the styling with `style` and `channels`.
459///
460/// *Method: NcCell.[prime()][NcCell#method.prime].*
461#[inline]
462pub fn nccell_prime(
463    plane: &mut NcPlane,
464    cell: &mut NcCell,
465    gcluster: &str,
466    style: impl Into<NcStyle_u16>,
467    channels: impl Into<NcChannels_u64>,
468) -> NcResult_i32 {
469    cell.stylemask = style.into();
470    cell.channels = channels.into();
471    let cs = cstring![gcluster];
472    unsafe { c_api::nccell_load(plane, cell, cs.as_ptr()) }
473}
474
475/// Loads up six cells with the `EGC`s necessary to draw a box.
476///
477/// Returns [`NCRESULT_OK`][c_api::NCRESULT_OK] on success
478/// or [`NCRESULT_ERR`][c_api::NCRESULT_ERR] on error.
479///
480/// On error, any [`NcCell`]s this function might have loaded before the error
481/// are [nccell_release]d. There must be at least six `EGC`s in `gcluster`.
482///
483/// *Method: NcCell.[load_box()][NcCell#method.load_box].*
484#[inline]
485pub fn nccells_load_box(
486    plane: &mut NcPlane,
487    style: impl Into<NcStyle_u16>,
488    channels: impl Into<NcChannels_u64>,
489    ul: &mut NcCell,
490    ur: &mut NcCell,
491    ll: &mut NcCell,
492    lr: &mut NcCell,
493    hl: &mut NcCell,
494    vl: &mut NcCell,
495    gcluster: &str,
496) -> NcResult_i32 {
497    let (style, channels) = (style.into(), channels.into());
498
499    // CHECK: mutable copy for pointer arithmetics
500
501    let cs = cstring![gcluster];
502    let mut gclu = cs.as_ptr();
503
504    let mut ulen: NcResult_i32 = nccell_prime(plane, ul, gcluster, style, channels);
505
506    if ulen > 0 {
507        gclu = unsafe { gclu.offset(ulen as isize) };
508        ulen = nccell_prime(plane, ur, gcluster, style, channels);
509
510        if ulen > 0 {
511            gclu = unsafe { gclu.offset(ulen as isize) };
512            ulen = nccell_prime(plane, ll, gcluster, style, channels);
513
514            if ulen > 0 {
515                gclu = unsafe { gclu.offset(ulen as isize) };
516                ulen = nccell_prime(plane, lr, gcluster, style, channels);
517
518                if ulen > 0 {
519                    gclu = unsafe { gclu.offset(ulen as isize) };
520                    ulen = nccell_prime(plane, hl, gcluster, style, channels);
521
522                    if ulen > 0 {
523                        let _gclu = unsafe { gclu.offset(ulen as isize) };
524                        ulen = nccell_prime(plane, vl, gcluster, style, channels);
525
526                        if ulen > 0 {
527                            return c_api::NCRESULT_OK;
528                        }
529                        unsafe {
530                            nccell_release(plane, hl);
531                        }
532                    }
533                    unsafe {
534                        nccell_release(plane, lr);
535                    }
536                }
537                unsafe {
538                    nccell_release(plane, ll);
539                }
540            }
541            unsafe {
542                nccell_release(plane, ur);
543            }
544        }
545        unsafe {
546            nccell_release(plane, ul);
547        }
548    }
549    c_api::NCRESULT_ERR
550}
551
552/// [`nccells_load_box`] with ASCII characters.
553///
554/// *Method: NcCell.[ascii_box()][NcCell#method.ascii_box].*
555#[inline]
556pub fn nccells_ascii_box(
557    plane: &mut NcPlane,
558    style: impl Into<NcStyle_u16>,
559    channels: impl Into<NcChannels_u64>,
560    ul: &mut NcCell,
561    ur: &mut NcCell,
562    ll: &mut NcCell,
563    lr: &mut NcCell,
564    hl: &mut NcCell,
565    vl: &mut NcCell,
566) -> NcResult_i32 {
567    nccells_load_box(
568        plane,
569        style.into(),
570        channels.into(),
571        ul,
572        ur,
573        ll,
574        lr,
575        hl,
576        vl,
577        NCBOXASCII,
578    )
579}
580
581/// [`nccells_load_box`] with double line box-drawing characters.
582///
583/// *Method: NcCell.[double_box()][NcCell#method.double_box].*
584#[inline]
585pub fn nccells_double_box(
586    plane: &mut NcPlane,
587    style: impl Into<NcStyle_u16>,
588    channels: impl Into<NcChannels_u64>,
589    ul: &mut NcCell,
590    ur: &mut NcCell,
591    ll: &mut NcCell,
592    lr: &mut NcCell,
593    hl: &mut NcCell,
594    vl: &mut NcCell,
595) -> NcResult_i32 {
596    nccells_load_box(
597        plane,
598        style.into(),
599        channels.into(),
600        ul,
601        ur,
602        ll,
603        lr,
604        hl,
605        vl,
606        NCBOXDOUBLE,
607    )
608}
609
610/// [`nccells_load_box`] with heavy line box-drawing characters.
611///
612/// *Method: NcCell.[heavy_box()][NcCell#method.heavy_box].*
613#[inline]
614pub fn nccells_heavy_box(
615    plane: &mut NcPlane,
616    style: impl Into<NcStyle_u16>,
617    channels: impl Into<NcChannels_u64>,
618    ul: &mut NcCell,
619    ur: &mut NcCell,
620    ll: &mut NcCell,
621    lr: &mut NcCell,
622    hl: &mut NcCell,
623    vl: &mut NcCell,
624) -> NcResult_i32 {
625    nccells_load_box(
626        plane,
627        style.into(),
628        channels.into(),
629        ul,
630        ur,
631        ll,
632        lr,
633        hl,
634        vl,
635        NCBOXHEAVY,
636    )
637}
638
639/// [`nccells_load_box`] with light line box-drawing characters.
640///
641/// *Method: NcCell.[light_box()][NcCell#method.light_box].*
642#[inline]
643pub fn nccells_light_box(
644    plane: &mut NcPlane,
645    style: impl Into<NcStyle_u16>,
646    channels: impl Into<NcChannels_u64>,
647    ul: &mut NcCell,
648    ur: &mut NcCell,
649    ll: &mut NcCell,
650    lr: &mut NcCell,
651    hl: &mut NcCell,
652    vl: &mut NcCell,
653) -> NcResult_i32 {
654    nccells_load_box(
655        plane,
656        style.into(),
657        channels.into(),
658        ul,
659        ur,
660        ll,
661        lr,
662        hl,
663        vl,
664        NCBOXLIGHT,
665    )
666}
667
668/// [`nccells_load_box`] with round line box-drawing characters.
669///
670/// *Method: NcCell.[rounded_box()][NcCell#method.rounded_box].*
671#[inline]
672pub fn nccells_rounded_box(
673    plane: &mut NcPlane,
674    style: impl Into<NcStyle_u16>,
675    channels: impl Into<NcChannels_u64>,
676    ul: &mut NcCell,
677    ur: &mut NcCell,
678    ll: &mut NcCell,
679    lr: &mut NcCell,
680    hl: &mut NcCell,
681    vl: &mut NcCell,
682) -> NcResult_i32 {
683    nccells_load_box(
684        plane,
685        style.into(),
686        channels.into(),
687        ul,
688        ur,
689        ll,
690        lr,
691        hl,
692        vl,
693        NCBOXROUND,
694    )
695}