mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
ncplane_perimeter() plus unit test
This commit is contained in:
parent
36440ee278
commit
9fc53e811f
15
README.md
15
README.md
@ -1047,6 +1047,18 @@ ncplane_box_sized(struct ncplane* n, const cell* ul, const cell* ur,
|
||||
x + xlen - 1, ctlword);
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_perimeter(struct ncplane* n, const cell* ul, const cell* ur,
|
||||
const cell* ll, const cell* lr, const cell* hline,
|
||||
const cell* vline, unsigned ctlword){
|
||||
if(ncplane_cursor_move_yx(n, 0, 0)){
|
||||
return -1;
|
||||
}
|
||||
int dimy, dimx;
|
||||
ncplane_dim_yx(n, &dimy, &dimx);
|
||||
return ncplane_box_sized(n, ul, ur, ll, lr, hline, vline, dimy, dimx, ctlword);
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
int ystop, int xstop, unsigned ctlword){
|
||||
@ -2739,6 +2751,9 @@ up someday **FIXME**.
|
||||
* *Q:* How do I hide a plane I want to make visible later?
|
||||
* *A:* Either move it above and to the left of the screen (preventing resizes from making it visible), or place it underneath another (opaque) plane.
|
||||
|
||||
* *Q:* Why isn't there an `ncplane_box_yx()`? Do you hate orthogonality, you dullard?
|
||||
* *A:* `ncplane_box()` and friends already have far too many arguments, you monster.
|
||||
|
||||
## Supplemental material
|
||||
|
||||
### Useful links
|
||||
|
142
debian/control
vendored
142
debian/control
vendored
@ -1,20 +1,19 @@
|
||||
Source: notcurses
|
||||
Priority: optional
|
||||
Maintainer: Nick Black <dankamongmen@gmail.com>
|
||||
Build-Depends:
|
||||
cmake,
|
||||
debhelper-compat (= 12),
|
||||
dh-python (>= 4.20191017),
|
||||
dh-sequence-python3,
|
||||
libavformat-dev (>= 7:4.2.1),
|
||||
libavutil-dev (>= 7:4.2.1),
|
||||
libncurses-dev,
|
||||
libswscale-dev (>= 7:4.2.1),
|
||||
pandoc (>= 1.19.2.4),
|
||||
pkg-config,
|
||||
python3-cffi (>= 1.13.2),
|
||||
python3-dev,
|
||||
python3-setuptools (>= 44.0.0),
|
||||
Build-Depends: cmake,
|
||||
debhelper-compat (= 12),
|
||||
dh-python (>= 4.20191017),
|
||||
dh-sequence-python3,
|
||||
libavformat-dev (>= 7:4.2.1),
|
||||
libavutil-dev (>= 7:4.2.1),
|
||||
libncurses-dev,
|
||||
libswscale-dev (>= 7:4.2.1),
|
||||
pandoc (>= 1.19.2.4),
|
||||
pkg-config,
|
||||
python3-cffi (>= 1.13.2),
|
||||
python3-dev,
|
||||
python3-setuptools (>= 44.0.0)
|
||||
Standards-Version: 4.5.0
|
||||
Section: libs
|
||||
X-Python3-Version: >= 3.7
|
||||
@ -24,96 +23,99 @@ Homepage: https://nick-black.com/dankwiki/index.php/notcurses
|
||||
Vcs-Browser: https://github.com/dankamongmen/notcurses
|
||||
Vcs-Git: https://github.com/dankamongmen/notcurses.git
|
||||
|
||||
Package: libnotcurses++-dev
|
||||
Section: libdevel
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends:
|
||||
libnotcurses++1 (= ${binary:Version}),
|
||||
libnotcurses-dev (>= 1.1.6-1),
|
||||
${misc:Depends},
|
||||
Description: Development files for notcurses++
|
||||
notcurses facilitates the creation of modern TUI programs,
|
||||
making full use of Unicode and 24-bit direct color. It presents
|
||||
an API similar to that of Curses, and rides atop libtinfo.
|
||||
.
|
||||
These files are necessary for C++ development using notcurses.
|
||||
|
||||
Package: libnotcurses++1
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Recommends: ncurses-term
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Description: Shared libraries for notcurses++
|
||||
notcurses facilitates the creation of modern TUI programs,
|
||||
making full use of Unicode and 24-bit direct color. It presents
|
||||
an API similar to that of Curses, and rides atop libtinfo.
|
||||
.
|
||||
These files underlie the C++ wrappers for notcurses.
|
||||
|
||||
Package: libnotcurses-dev
|
||||
Section: libdevel
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends:
|
||||
libavformat-dev,
|
||||
libncurses-dev,
|
||||
libnotcurses1 (= ${binary:Version}),
|
||||
${misc:Depends},
|
||||
Description: Development files for notcurses
|
||||
notcurses facilitates the creation of modern TUI programs,
|
||||
making full use of Unicode and 24-bit direct color. It presents
|
||||
an API similar to that of Curses, and rides atop libtinfo.
|
||||
.
|
||||
These files are necessary for C development using notcurses.
|
||||
|
||||
Package: libnotcurses1
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Recommends: ncurses-term
|
||||
Pre-Depends: ${misc:Pre-Depends}
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Description: Shared libraries for notcurses TUI
|
||||
Description: Character graphics and TUI library
|
||||
notcurses facilitates the creation of modern TUI programs, making
|
||||
full use of Unicode and 24-bit direct color. Its API is similar
|
||||
to that of NCURSES, but extends that with z-buffering, rendering
|
||||
of images and video using ffmpeg, alpha blending, widgets, palette
|
||||
fades, resize awareness, and multithreading support.
|
||||
|
||||
Package: libnotcurses-dev
|
||||
Section: libdevel
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends: libavformat-dev,
|
||||
libncurses-dev,
|
||||
libnotcurses1 (= ${binary:Version}),
|
||||
${misc:Depends}
|
||||
Description: Character graphics and TUI library (development)
|
||||
notcurses facilitates the creation of modern TUI programs, making
|
||||
full use of Unicode and 24-bit direct color. Its API is similar
|
||||
to that of NCURSES, but extends that with z-buffering, rendering
|
||||
of images and video using ffmpeg, alpha blending, widgets, palette
|
||||
fades, resize awareness, and multithreading support.
|
||||
.
|
||||
These files are necessary for C development using notcurses.
|
||||
|
||||
Package: libnotcurses++1
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Recommends: ncurses-term
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Description: Character graphics and TUI library (C++ wrappers)
|
||||
notcurses facilitates the creation of modern TUI programs,
|
||||
making full use of Unicode and 24-bit direct color. It presents
|
||||
an API similar to that of Curses, and rides atop libtinfo.
|
||||
.
|
||||
These files underlie the C++ wrappers for notcurses.
|
||||
|
||||
Package: libnotcurses++-dev
|
||||
Section: libdevel
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends: libnotcurses++1 (= ${binary:Version}),
|
||||
libnotcurses-dev (>= 1.1.6-1),
|
||||
${misc:Depends}
|
||||
Description: Character graphics and TUI library (C++ development)
|
||||
notcurses facilitates the creation of modern TUI programs,
|
||||
making full use of Unicode and 24-bit direct color. It presents
|
||||
an API similar to that of Curses, and rides atop libtinfo.
|
||||
.
|
||||
These files are necessary for C++ development using notcurses.
|
||||
|
||||
Package: notcurses-bin
|
||||
Architecture: any
|
||||
Multi-Arch: foreign
|
||||
Section: graphics
|
||||
Depends:
|
||||
ncurses-term,
|
||||
notcurses-data (= ${source:Version}),
|
||||
${misc:Depends},
|
||||
${shlibs:Depends},
|
||||
Description: Binaries from libnotcurses
|
||||
Depends: ncurses-term,
|
||||
notcurses-data (= ${source:Version}),
|
||||
${misc:Depends},
|
||||
${shlibs:Depends}
|
||||
Description: Character graphics and TUI library demos
|
||||
notcurses facilitates the creation of modern TUI programs,
|
||||
making full use of Unicode and 24-bit direct color. It presents
|
||||
an API similar to that of Curses, and rides atop libtinfo.
|
||||
.
|
||||
These utilities from the notcurses project include notcurses-demo,
|
||||
notcurses-view, notcurses-planereel, and notcurses-input. In
|
||||
addition, the unit tests are bundled as notcurses-tester.
|
||||
These utilities from the notcurses project include notcurses-demo
|
||||
(a demonstration of various libnotcurses capabilities) and
|
||||
notcurses-view (a character mode multimedia player), among other
|
||||
tools. Unit tests are furthermore bundled as notcurses-tester.
|
||||
|
||||
Package: notcurses-data
|
||||
Architecture: all
|
||||
Multi-Arch: foreign
|
||||
Section: graphics
|
||||
Depends: ncurses-term, ${misc:Depends}
|
||||
Description: Multimedia used by notcurses-demo
|
||||
Description: Multimedia used by notcurses-bin
|
||||
notcurses facilitates the creation of modern TUI programs,
|
||||
making full use of Unicode and 24-bit direct color. It presents
|
||||
an API similar to that of Curses, and rides atop libtinfo.
|
||||
.
|
||||
This package contains multimedia used by notcurses-demo.
|
||||
This package contains multimedia used by notcurses-demo
|
||||
and notcurses-tester from the notcurses-bin package.
|
||||
|
||||
Package: python3-notcurses
|
||||
Section: python
|
||||
Architecture: any
|
||||
Depends: ${misc:Depends}, ${python3:Depends}, ${shlibs:Depends}
|
||||
Provides: ${python3:Provides}
|
||||
Description: Python wrappers for notcurses (Python 3)
|
||||
Description: Character graphics and TUI library (Python)
|
||||
notcurses facilitates the creation of modern TUI programs,
|
||||
making full use of Unicode and 24-bit direct color. It presents
|
||||
an API similar to that of Curses, and rides atop libtinfo.
|
||||
|
@ -10,17 +10,13 @@ notcurses_lines - operations on lines and boxes
|
||||
|
||||
**#include <notcurses.h>**
|
||||
|
||||
**int ncplane_hline_interp(struct ncplane* n, const cell* c, int len,
|
||||
uint64_t c1, uint64_t c2);**
|
||||
**int ncplane_hline_interp(struct ncplane* n, const cell* c, int len, uint64_t c1, uint64_t c2);**
|
||||
|
||||
**static inline int
|
||||
ncplane_hline(struct ncplane* n, const cell* c, int len);**
|
||||
**static inline int ncplane_hline(struct ncplane* n, const cell* c, int len);**
|
||||
|
||||
**int ncplane_vline_interp(struct ncplane* n, const cell* c, int len,
|
||||
uint64_t c1, uint64_t c2);**
|
||||
**int ncplane_vline_interp(struct ncplane* n, const cell* c, int len, uint64_t c1, uint64_t c2);**
|
||||
|
||||
**static inline int
|
||||
ncplane_vline(struct ncplane* n, const cell* c, int len);**
|
||||
**static inline int ncplane_vline(struct ncplane* n, const cell* c, int len);**
|
||||
|
||||
```c
|
||||
#define NCBOXMASK_TOP 0x0001
|
||||
@ -45,34 +41,21 @@ ncplane_box_sized(struct ncplane* n, const cell* ul, const cell* ur,
|
||||
const cell* ll, const cell* lr, const cell* hline,
|
||||
const cell* vline, int ylen, int xlen, unsigned ctlword);**
|
||||
|
||||
**static inline int
|
||||
cells_load_box(struct ncplane* n, uint32_t attrs, uint64_t channels,
|
||||
cell* ul, cell* ur, cell* ll, cell* lr,
|
||||
cell* hl, cell* vl, const char* gclusters);**
|
||||
**static inline int ncplane_perimeter(struct ncplane* n, const cell* ul, const cell* ur, const cell* ll, const cell* lr, const cell* hline, const cell* vline, unsigned ctlword)**
|
||||
|
||||
**static inline int
|
||||
cells_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl);**
|
||||
**static inline int cells_load_box(struct ncplane* n, uint32_t attrs, uint64_t channels, cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl, const char* gclusters);**
|
||||
|
||||
**static inline int
|
||||
ncplane_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
int ystop, int xstop, unsigned ctlword);**
|
||||
**static inline int cells_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels, cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl);**
|
||||
|
||||
**static inline int
|
||||
ncplane_rounded_box_sized(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
int ylen, int xlen, unsigned ctlword);**
|
||||
**static inline int ncplane_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels, int ystop, int xstop, unsigned ctlword);**
|
||||
|
||||
**static inline int
|
||||
cells_double_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl);**
|
||||
**static inline int ncplane_rounded_box_sized(struct ncplane* n, uint32_t attr, uint64_t channels, int ylen, int xlen, unsigned ctlword);**
|
||||
|
||||
**static inline int
|
||||
ncplane_double_box(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
int ystop, int xstop, unsigned ctlword);**
|
||||
**static inline int cells_double_box(struct ncplane* n, uint32_t attr, uint64_t channels, cell* ul, cell* ur, cell* ll, cell* lr, cell* hl, cell* vl);**
|
||||
|
||||
**static inline int
|
||||
ncplane_double_box_sized(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
int ylen, int xlen, unsigned ctlword);**
|
||||
**static inline int ncplane_double_box(struct ncplane* n, uint32_t attr, uint64_t channels, int ystop, int xstop, unsigned ctlword);**
|
||||
|
||||
**static inline int ncplane_double_box_sized(struct ncplane* n, uint32_t attr, uint64_t channels, int ylen, int xlen, unsigned ctlword);**
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
@ -82,4 +65,6 @@ ncplane_double_box_sized(struct ncplane* n, uint32_t attr, uint64_t channels,
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
**notcurses(3)**, **notcurses_cell(3)**, **notcurses_ncplane(3)**
|
||||
**notcurses(3)**,
|
||||
**notcurses_cell(3)**,
|
||||
**notcurses_ncplane(3)**
|
||||
|
@ -897,6 +897,18 @@ ncplane_box_sized(struct ncplane* n, const cell* ul, const cell* ur,
|
||||
x + xlen - 1, ctlword);
|
||||
}
|
||||
|
||||
static inline int
|
||||
ncplane_perimeter(struct ncplane* n, const cell* ul, const cell* ur,
|
||||
const cell* ll, const cell* lr, const cell* hline,
|
||||
const cell* vline, unsigned ctlword){
|
||||
if(ncplane_cursor_move_yx(n, 0, 0)){
|
||||
return -1;
|
||||
}
|
||||
int dimy, dimx;
|
||||
ncplane_dim_yx(n, &dimy, &dimx);
|
||||
return ncplane_box_sized(n, ul, ur, ll, lr, hline, vline, dimy, dimx, ctlword);
|
||||
}
|
||||
|
||||
// Erase every cell in the ncplane, resetting all attributes to normal, all
|
||||
// colors to the default color, and all cells to undrawn. All cells associated
|
||||
// with this ncplane is invalidated, and must not be used after the call,
|
||||
|
@ -963,6 +963,12 @@ TEST_CASE("NCPlane") {
|
||||
CHECK(!cell_double_wide_p(&c));
|
||||
}
|
||||
|
||||
SUBCASE("Perimeter") {
|
||||
cell c = CELL_SIMPLE_INITIALIZER('X');
|
||||
CHECK(0 == ncplane_perimeter(n_, &c, &c, &c, &c, &c, &c, 0));
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
}
|
||||
|
||||
CHECK(0 == notcurses_stop(nc_));
|
||||
CHECK(0 == fclose(outfp_));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user