Commit Graph

1110 Commits (43c81ed94439017709b7fa95738ba4c13cd51def)

Author SHA1 Message Date
nick black 7b61395ec4 sixel: set egc width properly based off tcache #1380 3 years ago
nick black 7592d0c4a3 rendered mode: properly scale pixel graphics #1380 3 years ago
nick black 0ffbba3365 restore stashed stats for closing banner #1374 3 years ago
nick black 100a89291b hide cell_{b,f}channel(), cell_set_{b,f}channel() 3 years ago
nick black 53c52e30ff remove c++/rust channel wholesalers 3 years ago
nick black 6c7c9be6d2 require explicit check for pixel support
Add `notcurses_check_pixel_support()` and
`ncdirect_check_pixel_support()` per #1367. Removes
NCOPTION_VERIFY_SIXEL, again per #1367. Adds
`free_terminfo_cache()`, and calls it from both
`notcurses_stop_minimal()` and `ncdirect_stop()`.
Update all documentation. Closes #1371 and #1367.
3 years ago
nick black 40746e76e6 s/nonehi/hires/g 3 years ago
nick black 391fef3a3f cell pixel defines / inlines #200 3 years ago
nick black 036d0a8697 s/NCBLIT_SIXEL/NCBLIT_PIXEL/g #1095 3 years ago
nick black aa4da3f335
nctree: drop bchannels from options 3 years ago
Nick Black e30b12a480
nctree (#1361)
The nctree widget, PoC, and unitt rs #1164.
3 years ago
nick black 2221120543 add SIGILL to documented fatal signals #1357 3 years ago
nick black 8a7ff8a317 signals: restore them on exit #1357 3 years ago
nick black 925870bd7a
update some definitions in USAGE.md 3 years ago
nick black 4951ea3d88
update comment on notcurses_lex_scalemode() 3 years ago
nick black d845e979c2
tighten up CELL_BG_ALPHA_MASK 3 years ago
nick black 2741b049cb
don't expose nctree in 2.2.2 3 years ago
nick black 1df9d85f28
Lock accesses to notcurses_stats #1139
notcurses_stats() and notcurses_stats_reset() now take the
new statlock member, as do stat modifications from render,
raster, writeout, resize, plane creation, and plane
destruction. Add nonnull attributes to stats API. Initialize
and destroy statlock as part of notcurses struct. Update
documentation. Free pilelock on error paths. Closes #1139.
3 years ago
nick black bb14694000 add nctree movement api #1164 3 years ago
nick black 3eb42d6c0c implment nctree_create()/free() #1164 3 years ago
nick black 7a698310b6 ncinput is not opaque 3 years ago
nick black 2348546932 nctree API cut 1 #1164 3 years ago
nick black e88875c4a7 nctree: add nctreecb to options #1164 3 years ago
nick black 7e56c8e1c2 nctree_options definition #1164 3 years ago
nick black 1b1e0b88be
ncplane_qrcode: drop blitter argument, update docs 3 years ago
nick black e63ca5f704 use ALLOC in ncdirect.h 3 years ago
nick black 602531ff33 include warn_unused_result in ALLOC 3 years ago
nick black 1b61786694 apply ((alloc)) attributes to API 3 years ago
Marek Habersack d32bef358d [C++] API sync
After a long delay, apologies :)

Added:
  * NotCurses: `can_sextant` (`notcurses_cansextant`)
  * Notcurses: `linesigs_enable` (`notcurses_linesigs_enable`)
  * Notcurses: `linesigs_disable` (`notcurses_linesigs_disable`)
  * Pile: `top_with` (`ncpile_top`)
  * Pile: `bottom_with` (`ncpile_bottom`)
  * Plane: `resize_maximize` (`ncplane_resize_maximize`)
  * Plane: `get_abs_x` (`ncplane_abs_x`)
  * Plane: `get_abs_y` (`ncplane_abs_y`)
  * Plane: `get_abs_yx` (`ncplane_abs_yx`)
  * Plane: `load_egc32` (`cell_load_egc32`)
  * Plane: `is_descendant_of` (`ncplane_descendant_p`)
  * Progbar: new class, wraps `ncprogbar_*`

Changed:
  * Plane (ABI break): `at_cursor` overloads now return `int` where
    before they returned `bool` because the underlying Notcurses API
    only signalled the operation status with the return value while now
    it returns actual information.
