Commit Graph

673 Commits (60cce801b522de8ca705fd49f3bc8eea90e30902)

Author SHA1 Message Date
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
Nick Black 745e742a12
Fix gradient engine #368 (#372)
Simplify and correct the gradient engine, resolving all test breakage.
4 years ago
nick black 5e38da9ea3
implement ncplane_stain() #347 4 years ago
nick black 002e8be574
implement ncplane_format() #347 4 years ago
nick black 2780734efd
add ncplane_translate() 4 years ago
nick black f9d98dd05c
notcurses_stdplane_dimyx() #365 4 years ago
nick black 35d850f008
Implement + test ncplane_putegc_stainable() #352 4 years ago
Nick Black e5d6685c92
No locks, more lox #290 (#358)
* README/CMake: only require doctest 2.3.5

* man pages: remove talk of locking #290

* Remove locking from notcurses core #290

* Purge locking from notcurses core #290
4 years ago
Nick Black e6637e81cc
Prep for serious rusting #101 (#354)
* CMake: add USE_PANDOC, USE_DOXYGEN options #101
* README: mention rust
* start integrating rust into build #101
* CMake: add USE_NETWORK option for cargo
* Debian: build-dep on doxygen
* rust: colloquy checks in Cargo.lock
* extract NCKEY defines into their own include
* colloquy: use clap to parse CLI args
* CMake: unify option namespace
* Python: update include path
* Rust: fix up --frozen workings for -DUSE_NETWORK=off
* CMake: abstract out colloquy a little
* Sync direct.hh to the New Way
4 years ago
Marek Habersack e429724287 [C++] API sync + some (breaking) changes
Added:

 * Plane: gradient (`ncplane_gradient`)
 * Plane: gradient_sized (`ncplane_gradient_sized`)
 * NotCurses: drop_planes (`ncplane_drop_planes`)
 * NcReel: constructor which takes `Plane&`
 * Visual: constructors which take `Plane const*`, `Plane&` and `Plane const&`)
 * ncpp_build: a nonsensical "demo" which exists purely to test whether
   the C++ builds and does absolutely nothing interesting.

Broke:
 * All exceptions throw temporary objects instead of allocated
   instances. Less typing in `catch` :P (and more conventional)
4 years ago
Jakub Wilk f08d51c5e7 fix typos 4 years ago
nick black c6520ab84c add notcurses_drop_planes, use from demo #346 4 years ago
nick black 8ecb4ba6a8 declare gradient functions #340 4 years ago
Marek Habersack fc264677f5 Sync C++ wrapper with the latest API changes
New classes:

 * Direct (`ncdirect_*`)
 * Menu (`ncmenu_*`)
 * Selector (`ncselector_*`)

Updates:

 * Plane: added copy constructors (mapped to `ncplane_dup`)
 * Plane: added `perimeter` (`ncplane_perimeter`)
 * Plane: added `polyfill` (`ncplane_polyfill`)
 * Plane: added `blit_bgrx` (`ncblit_bgrx`)
 * Plane: added `blit_rgba` (`ncblit_rgba`)
4 years ago
nick black 124004c87c add nplane_polyfill_yx() #340 4 years ago
nick black ce3e5d112e add ncdirect_clear() #343 4 years ago
nick black 6d629025e3 add ncdirect_fg_default() and ncdirect_bg_default() 4 years ago
nick black bfc28b0071 comment up ncdirect a bit better 4 years ago
nick black dc21f2cb09 introduce ncplot_options 4 years ago
nick black 52b4fb223a get down some thoughts on plots #136 4 years ago
nick black 9fc53e811f
ncplane_perimeter() plus unit test 4 years ago
nick black d8c42d4d1e
ncmenu_selected() fills in an ncinput #333 4 years ago
nick black b0c72607c4
ncmenu_offer_input(), use it in demo/pocmenu #333 4 years ago
nick black 7d1c977ba8
comment for nctablet_userptr() 4 years ago
nick black aacec297b2
ncmenu: declare ncmenu_offer_input() 4 years ago
nick black 74b9690cf3
ncmenu: remove dumb restrictions/special casing 4 years ago
nick black 3cdac5ce28 high-contrast text, simple linear average model #181 4 years ago
nick black 1ed6000193 ncstats: add plane count, fix fbbytes accounting 4 years ago
nick black d05abe8626 use channels_set_bchannel() 4 years ago
nick black 62488eaf10
blit->ncblit #324 4 years ago
nick black 74775b97ec
enmetric->ncmetric #324 4 years ago
nick black 89f516dcaa
tablet->nctablet, add ncreel to python #324 4 years ago
nick black c519c95fff
panelreel -> ncreel #324 4 years ago
nick black 09ff64e19f
ncdirect_style_*() #321 4 years ago
nick black bb7b92ea4a
ncdirect_styles_*() declarations #321 4 years ago
nick black 5cd3a4c41d
ncdirect_dim_y()/x() 4 years ago
nick black 2a9f3c5ab3
ncmenu_selected(), update docs #179 4 years ago
nick black 10a269c963
ncmenu: reject double menu 4 years ago