Commit Graph

1110 Commits (43c81ed94439017709b7fa95738ba4c13cd51def)

Author SHA1 Message Date
nick black deea4ddf9c ncdirectf_geom: move to ncvisual_options #1746 3 years ago
joseLuís 8432486b26 explain the return value of ncplane_set_base 3 years ago
nick black 3ca80fecd7 add internal NCVISUAL_OPTION_SCROLL, pass from ncdirect #1733 3 years ago
nick black 5426e153f7 ncdirectf_render: make ncvisual_options const, thanks @joseluis #1738 3 years ago
nick black 59f4edd777 ncdirectf_render: accept an ncvisual_options #1738 3 years ago
nick black 6fcaad3c5d
generalize ncvisual_inflate() to ncvisual_resize_noninterpolative() #1738 3 years ago
nick black a6433caeaa add NCVISUAL_OPTION_NOINTERPOLATE #1576 3 years ago
nick black ea13e25cf4 kill NCSCALE_INFLATE #1576 3 years ago
nick black d4264586a0 point out that ncvisual_from_bgra() is byte-oriented 3 years ago
joseLuís c3f1d6c4a3 [rust] wrap ncdirectf functions
- add type aliases: NcDirectF (NcVisual alias), NcDirectV (NcPlane alias).
- implement wrapper methods for the `ncdirect_*` functions on NcDirectF.
- the methods over NcDirectF are prefixed with `ncdirectf_` to distinguish them
  from the other NcVisual methods (since they are both type aliases, they
  share their methods).
- fix typos in `direct.h`:
  - ncdirect_geom_frame > ncdirectf_geom()
  - ncdirect_render_loaded_frame > ncdirectf_render()