3 years ago
nick black 6b126f4049
add notcurses_canbraille() capability test 3 years ago
nick black b3569b6aef
Initialize Readline on demand
Eliminate NCDIRECT_OPTION_NO_READLINE (it was only introduced in
Notcurses 2.1.6). Add a new function, ncdirect_readline(). Upon
first call to this function, initialize libreadline. Destroy
libreadline in ncdirect_stop() iff we initialized it. Add
hilodirect guessing game PoC from #1325. Rename
notcurses_directmode.3 to notcurses_direct.3. Closes #1326.
3 years ago
nick black 43dd0440f7
add raster timing stats #1324 3 years ago
nick black 2491b693ba
Add missing channel_set_palindex()
Implement channels_set_fg_palindex() and channels_set_bg_palindex()
in terms of channel_set_palindex(). Add missing entries to
notcurses_channels.3 man page. Use uint32_t in place of unsigned
when dealing with channels in notcurses.h.
3 years ago
nick black b112b93901 use byteswap.h on GNU/Hurd #1320 3 years ago
nick black cb58f45dd3 Write blit quadrants to channel
Reclaim the "blitted" and "full foreground" bits in the
channels. Instead, we now write four bits, encoding the
four quadrants we might occupy as the result of a blit.
These four imply the previous two, leaving us with four
free bits remaining in the channels. This opens a clear
path to O(1)-time, zero-space blitter stacking #1068.
w00t!
3 years ago
nick black f37ebba78d Add CELL_BLITTEDMASK to track ncvisual cells
For properly stacking transparent blittings (#1068), we
need tag those cells which both (1) originated in an
ncvisual operation and (2) have some transparency. For
the three affected blitters (halfblock, quadrant, and
sexblitter), call cell_set_blitted().
3 years ago
nick black 6bd288f056 Workable split of library
Rather than trying to force things in via library constructors
and weak symbols and --whole-archive and pkg-config tricks, just
add new functions ncdirect_core_init() and notcurses_core_init().
libnotcurses has ncdirect_init() and notcurses_init(), which pass
through to these. apps linking against notcurses-core ought use
the _core_ variants directly. This gets exactly the linkage we
want, everywhere. Convert many PoCs to _core_ variants. #1301

Signed-off-by: nick black <dankamongmen@gmail.com>
4 years ago
nick black 1108ebb5b6
Fix up some subtle pile issues
ncplane_destroy() needs to call ncplane_reparent_family(), not
ncplane_reparent() as it was doing (closes #1291). ->absy and
->absx actually are absolute; return them directly for an O(1)
ncplane_abs_yx() (down from O(N), huzzah). Add some unit tests
related to destroying and reparenting (#1286). Add ncplane_abs_y()
and ncplane_abs_x(), document them, etc.
4 years ago
nick black 1c0a623b8b
document new function ncplane_abs_yx() #1286 4 years ago
nick black 68b340e3c8
ncdirect: prep readline for use #1120 4 years ago
nick black 15386d57ce
nontrivial stacking unit test #1068 4 years ago
nick black 7e05d0438a
notcurses_init.3: fix up some syntax 4 years ago
nick black 54b44513c4
Wide EGC tweaks
Don't bias the nccell width by 1, or 0-length EGCs become
255 columns. We weren't actually using the width to drive
much anything until now, so this wasn't a problem, but it
is exposed as an error once we got rid of CELL_WIDE_ASIAN
and start looping through the actual egc column width.
Closes #1278, closes #1277
4 years ago
nick black 6d6416064e
ncdirect: set up fatal signal handlers #1271 4 years ago
nick black 998cf02f34
add NCDIRECT_NO_QUIT_SIGHANDLERS #1271 4 years ago
nick black 555a3262b1
add channel_palindex and friends 4 years ago
nick black af07822d35 Document base cell better
Improve the documentation for ncplane_set_base_cell() and
ncplane_set_base(). Go by render.c's authority (all three
channels are independently checked for transparency, and
replaced with the base cell if so--egc, fg, and bg). Add a
BASE CELL section to notcurses_plane.3. Check for, and reject,
an nccell which is secondary among a multicolumn EGC.

Closes #1238.
4 years ago
nick black e522429dfb
direct: reorder declarations to please freebsd 4 years ago
nick black 7e20a25482
ncdirect_*_palindex -> ncdirect_set_*_palindex #1261 4 years ago
nick black f1253560ad
ncdirect: set_ on rgb functions #1261 4 years ago
nick black 76d8e2dfce
ncdirect_{fg, bg}_default() -> ncdirect_set_{fg, bg}_default() #1261 4 years ago
nick black 58bc9bd3bc
fix up writeout stats, report in shutdown banner 4 years ago
nick black 638dde7657
remove unnecessary args from ncdirect_raster_frame() #1248 4 years ago
nick black 1d8fcbb5e4
ncdirect: styles{set, on, off} -> _styles #1247 4 years ago
nick black dd1cdc40d5 add NCSCALE_NONE_HIRES, NCSCALE_SCALE_HIRES #1250 4 years ago
nick black 4d8efcab82
Progress towards NCBLIT_3x2 by default
Add a new member 'sextants' to the terminfo cache (both
notcurses and ncvisual contain one of these, and both
initialize it the same way -- interrogate_terminfo()).
Add a new function, 'notcurses_media_defblitter()', and
deprecate 'ncvisual_default_blitter()' (the latter didn't
receive enough information to return NCBLIT_3x2). Update
all callers. Add new *internal* function rgba_default_blitter(),
so this logic can be freely changed in the future. If
sextants are available, and we're scaling, return NCBLIT_3x2.
Once we detect sextant availability, we'll have sexblitter
as a default -- stay tuned! #1114
4 years ago
nick black 248dd1fff2
add dynamic linesig control #1228 4 years ago
joseLuís 45c01c95af update align doc comments #1234 4 years ago
nick black 0b633fbdad
ncplane_at_yx_cell/at_cursor_cell: return bytes of egc 4 years ago
nick black 5cd3cdaf70
direct: s/ncplane/ncdirectv/g 4 years ago
Nick Black 730e9f69ec
Multithreaded ncls (#1232)
Thread out ncls to perform the media decode in different threads, in parallel. Only the display needs be locked. On a directory of 200 files on my 39070X, this speeds ncls from ~5s to ~1s. On 75 files, we go from ~.5s to ~.2s. On a single file, we lose about 5%. To facilitate this, ncdirect_render_image() has been split into two helpers, ncdirect_render_frame() and ncdirect_raster_frame().
4 years ago
nick black bf3e3eb0b5
ncplane_at_cursor_cell: rewrite with ncplane_at_yx_cell() 4 years ago
nick black 28b1a80433
ncplane_at_yx_cell: work directly with cell_duplicate() #1231 4 years ago
nick black 405b456428
disambiguate comment on ncdirect #1227 4 years ago
Nick Black 1bdd2d0555
Progress bar polishing (#1219)
Progress bars now support four 32-bit channels in ncprogbar_options, and uses them to color a gradient. The redraw procedure has been changed from O(n) to O(1). ASCII progress bars have been repaired. Closes #1213.
4 years ago
nick black 1bbbdd9dc0
annotate many functions with ((nonnull)) 4 years ago
nick black 827d758c19 properly color progbar #1202 4 years ago
nick black d56ea8b5e7 progbar: remove egcs options 4 years ago
nick black 82ffac8eed remove ncprogbar locking options #1202 4 years ago
nick black e37540c76e ncprogbar: implement core draw loop #1202 4 years ago
nick black 1d74979718 progbar core / poc #1202 4 years ago
nick black 6bff720122 initial API + documentation for ncprogbar #1202 4 years ago
nick black 33862979da
scan-build: remove dead stores 4 years ago
nick black fd2acde1b1 rename cell->nccell, keep alias #1200 4 years ago
Nick Black 6106dea18a
track+use width for polycolumn EGCs #1203 (#1205)
Some EGCs are more than 2 columns (wcwidth() never returns more than 2, so far as i can tell, but when multiple characters combine, we use the sum). An example would be ကြေ (Myanmar) which occupies three columns over the course of three characters. Track the width (biased by 1) in cell->width, taking over 8 bits from cell->reserved. Use this width in rasterization. Closes #1203.
4 years ago
nick black edf55d8cc1
notcurses_rasterize: adapt to piles 4 years ago
nick black a3220b8a73
add ncplane_descendant_p(), unit test it #1192 4 years ago
nick black e60a7aa463
add stat for notcurses_refresh() 4 years ago
nick black e6209ff5fc
with apologies to salman rushdie 4 years ago
nick black 14fa544433
add NCPLOT_OPTION_PRINTSAMPLE #1183 4 years ago
José Luis Cruz a69aa1d157 split out the UI ASCII art doc comments; fix #1180 4 years ago
nick black 58b47bf953
unit test for cell_load_egc32() #1176 4 years ago
nick black 0999e0ad3b add gcluster endianness comments 4 years ago
nick black 0645fb3931
run cell_load_char()/egc32() through cell_load() #1176 4 years ago
nick black 6fb5c1e512 Fill out some API holes, improve some comments
- Disambiguate the docs for ncplane_erase()
- Add ncpile_top(), ncpile_bottom()
- Refuse attempts to modify the standard plane's resizecb
- Copy alignment and resizecb in ncplane_dup()
- Add cell_load_egc32()
4 years ago
nick black 186b3a2a5e kill ifdefs via explitict initialization 4 years ago
igo95862 87d1ba17e6 Made CELL_TRIVIAL_INITIALIZER compatable between C and C++ 4 years ago
igo95862 5e60e84fdf Under ISO C the empty initializer is {0} not { } 4 years ago
nick black dcde23e74c apply htole() where needed #1130 4 years ago
nick black 4d524f92bc apply htole() in ncpixel_*() #1130 4 years ago
nick black dd8423dff3 embiggen notcurses_metric(3), add unit test #1107 4 years ago
Marek Habersack c5c9432ac0 [Misc] A hodgepodge of tiny changes
CMake:
  Simplify cmake target+version config generation and make it actually
  work.  With the changes it is now possible to detect and use
  `Notcurses` in the following way:

     find_package(Notcurses REQUIRED)
     ...
     target_link_libraries(myapp PRIVATE notcurses::notcurses)

  Also, added the same CMake configuration for `Notcurses++`, to be used
  in the following way:

     find_package(Notcurses REQUIRED
     find_package(Notcurses++ REQUIRED)
     ...
     target_link_libraries(myapp PRIVATE notcurses++::notcurses++)

Docs:
  `notcurses_cell(3)`: `cell_styles_{on,off} -> cell_{on,off}_styles`
  and `cell_load_simple` -> `cell_load_char`

C++ API:
  * Plane: added constructors taking `ncplane_options const&` instead of
    the multitude of individual parameters
  * Plane: drop `struct` when `ncplane_options` is used.
  * Plane: added `strdup` (`cell_strdup`)
  * Plane: added `extract` (`cell_extract`)
4 years ago
Marek Habersack c063ce4e36 [C++] API sync
Added:

  * Pile: new class derived from Plane, which implements all the
    `ncpile_*` calls
  * Plane: `get_parent` (`ncplane_parent`)
  * Plane: protected constructor for use by `Pile` (or other derived
    classes which cannot provide a valid `ncplane*` when invoking parent
    constructor.
  * Plane: `set_plane` for use by the derived classes above.

Changed:

  * Plane: `to_ncplane` is a `const` method now.
4 years ago
nick black b7ea4e2359
run sgr-full and sgr-direct in test suite #1138 4 years ago
nick black ebc80915a3 c++/rust struck #1138 4 years ago
nick black fe164b6210 add NCSTYLE_STRUCK #1138 4 years ago
nick black fd97aa844c implement ncpile_{render, rasterize}() 🦀🦀 #1135 4 years ago
nick black 8f7fa9da44 move postpaint() out of render step #1135 4 years ago
nick black b2516d8534 Declare ncpile_render() and ncpile_rasterize() #1135 4 years ago
nick black 0485c6f35d
fix tiny memory leak in ncplane_at_cursor_cell() 4 years ago
nick black b6e5b60374 ncpile_create() not NCPLANE_OPTION_NEWPILE #1078 4 years ago
nick black 3ad9a40426 hook up piles #1078 4 years ago
nick black b747af2ae8 drop NCPLANE_OPTION_NEWPILE #1078 4 years ago
nick black ee83b63107 c++: add Plane::reparent_family() #1078 4 years ago
nick black 0da6a8c44b add NCPLANE_OPTION_NEWPILE #1078 4 years ago
Marek Habersack c8eb3875ff [C++] API sync
Added:
 * NotCurses: `stats_alloc` (`notcurses_stats_alloc`)
 * Plane: `set_resizecb` (`ncplane_set_resizecb`)
4 years ago
nick black 65ed8c0d86
undeprecate ncplane_new(); why break running code? 4 years ago
nick black dd1e7f3b7e
document ncplane_reparent() more completely 4 years ago
nick black 8dd8937ff3
notcurses.h: purge tildes 4 years ago
nick black c0cb5c7ff9
add ncplane_resizecb() #1124 4 years ago
nick black 6084105c68
add ncplane_set_resizecb() #1124 4 years ago
nick black eef6df8c0a death to horiz #1115 4 years ago
nick black b8dc9544cf deprecate ncplane_new() 4 years ago
nick black 886835a8b4 c++: deprecate ncplane_new() #1115 4 years ago
nick black 51d01b22c8
who knows how this happened 4 years ago
nick black 259b2b6012
make it clear that sixel is not yet supported 4 years ago
nick black 65a0059b38
plots: fix NCBLIT_3x2 for plotting #1104 4 years ago
nick black 47b62ce822
make some unsigneds explicit uint32_ts 4 years ago
nick black 4b2edf0019
ncplot: add comment regarding d vs u 4 years ago
nick black f3cd1fb755
ncinput_equal_p(): return bool, not int #1059 4 years ago
joseLuís 03d2ffffaf fix typo 4 years ago
nick black 5c8781ffbd
ncvisual: quadblitter by default for stretch, for now 4 years ago
nick black 78e5ac670d
default to NCBLIT_3x2, unify NCBLIT_DEFAULT selection #1088 4 years ago
nick black e12cfe947b
ncpixel_set_g/ncpixel_set_b: correct #1080 4 years ago
nick black 515aa881cc
ncpixel_b/ncpixel_g: fix for RGBA 4 years ago
nick black 210991991f blitters: drop bgr switch-hitting, rely on input swap 4 years ago
nick black 5647864745 update USAGE for new-skool blitter defs 4 years ago
nick black 8d66938a0e sexblitter: purge NCBLIT_1x1x4, add NCBLIT_3x2 #1071 4 years ago
nick black 0c0404ec51
clarify DFSG for notcurses-demo.1 4 years ago
nick black 1609b00b77 C++ decode_loop() #1066 4 years ago
nick black b35c680f48 add LoopVideo unit test #1066 4 years ago
nick black 8919d6fe70 ncvisual_rewind 4 years ago
nick black 19efd2c10a declare ncdirect_printf_aligned() in man page + python #1074 4 years ago
nick black 0b825c619e
add notcurses_stddim_yx_const() 4 years ago
nick black e6bc09084c
notcurses_align: return error on negative column count 4 years ago
nick black f4b051f6ed
add NCKEY_SPACE 4 years ago
nick black e885d87d1a introduce NCKEY_ESC, use it everywhere 4 years ago
nick black 3229fa53b3
add ncinput_equal_p() predicate #1059 4 years ago
nick black 6623fc92a0
ncmenu_item_set_status: man page, NEWS, python, c++ #1057 4 years ago
nick black be2bba7be2 implement ncmenu_item_set_status #1057 4 years ago
nick black a44090a7f7
s/notcurses/Notcurses/g 4 years ago
nick black be0136874f rename Plane::putwc -> Plane::putwch to not conflict with stdlib macro #1046 4 years ago
nick black d101d2d2d9 add ncdirect_init() inhibit cbreak flag #1049 4 years ago
nick black fa92e0ffe8
purge stray #undef #1046 4 years ago
nick black c6c157a5ad
notcurses_stats_alloc() everywhere 4 years ago
nick black 0a3f697bc7
c++ ncplane: braces around initializer 4 years ago
nick black f9e2c7863b
add notcurses_stats_alloc #1043 4 years ago
nick black 270b1b20ee implement notcurses_render_to_buffer() #214 4 years ago
nick black b4f1065f69 declare notcurses_render_to_buffer() #214 4 years ago
nick black 29c7f960cc add writeout_ stats, document stats #1039 4 years ago
Marek Habersack a29bfe9c42 [C++] Deal with widgets grabbing full ownership of Panel
Fixes: https://github.com/dankamongmen/notcurses/issues/1009

Whenever a widget is created with its `*_create` function it currently
claims full ownership of the passed panel, including its destruction.
However, the C++ wrapper around the panel is not aware of this and will
attempt to destroy the native panel in the destructor, leading to
segfaults.

Fix this by introduction of a `Widget` class which contains the logic to
properly modify the `Panel` instance to not double-destroy the native
panel.  The solution is a bit fragile since the `Panel` instance is left
intact (we can't free it for the user) in a state that's safe for the
C++ wrapper, but calling any C function via the wrapper **will** pass a
`NULL` pointer in the panel argument - therefore the C functions MUST be
proofed against this.  The proofing belongs in the C backend code since
this protects also C and other language binding users from such abuse.

The Widget class will first verify that the passed `Plane` instance
hasn't already been "disowned" and will throw an exception to the effect
if it was.  Next, it will proceed to take over ownership of the native
panel instance and mark the passed `Panel` as "invalid" (i.e. not owning
any native panel instance anymore)

The above changes require modification of `Panel` instances and so all
the widget constructors taking `const*` or `const&` have been removed
from widget classes.
4 years ago
nick black 683217ef07 normalize style setters #1034 4 years ago
nick black 174a00b56c
add deprecated nctablet_ncplane() for old binaries 4 years ago
nick black 6ddf105746
uninline ncplane_new() so older binaries continue to link 4 years ago
nick black c236b65266 name standard plane 'std' 4 years ago
nick black a591e11c96 retain nctablet_ncplane() as deprecated alias 4 years ago
nick black afd444cea3
kill stray decl ncdirect_getc_nonblocking() #1028 4 years ago
nick black 20bf1ae2d4
nctablet_ncplane() -> nctablet_plane() 4 years ago
nick black ec85dd1c3b
ncreel_destroy: return void 4 years ago
Marek Habersack 943e23535f [C++] API sync
Fixes: https://github.com/dankamongmen/notcurses/issues/1025

Added:
  * Direct: flush (`ncdirect_flush`)
  * Direct: getc (`ncdirect_getc_blocking` and `ncdirect_getc_nblock`)
  * Direct: getc (`ncdirect_getc`)
  * Direct: get_inputready_fd (`ncdirect_inputready_fd`)
  * NotCurses: align (`notcurses_align`)
  * NotCurses: ucs32_to_utf8 (`notcurses_ucs32_to_utf8`)
  * NotCurses: get_bottom (`notcurses_bottom`)
  * Plane: resize_realign (`ncplane_resize_realign`)
  * Plane: get_x (`ncplane_x`)
  * Plane: get_y (`ncplane_y`)
  * Plane: mergedown (`ncplane_mergedown`)
  * Plane: putwc_stained (`ncplane_putwc_stained`)
  * Plane: putstr_stained (`ncplane_putstr_stained`)
  * Plane: set_fchannel (`ncplane_set_fchannel`)
  * Plane: set_bchannel (`ncplane_set_bchannel`)
  * Plane: get_styles (`ncplane_styles`)
  * Plane: get_above (`ncplane_above`)
  * Reader: move_left (`ncreader_move_left`)
  * Reader: move_right (`ncreader_move_right`)
  * Reader: move_up (`ncreader_move_up`)
  * Reader: move_down (`ncreader_move_down`)
  * Reader: write_egc (`ncreader_write_egc`)
  * Visual: get_default_blitter (`ncvisual_default_blitter`)

Fixed:
  * NotCurses: `cursor_{enable,disable}` must use `NOEXCEPT_MAYBE`
  * Plane: renamed `putcw` to `putwc`
4 years ago
nick black 2f26f06386
alignment: add NCALIGN_UNALIGNED, preserve align type #364 4 years ago
nick black 2d9598b913
introduce ncplane_resize_realign #364 4 years ago
nick black 7b51bab79a add resizecb to ncplane_options struct #869 4 years ago
nick black 73f9973a2c Plane.hh: fix up indentation #1020 4 years ago
nick black 36aed3c521 add ncplane_create() + ncplane_options #1020 4 years ago
nick black 607c03edc4
rename _rgb_clipped functions rgb8_clipped 4 years ago
nick black a4367fcfb5 rip out ncplane_ creation functions #985 4 years ago
nick black e42dbdfd60 _stainable() -> _stained() #985 4 years ago
nick black c5c608b22e add ncplane_putwc_stainable, ncplane_putwstr_stainable #985 4 years ago
nick black b7a57eaab7 convert all channel rgb calls #985 4 years ago
nick black 0e34bec3fb start converting rgb->rgb8 #985 4 years ago
nick black 4bb1f3fc85 mbswidth -> ncstrwidth() #985 4 years ago
nick black dab7247cdd
mbswidth: use utf8_egc_len() for segmentation #1014 4 years ago
nick black dca9db9687
ncreel: conform to the New Way #627 4 years ago
nick black c3e5e47a2a
ncreader: conform to the New Way #627 4 years ago
nick black 4f04f1bc31 remove bgchannels field from selector_options #627 4 years ago
nick black 306948507f ncmultiselect: normalize per new widget API #627 #1006 4 years ago
nick black 8839d44454 selector: transfer ownership of ncplane #1006 #627 4 years ago
nick black a801f975a6
all widget creators get attribute ((nonnull)) #627 4 years ago
nick black 3f726edd4c
all widgets check flags and warn on undefined #627 4 years ago
nick black 89a4b6f726
all widget options structs end in flagword #627 4 years ago
nick black af05ae7a92 man pages: document NCREADER_OPTION_CURSOR 4 years ago
nick black f88c8ae79c
expose ncvisual_default_blitter(), name blitter in notcurses-view #995 4 years ago
nick black 3afcfc97d6
ncreader: define NCREADER_OPTIONS_EMACSKEYS 4 years ago
nick black 2f28420034 rename ncplane_putsimple() -> ncplane_putchar() #912 4 years ago
nick black 4c7a1d0427 ncdirect_init: add flags parameter #976 4 years ago
nick black 5fc6705ce3
add notcurses_ucs32_to_utf8() 4 years ago
nick black 5901fce433 unite putegc_yx+putc_yx into ncplane_put #961 4 years ago
nick black 0cee9bdb5c ReelsGap unit test #901 4 years ago
nick black 66f80c77f9
add ncplane_y() and ncplane_x() 4 years ago
Nick Black d4ad59f285 FreeBSD compilation fixes 4 years ago
nick black 9f84c1524e
cell_load_simple: need an ntole() #906 4 years ago
nick black c24ca8ab56
introduce ntole() #906 4 years ago
nick black c66d8f52d5
Endianness fixes for inlined egcs #906 4 years ago
nick black 8f65211bf8 declare ncdirect input layer #919 4 years ago
nick black 9d75f575db
ncplane_set_[fb]channels 4 years ago
nick black 70a28feb63
ncreader: horizontal scrolling mostly works #839 4 years ago
nick black 7cbb2e9110 zoo demo: show cursor in reader box #835 4 years ago
nick black a53d5a21a8 disable/enable cursor for rasterize 4 years ago
nick black cab19cf790 Cursor work (placement, drop RETAIN_CURSOR) #953
notcurses_enable_cursor() now accepts placement arguments.
both it and notcurses_disable_cursor() now return int rather
than void. add notcurses_cursor_move_yx().
4 years ago
nick black df33f381e5 c++ wrappers: cursor_{en,dis}able, iprefix() #952 4 years ago
nick black 4dd1d6a4c8 Annihilate nc_err_e and all infrastructure #948 4 years ago
nick black 026b94969d cffi heap allocations are zero-initialized #942 4 years ago
Nick Black 73dc0a7d69
Zoo 2, electric boogaloo (#939)
* Reimplement the widget zoo demo. The previous PoC
  was a multithreaded monster with behavior dependent
  on screen geometry. Replace it with a single thread state
  machine. Closes #936.
* Support titles for ncplot. Adds title to the ncplot_options
  struct, which may be NULL. Closes #941 .
* Properly color ncplot according to maxchannels and
  minchannels. Closes #940
* Add tools/function-table.sh script for generating public API list.
4 years ago
nick black 32d352173b
ncdirect_flush: struct ncdirect is const 4 years ago
nick black 14d6129007 take-no-prisoners overhaul of ncplane_puttext() #829 4 years ago
nick black 5c533c9f1a
ncplot: support legend styling 4 years ago
nick black 6bb8f447b5
add ncdirect_flush() #926 4 years ago
Nick Black 359ad1d36d
Generalized mergedown #779 (#932)
* Rename ncplane_mergedown -> ncplane_mergedown_simple()
* New ncplane_mergedown(), fully general projection of src to dst
4 years ago
nick black 567ad27455
add comment to ncdirect_putstr() about flushing #926 4 years ago
nick black 706d492ecd add channels_set_*_palindex() 4 years ago
nick black 2e5a8b78d5
add trivial new iprefix() 4 years ago
Nick Black e1cf346ddb
internalize highgradient_sized implementation #920 (#922)
internalize highgradient_sized implementation #920
4 years ago
nick black 1e334fa63e
new 'gradients' PoC #920 4 years ago
nick black 05da44b06b
hide blending functions #917 4 years ago
José Luis Cruz 3e3c8c1514
minor fix: use already defined variable 4 years ago
José Luis Cruz c4498e485e
proposal to remove the comment and update the type
Maybe the type may reflect that it's not supposed to be a long now.

Although for what I've learnt about C, in practice it will probably still be a long. And I can't be sure whether in some platforms where it will indeed be a short the code will keep compiling, so maybe it's safer just to remove the outdated comment, or whatever you decide.

I'm just finding things while I work in the bindings =) And I was surprised to learn about the little guarantees C gives regarding the types sizes...
4 years ago
nick black a2c95814b7 Remove cell_simple_p()
Get notcurses-tetris working again, since its collision
detection relied on simple vs non-simple EGCs, which are
no longer an operative concept. Closes #899.
4 years ago
nick black 18d79c195d
python: get us linking once more... 4 years ago
nick black f9eed1c412 palette_size is unsigned #891 4 years ago
nick black 16ff667325 blissful endianness-opacity
not caring about endianness is the opiate of the masses.
happy, happy masses. remove endianness.h and all its baleful
influence by explicitly breaking up the cell structure. #892
4 years ago
nick black 7811663223 inlined EGCs + styling unit tests #830 4 years ago
nick black 3b76db1166 fuck the bullshit it's time to throw down 4 years ago
nick black 40e85c4143 rotate: use cell_extended_gcluster() #830 4 years ago
nick black 3f142961b3 comments 4 years ago
nick black 226c00c74d egcelide: detect endianness, define NCSTYLE_* accordingly 4 years ago
nick black fb8efe03e0 cell_strdup(): fix for inline egcs 4 years ago
nick black b0f7f36995 egc inlining #830 4 years ago
nick black 26899f3544
s/8 bit/8-bit/g 4 years ago
José Luis Cruz e596f9230f fix ncpixel alpha mask 4 years ago
nick black 52103af364
Cell: overlap RGB and palette indices #884 4 years ago
Nick Black c3508d524b
ncplane_puttext() work for longer lines (#880)
* The zoo demo made manifest that we had some serious problems handling sequences of longer lines in ncplane_puttext(). This remedies most of the problems, though it's not yet perfect. #871
* Guard notcurses* for NULL in log*() #878 #879
* Fix memory leak in ncdirect_dump_plane()
4 years ago
Nick Black e7ad2829e9
Merge branch 'master' into joseluis-patch-1 4 years ago
joseLuís 7070e532d6 fix typos 4 years ago
joseLuís 7abda11404 add comments for ncpixel functions 4 years ago
José Luis Cruz 7bd29c9c17
fix return types
I bet those two return types shoud be unsigned
4 years ago
joseLuís 7790913d2f fix typos & improve comments 4 years ago
Nick Black 11d6a4eb89
New reel layout algorithm #818 (#870)
New reel layout algorithm based on trimming and sifting. Fixes the original issue of #818, though I'm not marking that bug fixed until I've resolved the little issues remaining with this one.
Back off CMake version dependency, see if we can get by with 3.11.4 for EPEL8 #851
Simplify tablet drawing tremendously by separating tablet border and data planes. Callbacks no longer need worry about the borders; they can simply fill the plane they're handed. #833
Improve notcurses_debug() a bit
Add ncplane_new_named() and friends to expose plane naming to the user.
Add internal ncplane_genocide() to kill a plane and all its bound descendents
New industrial-strength ncreel unit testing
notcurses-ncreel now accepts -ln for log level n
Add ncplane_parent() and ncplane_parent_const()
4 years ago
joseLuís 2842ffb751 add remaining channel functions 4 years ago
nick black 3bb95824fc update some terminology 4 years ago
nick black 9ae3fe4728 update some terminology 4 years ago
nick black 4c822f80a9
comment and move ncpixel API 4 years ago
José Luis Cruz 7aef3e4fca fix typo
foreground > background
4 years ago
nick black c618096083
ncselector_redraw(): don't call notcurses_render() #627 4 years ago
nick black ead60d06cc
unexport cell_egc_idx() 4 years ago
Marek Habersack 2fabe85e6a [C++] API sync
Been a while, apologies :)

Added:
  * Direct: fg_palindex (`ncdirect_fg_palindex`)
  * Direct: bg_palindex (`ncdirect_bg_palindex`)
  * Direct: get_palette_size (`ncdirect_palette_size`)
  * Direct: putstr (`ncdirect_putstr`)
  * Direct: hline_interp (`ncdirect_hline_interp`)
  * Direct: vline_interp (`ncdirect_vline_interp`)
  * Direct: box (`ncdirect_box`)
  * Direct: rounded_box (`ncdirect_rounded_box`)
  * Direct: double_box (`ncdirect_double_box`)
  * Direct: canopen_images (`ncdirect_canopen_images`)
  * Direct: canutf8 (`ncdirect_canutf8`)
  * Menu: get_mouse_selected (`ncmenu_mouse_selected`)
  * NotCurses: version_components (`notcurses_version_components`)
  * NotCurses: str_blitter (`notcurses_str_blitter`)
  * NotCurses: str_scalemode (`notcurses_str_scalemode`)
  * NotCurses: lex_margins (`notcurses_lex_margins`)
  * NotCurses: lex_blitter (`notcurses_lex_blitter`)
  * NotCurses: lex_scalemode (`notcurses_lex_scalemode`)
  * NotCurses: render_to_file (`notcurses_render_to_file`)
  * Plane: putstr_stainable (`ncplane_putstr_stainable`)
  * Plane: printf_stainable (`ncplane_printf_stainable`)
  * Plane: vprintf_stainable (`ncplane_vprintf_stainable`)
  * Reel: offer_input (`ncreel_offer_input`)

Changed:
  * Direct: set_fg_alpha uses `unsigned alpha`
  * Direct: set_bg_alpha uses `unsigned alpha`
  * Plane: set_fg_alpha uses `unsigned alpha`
  * Plane: set_bg_alpha uses `unsigned alpha`
  * Root: made `error_guard` and `error_guard_cond` static
4 years ago
nick black 835a62361d
cell_nobackground_p(): load time, 5% perf win =] =] =] #838 4 years ago
nick black 2dcab374c4 mojibake: fix some row overruns #842 4 years ago
nick black 78a7b4d255 constify ncreader_options->egc 4 years ago
nick black b8e6458de1
Revert "start working through notcurses.h with inlined utf8 #830"
This reverts commit 17b6706d3e. It
belonged on a branch, and was not intended for master. #830
4 years ago
nick black 17b6706d3e
start working through notcurses.h with inlined utf8 #830 4 years ago
nick black 7174a84e94 zoo: add multiselector 4 years ago
nick black bac02bccd0
selector/multiselect: kill itemcount options field #831 4 years ago
nick black 17e8f62eb9
cell_no{fore/back}ground() was never intended for export 4 years ago
nick black 6ea968c522 declare ncmenu_mouse_selected() #819 4 years ago
nick black 97571e86af ncplane_putegc_yx() copies directly as opposed to going through putc() #797 4 years ago
nick black 104bbfef50
add notcurses_lex_blitter() 4 years ago
nick black 765ff89a3b
notcurses_str_blitter(): rewrite using objects 4 years ago
nick black 37ceb753bf
notcurses-view: print blitter name #805 4 years ago
Nick Black dbc83c41b3
linuxconsole PoC (#791)
* use ioctl(KDGETMODE) to detect Linux console
* diagnostic on KDGETMODE
* add logdebug()
* unit test for notcurses_drop_planes(), add ncplane_putnstr_aligned()
* linuxconsole PoC
* linuxconsole: dump unicode->font table
* linuxconsole: explode glyphs
* linuxconsole: show 7 glyphs per 'line'
* linuxconjammer: shim console font with half blocks
* signals: handler for SIGTERM
* man pages: update notcurses_init() for options
* add NCOPTION_NO_FONT_CHANGES #201
4 years ago
nick black 5cf912feb6
ncplane_printf_stainable() and _vfprintf_stainable() #754 4 years ago
nick black 4a97c139e6
add ncplane_putstr_stainable() #754 4 years ago
nick black a6b002fa77 add ncdirect box-drawing functions #753 4 years ago
nick black 96c6dc8e16 add ncdirect_canopen_images() and ncdirect_canutf8() #753 4 years ago
nick black c783244185 ncdirect_hline_interp(), ncdirect_vline_interp(), dirlines PoC #753 4 years ago
nick black 750f88b70a split direct into its own header 4 years ago
nick black 3ef1a3a07d
add notcurses_version_components() 4 years ago
Nick Black 162f9910c2
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627

* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
4 years ago
nick black 479dd00739
ncreel: purge {tblr}off fields; these are ncplane properties #627 4 years ago
nick black b6330d142b
add notcurses_render_file() #491 4 years ago
nick black b829398538 ncdirect_render_image: accept ncalign_e parameter #759 4 years ago
nick black 4863c7e3df
ncdirect_image_render: restore NCBLIT_2x2 #751 4 years ago
nick black 229079696d ncvisual refactoring to support ncdirect 4 years ago
nick black 354152b48b
Redefine CELL_ALPHA_ in their natural forms
CELL_ALPHA_OPAQUE et al were defined as 0..3, meaning
CELL_ALPHA_SHIFT had to be used to compare them to their
channel representations. Instead, define them in said
representation outright, eliminating the need to shift while
retaining arithmetic properties, and zero initialization for
CELL_ALPHA_OPAQUE. Eliminate CELL_ALPHA_SHIFT #738.
4 years ago
Marek Habersack 63b64ff624 [C++] API sync
Added:
  * Direct: render_image (`ncdirect_render_image`)
  * NotCurses: can_truecolor (`notcurses_cantruecolor`)
  * Plane: home (`ncplane_home`)
  * Plane: perimeter_rounded (`ncplane_perimeter_rounded`)
  * Plane: perimeter_double (`ncplane_perimeter_double`)
  * Plane: is_fg_default (`ncplane_fg_default_p`)
  * Plane: is_bg_default (`ncplane_bg_default_p`)
  * Plot: sample (`nc{d,u}plot_sample`)
  * Visual: geom (`ncvisual_geom`)

Fixed:
  * Plot: {set,add}_sample - `x` coord is always `uint64_t`
4 years ago
nick black 4a3d436e5b
drone: update builders 4 years ago
nick black 79d3ae67e4
add notcurses_cantruecolor() 4 years ago
nick black 355021de56
ncneofetch: print ram/processes #550 4 years ago
nick black d084513172
ncvisual_geom: account for scaling #726 4 years ago
nick black 7ca5a7e82c
ncneofetch: create info plane #550 4 years ago
Nick Black 0084dbaa6d
qrcode generalization #699 (#713)
Add convenience function ncplane_home(). Add an ncblitter_e param
to ncplane_qrcode(), and split int maxversion into value-result
int* ymax and int* xmax. Write the actual sizes of the resulting
visual into these parameters. Update the qrcode demo. Add the
qrcode PoC. Update demos to ncplane_home(), where possible.

ncplane_qrcode() now takes an ncblitter_e and two value-result int*s
in the place of a single value int. The final size of the displayed qrcode
is written to *ymax and *xmax. If the code can't fit within the specified
dimensions, an error is returned. Standard rules for pluggable blitters
apply regarding fallback etc. #699
4 years ago
nick black 70183ee283
Rewrite plot tests using C interface #703
The Plot unit tests were reaching directly into the objects,
which meant the implementations couldn't include anything
we didn't want public. This was annoying, so I've changed it.
This required adding ncdplot_sample() and ncuplot_sample(),
which we should have had anyway.
4 years ago
nick black 185742fd08
Rendering now does tripartite fallback to basecell
Each plane has a "base cell", which like all other cells is
initialized to the null glyph, opaque default foreground color,
and opaque default background color. Prior to this change, at
each cell of a plane, we decided whether to use that cell (the
"viscell") or the base cell depending on whether the viscell had
a non-null glyph. We now evaluate each component independently.
If the viscell has a null glyph, we use the base cell's glyph.
If the viscell has a default foreground, we use the base's fg.
If the viscell has a default background, we use the base's bg.
This was done because (a) it seems more intuitive (if I set a cell
to red, I expect red, not red iff there's a glyph in that cell
for this plane), and (b) because otherwise it was impossible to
do a multicolor overlay without blowing away underlying glyphs
(since without a glyph, you always reduced to the same base cell,
which could have only one fore- and background per render).

Existing code will need to change any instances where cells
lacking glyphs are colored, and those colors are not desired.
Since any such coloring had no effect before, it seems unlikely
that any ought exist (this did bring to light an instance in
the "qrcode" demo where we were staining overmuch of the plane).

This closes #395, the last big open worry regarding our API.
4 years ago
nick black f98acad7f6
add NCPLOT_OPTIONS_DETECTMAXONLY #610 4 years ago
nick black a10ba4dac6
highgradient: degrade to gradient #700 #696 4 years ago
nick black af46077775
ncvisual_geom: take degradation into account #697
In order to properly determine the scaling of an ncvisual to
be rendered, ncvisual_geom() needs know the blitting method.
For this reason, it took an ncblitter_e argument. It also,
however, needs handle degradation, which means knowing whether
NCVISUAL_OPTIONS_NODEGRADE is in use. It thus really wants the
struct ncvisual_options. Pass and accept it. Closes #697, and
fixes the "yield" demo in ASCII mode (#696).
4 years ago
Nick Black 28431914a8
First go at ncplane_puttext() (#690)
Very simple take at ncplane_puttext(), a new function for linebroken text. Also some very basic unit tests. I doubt this works very well yet, but it handles the simplest cases #682. Added nclog(), internal function for logging. #520
4 years ago
Marek Habersack 4d2e4e82d3 [C++] API sync
Changed:

 * Visual: tiny reformatting to fit the overall ncpp style
 * Visual: added error guard in `render`
 * Visual: error_guard update in `rotate`

Added:

 * Visual: simple_streamer (`ncvisual_simple_streamer`)
 * Visual: polyfill (`ncvisual_polyfill_yx`)
 * Visual: at (`ncvisual_at_yx`)
 * Visual: set (`ncvisual_set_yx`)
4 years ago
nick black b2dcc50606
notcurses_options: fold bools into flags 4 years ago
nick black 465f4694b8
rename pixel -> ncpixel 4 years ago
nick black d863220e23
add pixels PoC 4 years ago
nick black fb13b148e9
add Pixel API 4 years ago
nick black 2c417ddb0c
yield demo: punch up with polyfills 4 years ago
nick black 633ef1f76c
add beginnings of yield demo 4 years ago
nick black b172d2b97e
NCVISUAL_OPTION_MAYDEGRADE -> NCVISUAL_OPTION_NODEGRADE, doc 'em 4 years ago
nick black 9a0f0c66fe
ncblit: accept an ncvisual_options #680 4 years ago
nick black b72a386aa3
ncplane_dup(): adjust for marginalia #679 4 years ago
nick black e1d34c4f43
ncplane_highgradient: only pass a single channel #676 4 years ago
Nick Black de23139111
Open some whoopass on ncvisual rotation (#677)
Whip the ol' llama's ass (fix ncvisual rotation)

* notcurses: flush cursor change requests #673
* rotator: verify ncplane_rgba and ncblit_rgba
* ncblit: rename, accept ncblitter_e #674
* rotator: render from rgba
* rotator: get to rotation
* rotator: add a pi/4 turn at the end
* normal: reuse incoming plane for rendering #672
* rotator poc: rotate a fullplane gradient #672
* normal demo: place visual correctly
* rotator: verify ncplane_rgba and ncblit_rgba
* ncblit: rename, accept ncblitter_e #674
* rotator: render from rgba
* rotator: add a pi/4 turn at the end
* normal: reuse incoming plane for rendering #672
* rotator poc: rotate a fullplane gradient #672
* normal demo: place visual correctly
* rotator poc: throw some red into gradient
* rotator poc: done #662
* oiio: ncvisual_resize() needs set ibuf pointer #662
* normal: only need erase at top of loop
* visual poc: shorter delay
* normal demo: center rendered visual
* comment ncvisual_resize() call
* ncvisual_rotate: call ncvisual_details_seed()
* ffmpeg ncvisual: fix rotation #662
4 years ago
nick black a8beaf8e56
notcurses-view: switch between blitters with 0--8 #671 4 years ago
nick black 2b31d6ce4d
ncvisual/ncreel: update some documentation 4 years ago
nick black d41c6d3627
notcurses-ncreel: add </>/* operators 4 years ago
nick black efa51e9cf2 quadrant blitter #648
Novel blitter using Unicode quadrant glyphs. 2:1 cell aspect ratio, but
double the horizonal resolution of the half block blitter.
4 years ago
nick black 23001ab792
geomdata -> notcurses_blitters if it must be public 4 years ago
nick black 2d3fef115e ncfadectx_setup(): remove timespec param #659 4 years ago
nick black 3deeecdf2e fade: finish out proposed API, basic unit tests #659 4 years ago
nick black 74e8e9c3d9 fade: move more reproduced code into common area #659 4 years ago
nick black 3ff083b73f Fade API: move control of delays into callback 4 years ago
nick black 8793fcd876 c++ Visual: add from_plane constructor, test #654 4 years ago
nick black 6a9bbad91e
Visual C++ constructor test #538 4 years ago
nick black 0331ae4c4c
introduce NCVISUAL_OPTION_BLEND #652 4 years ago
nick black f47bde1c4e
Graceful fallback among blitters #637
If we're in ASCII mode, no blitter except for NCBLIT_1x1 is going to
work. Whenever NCBLIT_DEFAULT is provided, select NCBLIT_1x1 if we're
in ASCII mode. Add NCVISUAL_OPTIONS_MAYDEGRADE and
NCPLOT_OPTIONS_MAYDEGRADE. Both serve to allow smooth degradation when a
blitter other than NCBLIT_DEFAULT has been provided. Closes #637.

Make calc_gradient_cell() static inline so our templated ncppplot
implementation can use it (ugh). When using NCBLIT_1x1 for plots in
ASCII mode, use space rather than full block, and invert colors.

Use NCBLIT_DEFAULT in the demo for the FPS plot.
4 years ago
Nick Black ebcba82d4b
Fully general ncvisual layer (#647)
This represents an essentially complete rewrite of ncvisual and associated code. It had two major goals:

Improve the ncvisual API based off lessons learned, pursuant to the upcoming API freeze. In particular, I wanted to:

decouple ncvisuals from ncplanes. It should be possible to render a ncvisual to multiple planes, with different scaling each time. It should be possible to create an ncvisual without a plane, etc.
normalize the various ways of constructing an ncvisual -- file, memory, plane, etc.
Support multiple blitters, from 7-bit ASCII to Sixel. This required writing the blitters in several cases, and they're not yet in their final implementations (but the API is fine)
I have not yet unified Plots and Visuals, and might not, given that the Plot code works fine. We could at this point implement Plots in terms of Visuals, though -- the blitter backend range has been unified. Sixel is not yet implemented, though it is listed.

There is a new POC tool, blitter. It renders its arguments using all possible blitter+scaling combinations. Another new POC, resize, displays its argument, then resizes it to the screen size and displays that, explicitly making use of ncvisual_resize() rather than a scaling parameter to ncvisual_render().

This also eliminates some memory leaks and bugs we were seeing in trunk, and brings in Sixel scaffolding.

The C++ wrapper will also need patching back up; I cut most of it down while wrestling with this crap, urk.

Closes #638, #562, and #622.
4 years ago
Marek Habersack b5d8549bb3 [C++] Allow multiple instances of `NotCurses`
This is to make it possible, in the future, to create multiple instances
of `NotCurses` for multiple terminals.  The first instance of
`NotCurses` becomes the default one, so that any instances of other
classes that aren't explicitly created with a pointer to another
`NotCurses` instance still work as expected.

Note that currently trying to call `notcurses_init` twice results in the
following error for me:

    0x55555559bfc0 is already registered for signals
    Couldn't drop signals: 0x55555559bfc0 != 0x5555555b6720
    terminate called after throwing an instance of 'ncpp::init_error*'

    Program received signal SIGABRT, Aborted.

The error is signalled by `setup_signals` and the pointer shown in the
message points to the first `struct notcurses` instance created.
4 years ago
nick black dbc20bd5c0
add man page for ncmetric(3) #631 4 years ago
Marek Habersack e0462ed53a
[C++] Sync API changes (#633)
Added:

  * NotCurses: can_utf8 (`notcurses_canutf8`)
  * NotCurses: debug (`notcurses_debug`)
  * Plane: center_abs (`ncplane_center_abs`)
  * Plane: set_channels (`ncplane_set_channels`)
  * Plane: set_attr (`ncplane_set_attr`)
  * Reader: clear (`ncreader_clear`)

Changed:

  * USAGE.md: clarfied when C++ throws exceptions
4 years ago
nick black 8971bda0c2 ncpp: stop() resets _instance, add unit test #538 4 years ago
Marek Habersack 9ca8d9c9c6 Correctly cast `ncpp::Plane` to `ncplane*`
Fixes: https://github.com/dankamongmen/notcurses/issues/616

SIGSEGV was caused by an invalid cast.

Short explanation: PEBKAC

Long explanation: `Selector.hh`, `Plot.hh` and `MultiSelector.hh` did
not include `Plane.hh`, they merely declared `class Plane;` because
inclusion of `Plane.hh` would cause circular dependencies to appear and
the compiler would be unhappy.  On top of that, yours truly wrenched the
compiler's hands and caused it to believe that a pointer to `Plane` is
really a pointer to `ncplane*` which was quite a silly thing to do as
the compiler, not having included `Plane.hh` and thus not knowing full
definition of the type, wasn't able to look up the type cast operator in
`Plane`.

Don't abuse `reinterpret_cast`, kids!
4 years ago
nick black 24dae2cf15
ncmetric: tighten up PREFIXFWIDTH macros 4 years ago
nick black cce9384ab8
ncmetric: adapt PREFIXFMT to multibyte #630 4 years ago
nick black 2b5546fc4c
plot: make 8x1 the default glyph geometry 4 years ago
nick black 7215bf92ad
throw somed attributes on a few functions 4 years ago
nick black 37a4114f42
O(1) z-axis moves #623
Replace the singly-linked z-axis with a doubly-linked list,
and reimplement all z-axis moves as O(1) functions.
Eliminate ncplane_move_{above/below}_unsafe(), as there are no
longer unsafe moves.
4 years ago
nick black 0d696be0cc
ncpp: normalize Notcurses capitalization 4 years ago
nick black 99bd3fd597
recenter post-rotation in normal demo #617 4 years ago
nick black e80ac4ddb9
normal demo: work with odd number of columns :/ 4 years ago
nick black eb72a4612d
qprefix/bprefix: use uintmax_t for decimal 4 years ago
nick black 168ec1e71d
Update USAGE for streaming API changes #604 4 years ago
nick black 289b018612 view-demo: cleanup, opaque 4 years ago
nick black 78e30831dd move timespec 4 years ago
nick black 1c2f92b3bc
ncmetric: replace u with µ, define *COLUMNS #540 4 years ago
nick black 9a80750316
notcurses_canopen: split into images/videos #598 4 years ago
nick black 0f5333f103
subtle ncplane bugfixes
ncplane_dup(): properly set target plane attributes/channels
ncplane_move_below_unsafe(): speedup, at most one traversal
ncplane_rgba(): accept null glyph
ncvisual_from_plane(): dup the plane, own it in ncvisual
normal: spin the visual
4 years ago
nick black 7dae248a41 box demo: work in ASCII encoding #325 4 years ago
nick black 25baa10f72 special-case double/rounded boxes in ASCII #325 4 years ago
nick black 9f16034d02 add notcurses_debug() #594 4 years ago
nick black a440382fb5 demo: use NCPLOT_OPTIONS_EXPOENTIALD #470 4 years ago
nick black fbed12cd80
ncreel_options: add flag field #590 4 years ago
nick black 66bafd59b3
subproc, fdplane, plot, selector, mselector: flag words #590 4 years ago
nick black eaaa36f0c8
ncreader: ncplane as first arg #590 4 years ago
nick black 9446840b97
ncmenu: move to flag field #590 4 years ago
nick black fec423264f
selector: undo switch to notcurses from ncplane 4 years ago
nick black d89d8c52e9
notcurses_options: add flags field 4 years ago
nick black 95ba340fba
ncplane_erase: fix bug in basecell preservation 4 years ago
nick black d2c968b948
notcurses_init(): interpret NULL as /dev/tty #571 4 years ago
nick black 5b0d773fb5 modernize some PoC c++ according to clang-tidy 4 years ago
nick black a859a3d652 notcurses_multiselector(3): fix up _selected 4 years ago
nick black 989ca7ff9a selector->ncselector, multiselector -> ncmultiselector #580 4 years ago
nick black 26db8a66b7 ncplane_set_attr()/ncplane_set_channels() 4 years ago
nick black f0357ef6cb ncplane_contents(): declarations #582 4 years ago
nick black 48de25821c ncreader man page #403 4 years ago
nick black 312e42add2 ncreader: C++ wrapper 4 years ago
nick black d174431187 ncreader_create: accept const options #403 4 years ago
nick black 7683973ee4 ncreader_options, bad options tests #403 4 years ago
nick black 4819c0e1c3 selector/multiselect: accept notcurses 4 years ago
nick black 064da8acb9 ncreader_destroy() / ncreader_plane() 4 years ago
nick black 5e1d8ccf75 ncreader introduced 4 years ago
nick black 7337280e17
ncplane_at_yx(): const ncplane argument 4 years ago
nick black 5bdfc0183f
ncvisual_from_plane() #559 4 years ago
nick black 94fcada67c
ncvisual_rotate: unify _cw/_ccw, take radians 4 years ago
nick black f63325db60 Lots of ncvisual work
Unify ffmpeg/oiio/null implementations, where possible. This effectively
required placing all three in the same file, which meant they're all now
C++. Update FFmpeg implemenation to be C++-usable. Implement
ncvisual_rotate_cw() and ncvisual_rotate_ccw() #515. Move most of tetris
over to Visual from Plane #558. Add bgra_to_rgba(), necessary for
creating ncvisual from BGRA memory. Implement ncvisual_from_rgba()
and ncvisual_from_bgra() #557. Add unit tests on ncvisual rotation.
4 years ago
nick black 39548acc3a rename ncvisual_open_plane->ncvisual_from_file() #560 4 years ago
nick black 0135a6b54d rotation: ncvisual, not ncplane #515 4 years ago
Marek Habersack e23d5baea4 [C++] Sync API changes
Added:

  * class FDPlane (`ncfdplane*`)
  * class Subproc (`ncsubproc*`)
  * NotCurses: get_inputready_fd (`notcurses_inputready_fd`)
  * Plane: qrcode (`ncplane_qrcode`)
  * class PlotBase: templated base class for Plot variations
  * class PlotU: `uint64_t` instantiation of PlotBase (aliased to previous
    `Plot` class for source compatibility), `ncuplot*`
  * class PlotD: `double` instantiation of PlotBase, `ncdplot*`
4 years ago
nick black c0b2a64102
implement+doc notcurses_inputready_fd() #513 4 years ago
nick black c8322e6cb1
ncfdplane: on non-following planes, break out on 0 read 4 years ago
nick black b34fa9be41
python: proper ncfdplane/ncsubproc decls 4 years ago
nick black 84107c547d
view: support -m argument for margins #551 4 years ago
nick black 0b4ada19b1 Remove AVFrame from API #532 4 years ago
nick black 21822f98e7 fix up averr->ncerr #532 4 years ago
nick black 6ffbef3d74 cmake: openimageio discovery #453 4 years ago
nick black ad0685aa1b switch to nc_err_e #532 4 years ago
Nick Black 0e73b9d3d5
Floating-point ncplot, genericize ncplot (#531)
* compile ncplot as c++ generic #446
* add floating-point plots #446
4 years ago
Nick Black fe8034b5e0
ncfdplane, fileroller PoC, ncfdplane unit tests, qrcodes #24 #514 (#524)
* first draft of ncsubproc spec
* qrcode first draft #24
* demo: add qrcode demo skeleton, entries #24
* qrcode demo #24
* fedora python build changes from @dcantrell
* ncplane_qrcode() works #24
* add some flash to the qrcode demo #24
* drone: use newest builders
* fix up rgb PoC
* drop jungle demo to 100Hz target
* add fd.c
* ncfd skeletons
* more ncfdplane #514
* ncfdp i/o loop
* ncfp: improve uinit test, write core
* firm up ncfdplane #514
* fileroller PoC #514
* ncplane: allow '\n' in stream when scrolling #523
4 years ago
Marek Habersack 3ea7bbba18 [C++] Restore NotCurses::render semantics
Go back to returning `bool`, it was an oversight in 64eeb95f
4 years ago
nick black dba42f9eef
ncplane_at_yx_cell(): plug memory leak on success path 4 years ago
Nick Black 1c7796a2b0
ncdirect_cursor_yx, ncdirect_cursor_pop, ncdirect_cursor_push #401 (#492)
* ncdirect_cursor_{push, pop, yx} declarations #401
* direct PoC: invoke ncdirect_cursor_yx() #401
* direct PoC: move to top of screen #401
* OTHERS.md: mention blessings
* ncdirect_cursor_yx working #401
* CHANGELOG: mention ncdirect_cursor_*() #401
4 years ago
Nick Black c6a9997554
Normalize ncplane_at_* / ncplane_set_base() (#479)
* ncplane_at_* and ncplane_at_cursor_*

We had notcurses_at_yx() expanding into three distinct parts of
the cell structure, and ncplane_at_yx() / ncplane_at_cursor()
writing directly to a cell. It was annoying to remember which
was which. The latter two now have a signature matching
notcurses_at_yx(), while the old functionality has been moved
to ncplane_at_yx_cell() and ncplane_at_cursor_yx(). #476
4 years ago
nick black d274af34b9 ncplot: define 2x2 and 4x2 sets #461 4 years ago
nick black 43c8b9fdb6 ncpp: drop USE_FFMPEG guards #488 4 years ago
nick black a0669974ff
ncplane_putstr_yx(): don't map 0 to -1 #485 4 years ago
Marek Habersack 64eeb95f1e [C++] Optionally enable throwing exceptions on errors
Nick prefers error handling based on exceptions in all cases, while I
prefer to save exception handling for truly exceptional situations -
function parameter validation and class constructor. However, there's no
need to not support both approaches, to be chosen at the discretion of
the developer.

NCPP follows RAII and all classes throw exceptions from their
constructors in case they cannot initialize properly. Likewise,
functions taking pointers that are required validate them and throw
exceptions whenever the requirement isn't met.

This commit goes one step further in that it enables optional validation
of notcurses function return values and throwing an
exception (`ncpp::call_error`) should the function signal an error. This
is disabled by default but it can be enabled by defining the
`NCPP_EXCEPTIONS_PLEASE` macro (preferably on the command line or
before *each* inclusion of any NCPP headers).

Out of necessity, this breaks the ABI (plus I found a handful of minor
issues in the code), but I think it's worth having this support in
place.
4 years ago
Marek Habersack 28976dfef2 [C++] Sync API changes
Been a while, but here goes, sync to the latest API changes.

Added:

  * Direct:   cursor_{up,left,right,down} (`ncdirect_cursor_{up,left,right,down}`)
  * Plane: constructors to use `ncplane_bound`
  * Plane: reparent (`ncplane_reparent`)
  * Plot: definition of `default_options`

Changed:

  * Plane (breaking): the `*gradient*` functions now return `int`
  * Plane (breaking): `polyfill` returns `int`
  * Plane (breaking): `stain` returns `int`
  * Plane (breaking): `blit_bgrx` takes `const void*` for `data`
  * Plane (breaking): `blit_rgba` takes `const void*` for `data`
  * Plot: `plot_optons` -> `ncplot_options`
  * Plot (breaking): `{add,set}_sample` now return `bool`
4 years ago
nick black b04a37c433
plots: always start from the right #457 4 years ago
nick black 2c2da61c72
ncdirect: add relative move functions #419 4 years ago
Nick Black c2a645e9af
Rust wrapper work (#454)
* packaging: s/libtinfo/Terminfo/g
* rust: add stddim_yx()
* rust: check for valid init in unit tests
* rust: serialize up tests
* constify notcurses_term_dim_yx()
* rust: add dim wrappers
* remove notcurses_resize() from public API #367
* call notcurses_resize() from notcurses_refresh() #367
4 years ago
nick black eccb24a391 c++ plot shouldn't allow negative samples #447 4 years ago
nick black 9dc81f0b64 c++ wrappers for ncplot #441 4 years ago
nick black 77dd998b05
ncplot uses exclusively non-negative samples #447 4 years ago
nick black 5c44416426
export ncplane_putstr_yx() as static inline 4 years ago
nick black 4a6ab358ba inline ncplane_putsimple_yx() 4 years ago
nick black fcd7e19e4c Add ncplane_set_scrolling() #323 4 years ago
nick black 4917603478
ncplot: swap NCPLOT_2x1 and NCPLOT_1x1x4 4 years ago
nick black 2a7ccffec6 ncplot: add labelaxisd, use it in keyplot #438 4 years ago
nick black c0f8d9b444
eliminate detectdomain, infer it from maxy==miny #439 4 years ago
nick black 68b4ba1706 plots: implement remaining vertical grid types #136 4 years ago
nick black 5f3eb3dc24 keyplot: add third plot, this one with half blocks #433 4 years ago
nick black a3f7dd486b plot: AugmentSample5 test case 4 years ago
nick black 5bccf6b446 ncplot: implement x windowing #430 4 years ago
nick black 4926186b5a ncplot: check input parameters for validity #430 4 years ago
nick black b3e874a179 ncplot: fold minx, maxx into rangex 4 years ago
nick black 09d8912d4e notcurses-keyplot #430 4 years ago
nick black 5e27499194 add notcurses-keyplot #430 4 years ago
nick black d541cda306 independent variable 4 years ago
nick black 4afda7a625 float some geometry concepts 4 years ago
nick black 5aedb3491d ncplot_plane(), ncplot_destroy() 4 years ago
nick black f29a5a7bd9 declare ncplot_create() 4 years ago
nick black a45d888601
All fill-type functions return cells changed
Fill-type functions used to return 0 for success, and -1
on failure. They now return the number of cells written
on success, similarly to ncvisual_render(). Resolves #427.
4 years ago
nick black 8651486ad7
Don't say DirectColor when TrueColor is meant 4 years ago
nick black a77774f4dc
notcurses_at_yx(): value-result u32+u64, not cell
Resolves #410. notcurses_at_yx() accepted a cell*, but the
gcluster of this cell was always set to 0. The EGC is instead
a heap-allocated copy, returned as the primary return value.
This is due to the absence of an egcpool to bind against.
Existing callers can be converted thus:

* instead of passing cell 'c', pass &(c)->attrword, &(c)->channels
* either initialize 'c' with CELL_TRIVIAL_INITIALIZER, or set its
   gcluster field to 0 following the call

I've updated all calls from tests/demos, updated the docs, and
updated the C++ and Python wrappers.
4 years ago
nick black 73b61f6a69 Add bound planes (#71) plus docs/tests
Add ncplane_bound(3). This allows a new plane N to be created in the
*bound* state relative to another ncplane B. If B moves, N moves the
same amount. If N is moved, the coordinates are taken relative to B
as opposed to the standard plane. If B is destroyed, N is destroyed.
Each plane can have many planes bound to it, but can only be bound to
a single plane. Add ncplane_reparent(3). This allows a plane to be
detached from any plane to which it is bound, and optionally rebound
to a new plane. The standard plane cannot be reparented.
Documentation and unit tests have been added for both.
4 years ago
nick black 91f907a184
gradient_sized (C++): fix parameter name 4 years ago
Nick Black f9c54761f5
Basic mandelbrot for `n`ormal demo #145 (#424)
normal: working mandelbrot, very basic #145
4 years ago
Nick Black de9158bd7b
More tetris work for book #421 (#423)
* tetris: use NES gravities
* tetris: use NES grav multiplier of 50ms
* tetris: implement move down #421
* README: mention notcurses-tetris #421
* tetris: use double box for boundary #421
* tetris: extract background.h
* tetris: break up into chunks suitable for book
* tetris: do the rotations
4 years ago
nick black ae1421db15
ncvisual_render() API change/documentation #422
ncvisual_render() now returns the number of cells emitted
rather than just 0/-1. -1 is still returned on failure.
Rather than 0 for length meaning "all possible length", it
now means 0, and -1 means "all possible length". All demos,
tests, and PoCs have been updated. #422
4 years ago
Marek Habersack 73b13e0fd5 [C++] There can be only one stdplane
Fixes: https://github.com/dankamongmen/notcurses/issues/409

Standard planes can be duplicated but the copy must not be treated as a
standard plane. There can be only one :)

Make it so.
4 years ago
nick black 8113ce72c1 fix dumb error in ncplane_below() description 4 years ago
Nick Black 2b7b384e91
Most of notcurses-tetris, mergedown fixes (#420)
* ncplane_mergedown() fix for small planes #417
* tetris game needed for the book
4 years ago
Marek Habersack ad93c03851 [C++] API sync
Added:

  * Plane: mergedown (`ncplane_mergedown`)
4 years ago
Nick Black 52bdbc6724
ncplane_translate() accept NULL dest as standard plane #408 (#411)
* tetris man page
* tetris basic skeleton
* tetris: Ticker()
* README: fix up some obsolete terminology
* tetris: draw the game board
* tetris: add NewPiece()
* tetris: draw tetriminos
* tetris: check for stuck piece, move it down
* Accept NULL dst in ncplane_translate() #408
4 years ago
nick black 7e71ad8e11 implement ncplane_mergedown() #361 4 years ago
nick black 38f4255dc0 Define ncplane_mergedown() #361
ncplane_mergedown() is similar to the "Merge down" operation
in the GIMP. It writes to the destination plane the result
of rendering the source and destination frames per se.
4 years ago
nick black 8312b88e3c NotCurses::stop(): match original semantics 4 years ago
nick black 66bb614ab3 NotCurses::stop(): propogate out notcurses_stop() return value 4 years ago
Marek Habersack 3e78dd7d1f [C++] API sync
New classes:

   * MultiSelector (`ncmultiselector_*`)

Added:

   * Direct: cursor_{enable,disable}
   * Plane: high_gradient (`ncplane_highgradient`)
   * Plane: high_gradient_sized (`ncplane_highgradient_sized`)
   * Plane: rotate_cw (`ncplane_rotate_cw`)
   * Plane: rotate_ccw (`ncplane_rotate_ccw`)

Updated:

   * NotCurses: added all the margin initializers to the default options
4 years ago
nick black ba90c70a47
ncplane_cursor_yx() takes const first argument 4 years ago
nick black 1b4333861a
add ncdirect_{en,dis}able_cursor() #402 4 years ago
Nick Black c056a0a026
Subregion renders #293 (#404)
Add four new fields to notcurses_options: margin_{tblr}, which requests margins to the top, right, bottom, and left. Render only within those margins, leaving the screen otherwise untouched (well, cleared if using the alternate screen). #293
4 years ago
nick black be089747a7 ncmultiselector_selected() #322 4 years ago
nick black 638be8feb7 multiselector options/items #322 4 years ago
nick black a46393b035 ncmultiselect: get space rigged up #322 4 years ago
nick black 4abe078eae ncmultiselector #322 4 years ago
nick black 635d6e5751 ncmultiselect demo 4 years ago
nick black 6060248968 ncmultiselector_options structure #322 4 years ago
nick black eead4c1414
notcurses_highgradient() added #398 4 years ago
Nick Black 4e58747709
ncplane_rotate_cw() and ncplane_rotate_ccw() (#396)
Introduce limited plane rotation capability. We currently support clockwise and counterclockwise rotation of planes. Square and rectangular geometries are both supported, but there must be an even number of columns. The atomic unit of rotation is a 2x1 "square" (this assumes .5 cell aspect ratio). We can only rotate those glyphs which have rotated equivalents, and not even all of those. We currently handle only:

* null glyph
* space
* upper half block
* lower half block
* full block

I've added unit tests as well. This functionality is used by our Tetris example in the book
4 years ago
nick black 333f7c1192
define ncplane_rotate_cw/ccw() 4 years ago
nick black 3498956370
ncplane_mouseevent_p()->ncplane_translate_abs()
ncplane_mouseevent_p() is retired--it was poorly named, and
ncplane_translate_abs() does what it does, plus more, plus
more generally (it works on any y, x, not necessarily an
ncinput). update c++ wrappers #394.
4 years ago
nick black bb579d0d05
notcurses_directmode()->ncdirect_init() 4 years ago
nick black c6f27f1bee
notcurses_resize() update docs #367 4 years ago
nick black c87a9ed5dd
Gradients: set alpha, better prechecks #389
Gradients can't use palette-indexed color, so don't allow it
in either the foreground or background of any channels. All
channels must have the same alpha setting, which will be matched
in the gradient. #389
4 years ago
Marek Habersack 3467a0adef [C++] API sync
Added:

  * NCKey: `ScrollUp`, `ScrollDown` and `Return`
  * Plane: is_mouse_event (`ncplane_mouseevent_p`)
4 years ago
nick black 87cac84db2
remove obsolete FIXME 4 years ago
nick black a09bdc4ade
Add seqnum field to ncinput #374 4 years ago
nick black ddd33fea31
ncdirect_move() doc, readme, python, c++ #382 4 years ago
nick black a626178b16
ncdirect: cursor movement / geom detection #382 4 years ago
nick black 40428fd05e
Cell: non-OPAQUE always sets non-default bit 4 years ago
nick black bdd0917ea4
selector: transparent where we aren't 4 years ago
nick black bf60c51b3d
nckey: aliases NCKEY_ENTER, SCROLL_* 4 years ago
Marek Habersack 945c3a5f4f [C++] API sync
Added:
 * Cell: get_addrword (`cell.attrword`)
 * Cell: get_channels (`cell.channels`)
 * NotCurses: get_stdplane overloads (`notcurses_stddim_yx`)
 * Plane: putc (support for `ncplane_putsimple_stainable`,
   `ncplane_putegc_stainable`, `ncplane_putwegc_stainable`)
 * Plane: format (`ncplane_format`)
 * Plane: stain (`ncplane_stain`)
 * Plane: translate (`ncplane_translate`)
4 years ago