Commit Graph

342 Commits (7d1e3c77c88b6a07b3c3880054fb9c9527656eb8)

Author SHA1 Message Date
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