- add NcVGeom struct.
- minor fixes & rustfmt.
3 years ago
nick black 8d22f4618f
lookup_blitset: replace O(N) loop with O(1) access 3 years ago
Nick Black cd2b5de5fa
Panblitter ncplane_as_rgba() (#1697)
ncplane_as_rgba: genericize across blitters

ncplane_as_rgba() previously was implemented explicitly
in terms of NCBLIT_2x1. it now uses the `egcs` field of the
`blitset`. this supports NCBLIT_2x2 and NCBLIT_3x2 in
ncplane_rgba(). Closes #1490.
3 years ago
nick black d20a4d8104
ncdirect: restore colors properly following sgr #1703 3 years ago
nick black c4e2932c76 add ncdirect_supported_styles(), move SGR/SGR0/OC into escblock #1525 3 years ago
nick black 50693fb812
add a section on hardware cursor to notcurses_init.3 #1681 3 years ago
nick black f2b26723c9
document notcurses_cursor_yx() #1681 3 years ago
nick black 8ff2499b44
ncdirectf_geom: approximate rcell{y,x} #1665 3 years ago
nick black 1622beeac4
ncvisual_from_rgba: align suitably for ffmpeg (64B) #1675 3 years ago
nick black 6969652031
add ncinput_nomod_p() 3 years ago
nick black 6b2169d8ec vizdirect: exercise the ncdirectf path 3 years ago
nick black 22e7fbf4c9 ncvgeom: explicitly set rcelly/rcellx to -1 until filled 3 years ago
nick black c42fab1564 implement ncdirectf passthroughs #1659 3 years ago
nick black d1e7adf410 add ncdirectf api #1659 3 years ago
nick black 20c9ff85be ncdirect: add nonnull attributes throughout 3 years ago
nick black 346512ccdf
eliminate type-2 gclusters, sprixels no longer interact with fb #1656 3 years ago
nick black 8bd73378cf
add NCSCALE_INFLATE 3 years ago
nick black f080e1502b add ncplane_erase_region() 3 years ago
nick black 84c7aca04e
add ncblit_rgb_packed(), ncblit_rgb_loose() #1634 3 years ago
nick black 02af161b98
notcurses_stats_alloc: mark paramater as unused #1633 3 years ago
joseLuís 66e20bdac8 [rust] safely wrap ncmetric function & fix warnings
- fix warnings on doc generation from imported C API doc-comments
- fix remaining clippy warning
3 years ago
nick black de1cc2c072 add NCVISUAL_OPTION_CHILDPLANE to notcurses.h 3 years ago
nick black 55837bcb55
add nccell_width() to avoid calling utf8_egc_len externally 3 years ago
nick black eb5c9185e5 pixel: shrink BYOP to match sprixel ("crop to content") 3 years ago
nick black 3eb004b61d s/channels/ncchannels/g #1570 3 years ago
nick black d8cc3569ac
Block some signals while writing
Writing a partial escape can easily lock up a terminal. This
is especially relevant when working with bitmaps, as they're
thousands or even millions of times longer than a typical
escape. Immediately before writing, block SIGINT, SIGQUIT, and
SIGTERM in the writing thread, and unblock them upon emerging
(at which point we'll immediately see any queued signal
get delivered). Don't block signals like SIGSEGV that would
seem indicative of actual problems. For this to actually work,
all other threads must also have the signals masked; we thus
now add them to the signal mask of notcurses_getc(), rather
than deleting them. Closes #1416.
3 years ago
nick black e43a9955cd
channel_* functions -> ncchannel_* #1570 3 years ago
nick black bd6a7918f2 kill freebsd ignored-attributes warning 3 years ago
Nick Black 2c5d938cbd
Paint sprixels bottom-to-top (#1589)
* Paint sprixels in order, bottom-to-top

We don't want to have to track sprixel order whenever someone
moves an ncplane, so just keep a list growing backwards as we
pass top-to-bottom in notcurses_render_internal(). Each time
we hit a sprixel plane, splice it out of the sprixel list, and
add it to the front of our temporary list. When we hit the
bottom, stick this temporary list on the end of our existing
list (any such planes are to be deleted, which comes before
drawing). Closes #1575.

* reorder collected sprixellist; solves kitty but breaks sixel =/ #1575

* remove debugging cruft

* [rust] fix up mergedown mutability
3 years ago
nick black 96981c8e75
extract paint_sprixel() as single loop #1587 3 years ago
Nick Black c8680255be
palette256 -> ncpalette #1570 (#1573)
everything prefixed with palette256 is now prefixed with ncpalette
3 years ago
nick black c7d284a9af
demo: make debug plane 81 wide, with transparent last column 3 years ago
nick black f4aa419a31
add notcurses_canhalfblock()/notcurses_canquadrant() #1575 3 years ago
nick black 8f2398132c
notcurses.h: move deprecated functions to end of file 3 years ago
nick black 6c7b40debf
add stats for sprixel emissions/elisions #1563 3 years ago
joseLuís bc123fbba8 undo prev. ncvisual_resize related changes #1559 3 years ago
joseLuís 0ec15fa920 update doc for ncvisual_resize; fix #1559 3 years ago
nick black c0af379683
restore deprecated cell_extended_gcluster to ABI 3 years ago
nick black c3c5b397a3
run ncvisual_resize() in bitmap tests #1559 3 years ago
nick black c875eb4544
clamp Sixel to max supported size #1550 3 years ago
nick black 266ed71c0b
ncdirect_stream: fix c++ wrapper's error guard 3 years ago
nick black 6b7195a387 document new function ncvisual_inflate() #1546 3 years ago
Nick Black 8c6cd6a630
Further work on opacity optimizations (#1549)
* [bitmap] on move, clear old OPAQUE cells #1527
* update ncvisual_blitter_geom() documentation #1547
* replace some ncvisual_blitter_geom with NCVISUAL_OPTION_VERALIGNED
* [normal] replace ncvisual_blitter_geom with NCVISUAL_OPTION_VERALIGNED
* [intro] use ncvisual_blitter_geom() correctly #1547
* ncvisual_blitter_geom: only set *blitter on success
3 years ago
nick black b070b69eb2
get last remaining cell_ functions -> nccell_ #1532 3 years ago
nick black 7ad5219fa2
convert another crop of cell_ to nccell_ #1532 3 years ago
nick black d2394f9c63
c++ wrapper for direct-mode streaming #1515 3 years ago
nick black 32500239ac
cell_extract() -> nccell_extract() 3 years ago
nick black da2a897544
fix unintended cell abi breakage #1532
cell_release() and cell_duplicate() were deprecated in 2.2.6,
but replaced with static inlines. this breaks the abi, forcing
recompiles from client programs. restore them as exported
functions.
3 years ago
nick black 96ac640733
cell->nccell 3 years ago
nick black 657ed15632
cell_on_styles -> nccell_on_styles() #1532 3 years ago
Nick Black e591ec2e98
cell -> nccell throughout much of remaining API (#1535)
cell -> nccell throughout much of the API #1532
3 years ago
nick black 0c566cd74a [ncvisual] pipe transcolor through #1518 3 years ago
nick black ff76dba6ed
cell_strdup -> nccell_strdup 3 years ago
nick black d504e972cc
cell_release -> nccell_release 3 years ago
nick black cf3a6317aa export ncdirect_stream() 3 years ago
nick black 53894caccb add ncdirect_stream #1346 3 years ago
Nick Black 04b1ba8ed2
Dankamongmen/unify geom (#1514)
deprecate ncvisual_geom() in favor of new ncvisual_blitter_geom(), which allows caller to get the blitter used. replace the checks and calculations in ncvisual_render() with a call to ncvisual_blitter_geom(), unifying the two paths (and eliminating several bugs in the unloved ncvisual_geom()).
3 years ago
nick black 1f33ada62e
[cffi] update for ncplane_as_rgba() 3 years ago
nick black f294c6bb0b
add ncplane_pixelgeom() #1507 3 years ago
nick black 05082fc277
ncplane_as_rgba(), returns pixel geometry along with bitmap #1508 3 years ago
nick black 3b169dfa31
[notcurses.h] improve ncvisual_from_rgba() docs #1488 3 years ago
nick black 8e61429789
[notcurses.h] remove bogus restriction for ncvisual_render #1488 3 years ago
joseLuís fce6c6873f fix typos 3 years ago
nick black 4c735cd95d
[paint] why must we constify ourselves, every day 3 years ago
nick black afeed4d075
drone: run ctest with --output-on-failure 3 years ago
nick black c87992c452
[ncvisual] fix NCVISUAL_OPTION_VERALIGNED definition 3 years ago
nick black 50df69ab31 [planes] implement MARGINALIZED in ncplane_create() #1472 3 years ago
nick black 78c8e70933 [planes] add NCPLANE_OPTION_MARGINALIZED #1472 3 years ago
nick black 86de98c5d2 Fix cell blit / plane vertical alignment
Deprecate ncplane_align(), after rewriting it as a passthrough
to new function ncplane_halign(). Add ncplane_valign(). Update
all callers. Closes #1468.
3 years ago
nick black ff86bb0187 [ncvisual] first stab at NCVISUAL_OPTION_VERALIGNED #1461 3 years ago
nick black 465390f5e1 [planes] implement NCPLANE_OPTION_VERALIGNED #1465 3 years ago
nick black 6105913d06 [planes] add NCPLANE_OPTION_VERALIGNED #1465 3 years ago
nick black 828cce634a [capabilites] remove redundant notcurses_canpixel() 3 years ago
MasFlam c677a4fd8a
Add the nctabbed widget (#1431)
Tabs for the people!

fixes #986
3 years ago
nick black f28d579016 [ncpp] add ncdirect_cursor_yx() wrapper 3 years ago
nick black e3c79863fe mark ncplane_{yx}/nccplane_abs_{yx} as pure 3 years ago
nick black 3e4709e595 [intro] add natasha orca when we have pixel support #1423 3 years ago
nick black 33d408b4a3
[sixel] call sprite_sixel_init at proper time #1436 3 years ago
nick black f658629a1b
add new PoC caps-rendered #1430 3 years ago
nick black 5dcf4d3601
work around OIIO bswap32 definition #1392 3 years ago
nick black 6ce1daee74 [nccell] add comment about pixel gclusters #1401 3 years ago
nick black 645b61e9dc [pixel] pass celldimy through blitterargs #1401 3 years ago
nick black b18682e86c [pixels] rewrite cell_pixels_p() for 0x02 #1401 3 years ago
nick black 9728e79396 [ncplayer] obey margins in direct mode #1411 3 years ago
nick black 7bc3800e27 [direct] accept limits for prep_image() #1411 3 years ago
nick black d99b16a1ba ncpp: error_guard<int> in get_dim_x/y() #1413 3 years ago
nick black 04ad933a4b
ncplayer: don't try to drive four/eight #1406 3 years ago
nick black 9534bfdefd
ncplane_reparent: nonnull annotations 3 years ago
nick black b9382231e2
c++: pass self on reparenting, not nullptr 3 years ago
nick black 268a720225
Keep hardcursurpos bool across rasterizations
Move hardcursorpos into the renderstate carried
across rasterizations. This eliminates undesirable vertical
movement following pixel image emission #1400.
3 years ago
nick black 6693e5f386
pass tcache down through visual blit stack #1095 3 years ago
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>
3 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